In this video we'll look at describing through-time data using the run chart. Our learning objective is to construct a run chart using RStudio. Statistical analysis has two parts. First, we have graphics, which are pictures that provide a visual representation of what the numbers describe or identify. Secondly, we have numerics, numbers and statistical calculations which summarize, and describe our data. When it comes to statistical analysis we always use both pictures and numbers. We never present a picture without statistics, and never present statistics without a picture. The first step in the analysis and interpretation of data from a random sample is the arrangement, and presentation of the data. This should be done by first graphically describing the data. Some common methods of graphically describing sample data include, run charts, frequency distributions, including ungrouped, grouped, and relative, histograms, frequency polygons, and box and whisker plots. We're going to look at the following data to help us create the run chart. Let's assume that an engineer gathered 20 consecutive computer fans from a production line, keeping track of the order in which the fans were produced. These fans were then tested for airflow in cubic feet per minute. This testing produced the following data for the 20 fans presented in time order. Using this data, we're going to create this run chart. The first step is to use R to create a vector. You'll see here that we're going to put the data into an object. The C stands for combined or concatenated. We're creating a vector with this data. After we create the vector, we'll store the variable in a DataFrame. Let's do this now in R. First, we're going to create a new script file, in which to work. The first step is to create the vector. We'll replicate what was on the presentation. Once we've done so, we'll simply put our cursor on the line, we want to execute and click the Run button. Now, the next step is to store the variable in a DataFrame. I'm going to call this DataFrame, fans. I'll use DataFrame cfm. When I've completed this, I'll click on Run. If I want to see the data, I'll simply type in view fans, and run that code. Now you'll see I've created a DataFrame with the 20 data values inside of it. The next step is to create the run chart. We'll need to bring up the lolcat package, and then type in the following code to create the run chart. Our first step is to make sure we've pulled up the lolcat package, and next we'll type in spc.run.chart, and type in for our x value. We'll need to put in the name of the DataFrame in the specific column, in which we're interested in, which is cfm. I also would like to change the title. To do so I type in the word mean equals, and then put in quotations, run chart, computer fans. I also would like to change my y label from criterion measure to cubic feet per minute. To do so, I'll type in y label, equals cfm. Then click on Run. You'll see that I have a chart here to the right. It shows the through-time behavior of the data. Now my next step to add a few nuances to the chart, include adding a horizontal line of the average. Now, of course, I need to calculate the average first. To do so, I'm simply going to type in the code mean, and type in the information, fans, cfm, and execute that code. You'll see that the average is 72. Now, to add a horizontal line, I type in abline, and specify that it's horizontal, h equals 72, and run that code. When I do so, you'll see that I add a horizontal line to my data. Now, there are several other things you can do to make the chart different than how it appears, and you can customize your chart with colors, point sizes, line type. Let's explore a few of those now. We can change the symbol type by typing in pch equals, and then choosing a number one through 25, for the different types of point symbols. Let's try a different one than we have right now. I'm going to go back up to my code here and modify, by putting in pch equals, and choosing a number that's different than the default number of 19. I'm going to choose 20. Then I'm going to re-execute the picture. You'll see that our horizontal line disappeared. I've got a little smaller dot here. Let's try something different. Let's try five. You'll see that it changes it to a diamond shape. Now, I can also change the point size by using this code, cex equals, so I can make the point size larger if I so choose. To do so, I would return to my line of code, type in cex equals, and then choose a size. I'm going to choose three. We'll run. Now, you can see that these diamonds are a little large for our chart, which is why I would recommend doing one that's appropriate. But let's say you need a little bit bigger size. Certainly, you can do so. Sometimes that's helpful in identifying things on the y-axis. You can also change the color of the lines and points. I'm going to change it to red. You can use a color name or you can use a hexadecimal code. To do so, so I'll return to my code and I'll type in color equals red. We'll run this code and you'll see that everything turns red. We can also change the line type. The choices are zero through six. Let's take a look at the different line types we can choose. I will choose a line type equals three. Run the code. You'll see I get a dotted line. There are several different choices depending on what number you choose. Finally, we can add or change the line width. To change the line width, I'll simply return to my code, type in lwd equals three, and run. You'll see this increases the lines not only for connecting lines, but also lines related to the symbols.