Quality control
Continuous process variable
Binomial process variable
Poisson process variable
Control charts are used to routinely monitor quality.
Two major types:
The control chart shows
The control limits are chosen so that almost all of the data points will fall within these limits as long as the process remains in-control.
library(qcc)
data(pistonrings)
head(pistonrings,3)
## diameter sample trial
## 1 74.030 1 TRUE
## 2 74.002 1 TRUE
## 3 74.019 1 TRUE
Piston rings for an automotive engine are produced by a forging process. The inside diameter of the rings manufactured by the process is measured on 25 samples(sample=1,2,..,25
), each of size 5, for the control phase I (trial=TRUE
), when preliminary samples from a process being considered ‘in-control’ are used to construct control charts. Then, further 15 samples, again each of size 5, are obtained for phase II (trial=FALSE
).
Reference:
Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 206-213
We shall treat different methods for determining LCL,CL and UCL. In that respect, it is crucial that we have
Assume that measurements
In this case we dont need phase I data.
The only parameter to determine is \(k\).
We dont want to give a lot of false warnings, and a popular choise is
This means that the span of allowable variation is \(6\sigma_0\).
The concept ``Six Sigma’’ has become a mantra in many industrial communities.
Let \(\mathtt{pOut}\) denote the probability that a measurement is outside the control limits. On average this means that we need \(1/\mathtt{pOut}\) observations before we get an outlier.
This is known as the the Average Run Length: \[AVL=\frac{1}{\mathtt{pOut}}\] An in-control process with the 3*sigma rule has AVL
round(1/(2*pdist("norm", -3, plot = FALSE)))
## [1] 370
An in-control process with AVL=500 has k*sigma rule, where k equals
-qdist("norm", (1/2)*(1/500), plot = FALSE)
## [1] 3.090232
Depending on the type of control variable, there are various types of control charts.
chart | distribution | statistic | example |
---|---|---|---|
xbar |
normal |
mean |
means of a continuous process variable |
S |
normal |
standard deviation |
standard deviations of a |
R |
normal |
range |
ranges of a continuous |
p |
binomial |
proportion |
percentage of faulty items |
c |
poisson |
count |
number of faulty items |
Phase I data:
When the sample is normal, it can be shown that \(\bar{s}\) is a biased estimate of the true standard deviation \(\sigma\):
qcc
package.Unbiased estimate of \(\sigma\): \[\hat{\sigma}_1=\frac{\bar{s}}{c_4(n)}\] Furthermore \(\bar{s}\) has estimated standard error \[se(\bar{s})=\bar{s}\frac{\sqrt{1-c_4(n)^2}}{c_4(n)}\]
\[ \begin{aligned} \text{UCL:}\quad &\bar{x}+3\frac{\hat{\sigma}_1}{\sqrt{n}}\\ \text{CL:}\quad &\bar{x}\\ \text{LCL:}\quad &\bar{x}-3\frac{\hat{\sigma}_1}{\sqrt{n}} \end{aligned} \] This corresponds to
If we want to change this probability, we need another z-score. E.g if we want to lower this probability to 0.1%, then \(3\) should be substituted by \(3.29\).
phaseI <- matrix(pistonrings$diameter[1:125] , nrow=25, byrow=TRUE)
phaseII <- matrix(pistonrings$diameter[126:200], nrow=25, byrow=TRUE)
h <- qcc(phaseI, type = "xbar", std.dev = "UWAVE-SD",
newdata = phaseII, title = "xbar chart: pistonrings")
phaseI
is a matrix with \(m=25\) rows, where each row is a sample of size \(n=5\).phaseII
has 15 samples.The function qcc
calculates the necessary statistics and optionally makes a plot.
phaseI
and type=
are the only arguments required.UWAVE-SD
. This is not the default.newdata=phaseII
.Besides limits we are also told whether the process is above/below CL for 7 or more consecutive samples (yellow dots).
run.length=7
is default, but may be changed. If we e.g. want this to happen with probability 0.2%, then we specify run.length=10
.
In most situations, it is crucial to monitor the process mean.
But it may also be a problem if the variability in “quality” gets too high.
In that respect, it is relevant to monitor the standard deviation, which is done by the S-chart:
\[ \begin{aligned} \text{UCL:}\quad&\bar{s}+3se(\bar{s})\\ \text{CL:}\quad &\bar{s}\\ \text{LCL:}\quad &\bar{s}-3se(\bar{s})\\ &se(\bar{s})=\bar{s}\frac{\sqrt{1-c_4(n)^2}}{c_4(n)} \end{aligned} \]
Where \(3\) may be substituted by some other z-score depending on the required confidence level.
h <- qcc(phaseI,type="S", newdata=phaseII, title="S chart: pistonrings")
Remark that the plot does not allow values below zero.
Quite sensible when we are talking about standard deviations.
If the sample size is relatively small (\(n\leq 10\)), it is custom to use the range \(R\) instead of the standard deviation. The range of a sample is simply the difference between the largest and smallest observation.
When the sample is normal, it can be shown that:
qcc
package.Unbiased estimate of \(\sigma\): \[\hat{\sigma}_2=\frac{\bar{R}}{d_2(n)}\] Furthermore \(\bar{R}\) has estimated standard error \[se(\bar{R})=\bar{R}\frac{d_3(n)}{d_2(n)}\] \(d_3(n)\) is tabulated in textbooks and available in the qcc
package.
xbar chart based on \(\bar{R}\): \[
\begin{aligned}
\text{UCL:}\quad&\bar{x}+3\frac{\hat{\sigma}_2}{\sqrt{n}}\\
\text{CL:}\quad &\bar{x}\\
\text{LCL:}\quad &\bar{x}-3\frac{\hat{\sigma}_2}{\sqrt{n}}
\end{aligned}
\] This is actually the default in the qcc
package.
R chart to monitor variability: \[ \begin{aligned} \text{UCL:}\quad & \bar{R}+3se(\bar{R})\\ \text{CL:}\quad & \bar{R}\\ \text{LCL:}\quad & \bar{R}-3se(\bar{R})\\ \end{aligned} \]
h <- qcc(phaseI, type="R", newdata=phaseII, title="R chart: pistonrings")
Let us suppose that the production process operates in a stable manner such that
In a random sample of n items, the number D of defective items follows a binomial distribution with parameters \(n\) and \(p\).
Unbiased estimate of \(p\): \[\hat{p}=\frac{D}{n}\] which has standard error \[se(\hat{p})=\sqrt{\frac{p(1-p)}{n}}\]
Data from phase I:
p chart: \[ \begin{aligned} \text{UCL:}\quad & \bar{p}+3\sqrt{\frac{\bar{p}(1-\bar{p})}{n}}\\ \text{CL:}\quad & \bar{p}\\ \text{LCL:}\quad & \bar{p}-3\sqrt{\frac{\bar{p}(1-\bar{p})}{n}}\\ \end{aligned} \]
data(orangejuice)
head(orangejuice, 3)
## sample D size trial
## 1 1 12 50 TRUE
## 2 2 15 50 TRUE
## 3 3 8 50 TRUE
Production of orange juice cans.
D
were observed.with(orangejuice,
qcc(D[trial], sizes=size[trial], type="p",
newdata=D[!trial], newsizes=size[!trial]))
The machine adjustment after sample 30 has had an obvious effect.
The chart should be recalibrated.
Let us suppose that the production process operates in a stable manner such that
The number D of defective items over a time interval of some fixed length follows a poisson distribution with mean value \(c\).
Unbiased estimate of \(c\): \[\hat{c}=D\] which has standard error \[se(\hat{c})=\sqrt{c}\]
Data from phase I:
c chart: \[ \begin{aligned} \text{UCL:}\quad & \bar{c}+3\sqrt{\bar{c}}\\ \text{CL:}\quad & \bar{c}\\ \text{LCL:}\quad & \bar{c}-3\sqrt{\bar{c}}\\ \end{aligned} \]