Difference between revisions of "Process monitoring"

From Statistics for Engineering
Jump to navigation Jump to search
Line 102: Line 102:
* [http://www.r-fiddle.org/#/fiddle?id=NT40RAN3 Run this code in a web-browser]
* [http://www.r-fiddle.org/#/fiddle?id=NT40RAN3 Run this code in a web-browser]


<syntaxhighlight lang="rsplus">
<html><div data-datacamp-exercise data-lang="r" data-height="auto">
    <code data-type="sample-code">
# Read a column of raw data to demonstrate this example
# Read a column of raw data to demonstrate this example
raw.data <- read.csv('http://openmv.net/file/rubber-colour.csv')
f <- 'http://openmv.net/file/rubber-colour.csv'
raw.data <- read.csv(f)


# Subgroup size
# Subgroup size
N <- 5
N <- 5
samples <-dim(raw.data)[1]
samples <- dim(raw.data)[1]


# Form an array for the subgroup calculations
# Form an array for the subgroup calculations
# See https://learnche.org/4C3/Software_tutorial/Vectors_and_matrices
# See https://learnche.org/4C3/Software_tutorial/Vectors_and_matrices
# for an explanation of this line of code, as well as the apply(...) function
# for an explanation of this line of code, as well as the  
# further a few lines down.
# apply(...) function, a few lines down.
reshaped <- matrix(raw.data$Colour, N, samples/N)
reshaped <- matrix(raw.data$Colour, N, samples/N)


# Calculate the subgroups
# Calculate the subgroups:
groups.S <- apply(reshaped, 2, sd)
groups.S <- apply(reshaped, 2, sd)
groups.x <- round(apply(reshaped, 2, mean))
groups.x <- round(apply(reshaped, 2, mean))
Line 122: Line 124:
s.bar <- mean(groups.S)
s.bar <- mean(groups.S)


# Correction factor (use it from tables, or calculate it theoretically)
# Correction factor (from tables, theoretically)
an.5 = 0.940
an.5 = 0.940
an.5 = sqrt(2)*gamma(N/2.0)/ ( sqrt(N-1)*(gamma(N/2.0-0.5)) )
an.5 = sqrt(2)*gamma(N/2.0)/ ( sqrt(N-1)*(gamma(N/2.0-0.5)) )
Line 131: Line 133:
# Display the results
# Display the results
c(LCL, UCL)
c(LCL, UCL)
c(sum(groups.x<LCL), sum(groups.x>UCL)) # are there any subgroup outliers? [Yes]


# Plot the results
# Are there any subgroup outliers? [Yes]
par(mar=c(2, 4.2, 2, 0.2))  
c(sum(groups.x<LCL), sum(groups.x>UCL))  
 
# Plot the results:
plot(groups.x, ylim=c(LCL-2, UCL+2),  
plot(groups.x, ylim=c(LCL-2, UCL+2),  
     ylab="Subgroup averages using n=5",  
     ylab="Subgroup averages using n=5",  
     xlab="Sequence order",
     xlab="Sequence order",
     cex.lab=1.5,
     main=paste0("Preliminary monitoring chart ",
    cex.main=1.8,  
                "(limits not finalized yet)")
    cex.sub=1.8,
    cex.axis=1.8)
abline(h=LCL, col="red")
abline(h=LCL, col="red")
abline(h=UCL, col="red")
abline(h=UCL, col="red")


# Now exclude the unusual column of data, column 14
# Now exclude the unusual column of data, column 14
reshaped <- reshaped[,-14]
reshaped <- reshaped[, -14]
groups.S <- apply(reshaped, 2, sd)
groups.S <- apply(reshaped, 2, sd)
groups.x <- round(apply(reshaped, 2, mean))
groups.x <- round(apply(reshaped, 2, mean))
Line 154: Line 155:
UCL <- xdb + 3*s.bar/(an.5*sqrt(N))
UCL <- xdb + 3*s.bar/(an.5*sqrt(N))
c(LCL, UCL)
c(LCL, UCL)
c(sum(groups.x<LCL), sum(groups.x>UCL))  # are there any subgroup outliers? [No]


</syntaxhighlight>
# Are there any subgroup outliers? [No]
c(sum(groups.x<LCL), sum(groups.x>UCL)) 
    </code>
</div></html>

Revision as of 20:54, 14 January 2019

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

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

  1. An introduction and a demonstration of monitoring charts [07:59]
  2. Calculating the lower and upper control limits in phase 1 [09:46]
  3. The meaning of type 1 and type 2 errors [07:28]
  4. Shortcomings of single variable monitoring and why multivariate monitoring is required
  5. The CUmulative SUM (CUSUM) monitoring chart
  6. The Exponentially Weighted Moving Average (EWMA) monitoring chart
  7. Introduction to the Process Capability number [11:00]
  8. 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

See the webpage from 2014

Videos from 2013

See the webpage 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.xUCL)) # 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.xUCL))