# Process monitoring

From Statistics for Engineering

## Learning outcomes

- Understand the principle of a Shewhart monitoring chart
- Calculating the limits for this chart
- Understanding how the limits affect Type I and type II errors
- Practical issues around implementing control charts
- Understanding the intention of the CUSUM and EWMA chart
- Introduction to the terminology of six-sigma, and process capability, with examples

## Resources

- Class notes 2015
- Class notes 2014
- Textbook, chapter 3
- Try this quiz (with solution)
- You must have completed steps 14 and 15 of the Software tutorial to successfully use R in this section.

## Extended readings

- In the classes and assignments you've had chances to build fairly easy monitoring charts. Challenge yourself now: build a monitoring chart on the Kappa number data set. Use the first 2000 samples for phase 1, and the remaining data for phase 2.
- Read the article about "The Toyota Way" to understand partly why Toyota has become one of the more successful car manufacturers.
- Read this article critically "Survivor of wrong-way 427 crash that killed husband, daughter, speaks out" (The Hamilton Spectator, 02 April 2015). It has reference to false positives and negatives in two instances: the blood test, and the court's decision. Can you identify both? You do you interpret these in the context of this section of the course material?
- Many medical diagnostics have quick-screening alternatives. For example, there are recent mobile phone apps that screen for HIV, syphilis, and other proteins that indicate disease. If you were designing these apps, would you set them to have a high type I error, or high type II error?

## Class videos from prior years

### Videos from 2015

Watch all these videos in this YouTube playlist

- An introduction and a demonstration of monitoring charts [07:59]
- Calculating the lower and upper control limits in phase 1 [09:46]
- The meaning of type 1 and type 2 errors [07:28]
- Shortcomings of single variable monitoring and why multivariate monitoring is required
- The CUmulative SUM (CUSUM) monitoring chart
- The Exponentially Weighted Moving Average (EWMA) monitoring chart
- Introduction to the Process Capability number [11:00]
- Three examples of calculating and using process capability [03:35]

07:59 | Download video | Download captions | Script |

09:47 | Download video | Download captions | Script |

07:29 | Download video | Download captions | Script |

Covered in class | No video | Script |

Covered in class | No video | Script |

Covered in class | No video | Script |

11:00 | Download video | Download captions | Script |

03:36 | Download video | Download captions | Script |

### Videos from 2014

### Videos from 2013

## Software codes for this section

### R code for deriving monitoring limits

```
# Read a column of raw data to demonstrate this example
f <- 'http://openmv.net/file/rubber-colour.csv'
raw.data <- read.csv(f)
# Subgroup size
N <- 5
samples <- dim(raw.data)[1]
# Form an array for the subgroup calculations
# See https://learnche.org/4C3/Software_tutorial/Vectors_and_matrices
# for an explanation of this line of code, as well as the
# apply(...) function, a few lines down.
reshaped <- matrix(raw.data$Colour, N, samples/N)
# Calculate the subgroups:
groups.S <- apply(reshaped, 2, sd)
groups.x <- round(apply(reshaped, 2, mean))
xdb <- mean(groups.x)
s.bar <- mean(groups.S)
# Correction factor (from tables, theoretically)
an.5 = 0.940
an.5 = sqrt(2)*gamma(N/2.0)/( sqrt(N-1)*(gamma(N/2.0-0.5)) )
LCL <- xdb - 3*s.bar/(an.5*sqrt(N))
UCL <- xdb + 3*s.bar/(an.5*sqrt(N))
# Display the results
c(LCL, UCL)
# Are there any subgroup outliers? [Yes]
c(sum(groups.x < LCL), sum(groups.x > UCL))
# Plot the results:
plot(groups.x, ylim=c(LCL-2, UCL+2),
ylab="Subgroup averages using n=5",
xlab="Sequence order",
main=paste0("Preliminary monitoring chart ",
"(limits not finalized yet)"))
abline(h=LCL, col="red")
abline(h=UCL, col="red")
# Now exclude the unusual column of data, column 14
reshaped <- reshaped[, -14]
groups.S <- apply(reshaped, 2, sd)
groups.x <- round(apply(reshaped, 2, mean))
xdb <- mean(groups.x)
s.bar <- mean(groups.S)
LCL <- xdb - 3*s.bar/(an.5*sqrt(N))
UCL <- xdb + 3*s.bar/(an.5*sqrt(N))
c(LCL, UCL)
# Are there any subgroup outliers? [No]
c(sum(groups.x < LCL), sum(groups.x > UCL))
```