# Understanding Process Variation with Control Charts

#### Minitab Cookbook

\$32.99

With over 110 practical recipes, this is the ideal book for all statisticians who want to explore the vast capabilities of Minitab to organize data, analyze it, and visualize it with impactful graphs.

(For more resources related to this topic, see here.)

# Xbar-R charts and applying stages to a control chart

As with all control charts, the Xbar-R charts are used to monitor process stability. Apart from generating the basic control chart, we will look at how we can control the output with a few options within the dialog boxes. Xbar-R stands for means and ranges; we use the means chart to estimate the population mean of a process and the range chart to observe how the population variation changes.

For more information on control charts, see Understanding Statistical Process Control by Donald J. Wheeler and David S. Chambers.

As an example, we will study the fill volumes of syringes. Five syringes are sampled from the process at hourly intervals; these are used to represent the mean and variation of that process over time.

We will plot the means and ranges of the fill volumes across 50 subgroups. The data also includes a process change. This will be displayed on the chart by dividing the data into two stages.

The charts for subgrouped data can use a worksheet set up in two formats. Here the data is recorded such that each row represents a subgroup. The columns are the sample points. The Xbar-S chart will use data in the other format where all the results are recorded in one column.

The following screenshot shows the data with subgroups across the rows on the left, and the same data with subgroups stacked on the right:

## How to do it…

The following steps will create an Xbar-R chart staged by the Adjustment column with all eight of the tests for special causes:

1. Use the Open Worksheet command from the File menu to open the Volume.mtw worksheet.
2. Navigate to Stat | Control Charts | Variables charts for subgroups. Then click on Xbar-R….
3. Change the drop down at the top of the dialog to Observations for a subgroup are in one row of columns:.
4. Enter the columns Measure1 to Measure5 into the dialog box by highlighting all the measure columns in the left selection box and clicking on Select.

5. Click on Xbar-R Options and navigate to the tab for Tests.
6. Select all the tests for special causes.
7. Select the Stages tab.
8. Enter Adjustment in the Define Stages section.
9. Click on OK in each dialog box.

## How it works…

The R or range chart displays the variation over time in the data by plotting the range of measurements in a subgroup. The Xbar chart plots the means of the subgroups.

The choice of layout of the worksheet is picked from the drop-down box in the main dialog box. The All observations for a chart are in one column: field is used for data stacked into columns. Means of subgroups and ranges are found from subgroups indicated in the worksheet. The Observations for a subgroup are in one row of columns: field will find means and ranges from the worksheet rows.

The Xbar-S chart example shows us how to use the dialog box when the data is in a single column. The dialog boxes for both Xbar-R and Xbar-S work the same way.

Tests for special causes are used to check the data for nonrandom events. The Xbar-R chart options give us control over the tests that will be used. The values of the tests can be changed from these options as well. The options from the Tools menu of Minitab can be used to set the default values and tests to use in any control chart.

By using the option under Stages, we are able to recalculate the means and standard deviations for the pre and post change groups in the worksheet. Stages can be used to recalculate the control chart parameters on each change in a column or on specific values. A date column can be used to define stages by entering the date at which a stage should be started.

## There's more…

Xbar-R charts are also available under the Assistant menu. The default display option for a staged control chart is to show only the mean and control limits for the final stage. Should we want to see the values for all stages, we would use the Xbar-R Options and Display tab. To place these values on the chart for all stages, check the Display control limit / center line labels for all stages box. See Xbar-S charts for a description of all the tabs within the Control Charts options.

# Using an Xbar-S chart

Xbar-S charts are similar in use to Xbar-R. The main difference is that the variation chart uses standard deviation from the subgroups instead of the range. The choice between using Xbar-R or Xbar-S is usually made based on the number of samples in each subgroup. With smaller subgroups, the standard deviation estimated from these can be inflated. Typically, with less than nine results per subgroup, we see them inflating the standard deviation, which increases the width of the control limits on the charts. Automotive Industry Action Group (AIAG) suggests using the Xbar-R, which is greater than or equal to nine times the Xbar-S.

Now, we will apply an Xbar-S chart to a slightly different scenario. Japan sits above several active fault lines. Because of this, minor earthquakes are felt in the region quite regularly. There may be several minor seismic events on any given day. For this example, we are going to use seismic data from the Advanced National Seismic System. All seismic events from January 1, 2013 to July 12, 2013 from the region that covers latitudes 31.128 to 45.275 and longitudes 129.799 to 145.269 are included in this dataset. This corresponds to an area that roughly encompasses Japan.

The dataset is provided for us already but we could gather more up-to-date results from the following link:

http://earthquake.usgs.gov/monitoring/anss/

To search the catalog yourself, use the following link:

http://www.ncedc.org/anss/catalog-search.html

We will look at seismic events by week that create Xbar-S charts of magnitude and depth. In the initial steps, we will use the date to generate a column that identifies the week of the year. This column is then used as the subgroup identifier.

## How to do it…

The following steps will create an Xbar-S chart for the depth and magnitude of earthquakes. This will display the mean, and standard deviation of the events by week:

1. Use the Open Worksheet command from the File menu to open the earthquake.mtw file.
2. Go to the Data menu, click on Extract from Date/Time, and then click on To Text.
3. Enter Date in the Extract from Date/time column: section.
4. Type Week in the Store text column in: section.
5. Check the selection for Week and click on OK to create the new column.
6. Navigate to Stat | Control Charts | Variable charts for Subgroups and click on Xbar-S.
7. Enter Depth and Mag into the dialog box as shown in the following screenshot and Week into the Subgroup sizes: field.

8. Click on the Scale button, and select the option for Stamp.
9. Enter Date in the Stamp columns section.
10. Click on OK.
11. Click on Xbar-S Options and then navigate to the Tests tab.
12. Select all tests for special causes.
13. Click on OK in each dialog box.

## How it works…

Steps 1 to 4 build the Week column that we use as the subgroup. The extracts from the date/time options are fantastic for quickly generating columns based on dates. Days of the week, week of the year, month, or even minutes or seconds can all be separated from the date.

Multiple columns can be entered into the control chart dialog box just as we have done here. Each column is then used to create a new Xbar-S chart. This lets us quickly create charts for several dimensions that are recorded at the same time. The use of the week column as the subgroup size will generate the control chart with mean depth and magnitude for each week.

The scale options within control charts are used to change the display on the chart scales. By default, the x axis displays the subgroup number; changing this to display the date can be more informative when identifying the results that are out of control. Options to add axes, tick marks, gridlines, and additional reference lines are also available. We can also edit the axis of the chart after we have generated it by double-clicking on the x axis.

The Xbar-S options are similar for all control charts; the tabs within Options give us control over a number of items for the chart. The following list shows us the tabs and the options found within each tab:

• Parameters: This sets the historical means and standard deviations; if using multiple columns, enter the first column mean, leave a space, and enter the second column mean
• Estimate: This allows us to specify subgroups to include or exclude in the calculations and change the method of estimating sigma
• Limits: This can be used to change where sigma limits are displayed or place on the control limits
• Tests: This allows us to choose the tests for special causes of the data and change the default values. The Using I-MR chart recipe details the options for the Tests tab.
• Stages: This allows the chart to be subdivided and will recalculate center lines and control limits for each stage
• Box Cox: This can be used to transform the data, if necessary
• Display: This has settings to choose how much of the chart to display. We can limit the chart to show only the last section of the data or split a larger dataset into separate segments. There is also an option to display the control limits and center lines for all stages of a chart in this option.
• Storage: This can be used to store parameters of the chart, such as means, standard deviations, plotted values, and test results

## There's more…

The control limits for the graphs that are produced vary as the subgroup sizes are not constant; this is because the number of earthquakes varies each week. In most practical applications, we may expect to collect the same number of samples or items in a subgroup and hence have flat control limits.

If we wanted to see the number of earthquakes in each week, we could use Tally from inside the Tables menu. This will display a result of counts per week. We could also store this tally back into the worksheet.

The result of this tally could be used with a c-chart to display a count of earthquake events per week.

If we wanted to import the data directly from the Advanced National Seismic System, then the following steps will obtain the data and prepare the worksheet for us:

2. Enter 2013/01/01 in the Start date, time: field.
3. Enter 2013/06/12 in the End date, time: field.
4. Enter 3 in the Min magnitude: field.
5. Enter 31.128 in the Min latitude field and 45.275 in the Max latitude field.
6. Enter 129.799 in the Min longitude field and 145.269 in the Max longitude filed.
7. Copy the data from the search results, excluding the headers, and paste it into a Minitab worksheet.
8. Change the names of the columns to C1 Date, C2 Time, C3 Lat, C4 Long, C5 Depth, C6 Mag. The other columns, C7 to C13, can then be deleted.
9. The Date column will have copied itself into Minitab as text; to convert this back to a date, navigate to Data | Change Data Type | Text to Date/Time.
10. Enter Date in both the Change text columns: and Store date/time columns in: sections.
11. In the Format of text columns: section, enter yyyy/mm/dd.
12. Click on OK.
13. To extract the week from the Date column, navigate to Data | Date/Time | Extract to Text.
14. Enter 'Date' in the Extract from date/time column: section.
15. Enter 'Week' in the Store text column in: field.
16. Check the box for Week and click on OK.

# Using I-MR charts

I-MR charts are used to plot single values over time. Individuals charts are typically used when we have single measurements at a point of time or at every result. Examples might include the production of smaller volumes such as aircraft or perhaps aircraft engines. Other scenarios might include situations where data collection is automated and all results are captured. The individual values are plotted against the overall mean and the moving range tracks variation by looking at differences between the results. Unlike Xbar-R or Xbar-S, which use a sample or subgroup to estimate the mean and variation, an I-MR chart estimates the short term variation from the average moving range. This is based on the successive differences between the individual values.

Here, we will use the values of temperature from the Oxford weather station to check the stability of temperature. Temperature is a seasonal value and we will look at the measurements separately by month. As the temperature data has been given to us in the form of the mean maximum daily temperature for each month, there are no logical subgroups into which to divide the data. We will therefore plot the temperature as individual values.

As temperatures show a high degree of seasonality across the year, it would not be sensible to plot all of the original temperature data as a control chart. Therefore, we will plot the temperature for a single month instead. In this recipe, we will plot the temperature for January from every year from the start of record keeping to the present day..

We will first split the worksheet by month, before running the I-MR chart on the results for January.

The data for this example can be found on the MET office website at the following address:

http://www.metoffice.gov.uk/climate/uk/stationdata/oxforddata.txt

Copy the data into Minitab and label the columns Year, Month, T Max, T Min, AirFrost(days), Rain(mm), and Sun(Hours).

This data is also available from the Oxford weather.txt file or the Oxford Weather (Cleaned).mtw file.

## How to do it...

The following steps will create a new worksheet for each month and then generate an I-MR chart for mean maximum and minimum January temperatures:

1. Go to the Data menu and click on Split Worksheet.
2. Enter the Month column as By variables:.
3. Click on OK.
4. Select the worksheet for Month = 1 for the January temperatures.
5. Navigate to Stat | Control Charts | Variables Charts for Individuals and click on I-MR.
6. Enter the columns for 'T Max' and 'T Min' as Variables.
7. Click on the Scale button and enter Year in the Stamp columns field by selecting the options as shown in the following screenshot:

8. Click on OK.
9. Select the I-MR options button, then choose the tab labeled Tests, and select Perform all tests for Special causes.
10. Click on OK in each dialog box.

## How it works…

Each column entered into the variables section for I-MR charts will create a separate control chart. We have created charts for both the mean maximum temperatures and the mean minimum temperatures for January from the start of the data in 1853.

Results that break the rules for identifying special causes or unusual variation are flagged in red with the test that has been broken. In the results shown in the preceding screenshot, Test 1 is flagged up for years 1917 and 1963 on the moving range chart. This seems to indicate a large change in temperatures from 1916 to 1917 and 1962 to 1963. Notice the result in the individuals' chart for 1963. This corresponds to one of the coldest winters in the UK since records began.

Some care should be taken with the interpretation of the previous results as adjacent points are one year apart.

The use of the Scale option, Stamp, allows us to use a column in the worksheet for the x axis labels. By displaying the year instead of the row number as the index, we can identify the years which contain unusual results. If the graph is the active window pop up, text highlighting the year will be displayed when we hover the cursor over a point.

I-MR charts, like most control charts, are an updating graph within Minitab. We can right-click on the chart and click on Update Graph Now when new data is entered or click on Update Graph Automatically.

Time-weighted charts are more appropriate than I-MR charts if we are interested in observing small changes. Advanced charts such as CUSUM or EWMA can be used to pick up on these smaller shifts in the process. See the example of the EWMA chart later as a comparison.

## There's more…

As the dialog boxes in Minitab remember previous settings, we can easily generate the charts for the other months by selecting one of the other worksheets. Go back to the previous dialog box using CTRL + E, and all we need to do is click on OK to run the same settings on the new worksheet. This can be automated by the use of macros. The macro command Worksheet can be used to specify a worksheet to make it active.

Defaults for the tests used in control charts can be specified from Tools and Options, as shown in the following screenshot:

The preceding screenshot shows the location of the options. Here it is possible to pick the tests to be used by default and the values of those tests. While Minitab uses the most common values of these tests, often test 2 is set at 7 or 8 points in a row rather than 9. This would make the test more sensitive to a process shift at the cost of increasing the risk of a false alarm.

An alternative method of selecting the results of January for the I-MR chart would be to use the Data Options button from the dialog box.

Here we can specify which rows to include or exclude from the study in the same manner as in the Subset Worksheet option.

# Using CUSUM charts

A CUSUM chart is used to look for small shifts from a target. There are two types of CUSUM chart that Minitab will generate: One-sided CUSUM charts, which we will use here, or the two-sided or V-mask CUSUM.

CUSUM charts like EWMA charts can be useful when subgrouping of the data for an Xbar chart is not feasible and the I-MR chart is not sensitive enough. These may include scenarios where we have low production volumes, or where sampling can be prohibitively expensive or potentially destructive.

The data in this example looks at the fill volumes of syringes. There is a target volume of 15 ml. We will plot the CUSUM using a subgroup size of one to identify deviations from this target.

## How to do it...

The following steps will generate a CUSUM for a target of 15 and a subgroup size of 1:

1. Use Open Worksheet… from the File menu to open the Volume2.mtw worksheet.
2. Navigate to Stat | Control Charts | Time-Weighted Charts and select CUSUM….
3. Enter Volume and enter Subgroup size: as 1 and the target as 15.
4. Click on OK to create the CUSUM.

## How it works…

The default plan type is the one-sided CUSUM. This plots two lines. The top line detects upwards shifts from the target and the lower CUSUM detects downward shifts. The type of CUSUM can be changed in CUSUM Options and the Plan/Type tab.

The values of h and k for the CUSUM plan affect the sensitivity of the CUSUM. In a one-sided CUSUM, h, the decision interval is the number of standard deviations between the center line and the control limits. The value of k affects the drift to be detected. Default figures of h and k are 4 and 0.5.

The Plan/Type tab also has options to select Fast Initial Response (FIR) and the two-sided CUSUM can be centered on a given subgroup.

The results can be compared with an I-MR chart using a historical mean of 15. By looking at the cumulative sum away from target, the CUSUM becomes more sensitive at identifying the small shifts away from target.

# Summary

In this article, you understood how control charts are used to monitor the stability of a process. Here, we looked at the use of the familiar Xbar-R, I-MR charts, and also went on to look at the more complex Laney control charts and rare event charts.

## Resources for Article:

Further resources on this subject:

### Books to Consider

Processing 2: Creative Coding HOTSHOT
\$ 26.99
BMC Control-M 7: A Journey from Traditional Batch Scheduling to Workload Automation
\$ 36.00
Getting Started with Oracle Event Processing 11g
\$ 24.00