| Title: | Quality Control Charts |
|---|---|
| Description: | Shewhart quality control charts for continuous, attribute and count data. Cusum and EWMA charts. Operating characteristic curves. Process capability analysis. Pareto chart and cause-and-effect chart. Multivariate control charts. |
| Authors: | Luca Scrucca [aut, cre, cph] (ORCID: <https://orcid.org/0000-0003-3826-0484>), Greg Snow [ctb], Peter Bloomfield [ctb] |
| Maintainer: | Luca Scrucca <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 3.0 |
| Built: | 2026-07-24 22:17:22 UTC |
| Source: | https://github.com/luca-scr/qcc |
Water content in 34 successive batches of antifreeze.
antifreezeantifreeze
A data frame with 34 rows and 1 column:
water content, in ppm
Wetherill, G.B. and Brown, D.W. (1991) Statistical Process Control. New York: Chapman & Hall, p. 120
Other datasets in qcc package:
RyanMultivar,
boiler,
circuit,
dyedcloth,
orangejuice,
pcmanufact,
pistonrings,
viscosity
Creates a palette of blue colors.
blues.colors(n)blues.colors(n)
n |
the number of colors. |
A character vector containing the requested colors.
Temperature readings from the eight configured burners on a boiler.
boilerboiler
A data frame with 25 observations on the following 8 variables:
temperature reading 1
temperature reading 2
temperature reading 3
temperature reading 4
temperature reading 5
temperature reading 6
temperature reading 7
temperature reading 8
Mason, R.L. and Young, J.C. (2002) Multivariate Statistical Process Control with Industrial Applications, SIAM, p. 86.
Other datasets in qcc package:
RyanMultivar,
antifreeze,
circuit,
dyedcloth,
orangejuice,
pcmanufact,
pistonrings,
viscosity
Draw a basic cause and effect diagram.
causeEffectDiagram( cause, effect, title = "Cause-and-Effect diagram", cex = c(0.9, 1, 1.2), font = c(3, 1, 2), ... )causeEffectDiagram( cause, effect, title = "Cause-and-Effect diagram", cex = c(0.9, 1, 1.2), font = c(3, 1, 2), ... )
cause |
a list of causes and branches providing descriptive labels (see the example below). |
effect |
a string label or the effect. |
title |
a character string specifying the main title. Set |
cex |
a vector of values for the graphical character expansion. The values refer, in order, to branches, causes and effect. |
font |
a vector of values for the font to use. The values refer, in order, to branches, causes and effect. |
... |
catches further ignored arguments. |
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
causeEffectDiagram(cause = list(Measurements = c("Micrometers", "Microscopes", "Inspectors"), Materials = c("Alloys", "Lubricants", "Suppliers"), Personnel = c("Shifts", "Supervisors", "Training", "Operators"), Environment = c("Condensation", "Moisture"), Methods = c("Brake", "Engager", "Angle"), Machines = c("Speed", "Lathes", "Bits", "Sockets")), effect = "Surface Flaws")causeEffectDiagram(cause = list(Measurements = c("Micrometers", "Microscopes", "Inspectors"), Materials = c("Alloys", "Lubricants", "Suppliers"), Personnel = c("Shifts", "Supervisors", "Training", "Operators"), Environment = c("Condensation", "Moisture"), Methods = c("Brake", "Engager", "Angle"), Machines = c("Speed", "Lathes", "Bits", "Sockets")), effect = "Surface Flaws")
Number of nonconformities observed in 26 successive samples of 100 printed circuit boards. Sample 6 and 20 are outside the control limits. Sample 6 was examined by a new inspector and he did not recognize several type of nonconformities that could have been present. Furthermore, the unusually large number of nonconformities in sample 20 resulted from a temperature control problem in the wave soldering machine, which was subsequently repaired. The last 20 samples are further samples collected on inspection units (each formed by 100 boards).
circuitcircuit
A data frame with 46 observations on the following 4 variables:
sample number
number of defectives in 100 printed circuit boards (inspection unit)
sample size
trial sample indicator (TRUE/FALSE)
Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 173–175
Other datasets in qcc package:
RyanMultivar,
antifreeze,
boiler,
dyedcloth,
orangejuice,
pcmanufact,
pistonrings,
viscosity
Create an object of class 'cusum.qcc' to compute a Cusum chart for
statistical quality control.
cusum( data, sizes, center, std.dev, decision.interval = 5, se.shift = 1, head.start = 0, newdata, newsizes, ... ) ## S3 method for class 'cusum.qcc' print(x, digits = getOption("digits"), ...) ## S3 method for class 'cusum.qcc' summary(object, ...) ## S3 method for class 'cusum.qcc' plot( x, xtime = NULL, add.stats = qcc.options("add.stats"), chart.all = qcc.options("chart.all"), fill = qcc.options("fill"), label.bounds = c("LDB", "UDB"), title, xlab, ylab, xlim, ylim, digits = getOption("digits"), ... )cusum( data, sizes, center, std.dev, decision.interval = 5, se.shift = 1, head.start = 0, newdata, newsizes, ... ) ## S3 method for class 'cusum.qcc' print(x, digits = getOption("digits"), ...) ## S3 method for class 'cusum.qcc' summary(object, ...) ## S3 method for class 'cusum.qcc' plot( x, xtime = NULL, add.stats = qcc.options("add.stats"), chart.all = qcc.options("chart.all"), fill = qcc.options("fill"), label.bounds = c("LDB", "UDB"), title, xlab, ylab, xlim, ylim, digits = getOption("digits"), ... )
data |
a data frame, a matrix or a vector containing observed data for the variable to chart. Each row of a data frame or a matrix, and each value of a vector, refers to a sample or ”rationale group”. |
sizes |
a value or a vector of values specifying the sample sizes
associated with each group. If not provided the sample sizes are obtained
counting the non- |
center |
a value specifying the center of group statistics or target. |
std.dev |
a value or an available method specifying the within-group
standard deviation(s) of the process. Several methods are available for
estimating the standard deviation. See |
decision.interval |
A numeric value specifying the number of standard errors of the summary statistics at which the cumulative sum is out of control. |
se.shift |
The amount of shift to detect in the process, measured in standard errors of the summary statistics. |
head.start |
The initializing value for the above-target and
below-target cumulative sums, measured in standard errors of the summary
statistics. Use zero for the traditional Cusum chart, or a positive value
less than the |
newdata |
a data frame, matrix or vector, as for the |
newsizes |
a vector as for the |
... |
additional arguments to be passed to the generic function. |
x |
an object of class |
digits |
the number of significant digits to use. |
object |
an object of class |
xtime |
a vector of date-time values as returned by
|
add.stats |
a logical value indicating whether statistics and other information should be printed at the bottom of the chart. |
chart.all |
a logical value indicating whether both statistics for
|
fill |
a logical value specifying if the in-control area should be
filled with the color specified in |
label.bounds |
a character vector specifying the labels for the the decision interval boundaries. |
title |
a character string specifying the main title. Set |
xlab |
a string giving the label for the x-axis. |
ylab |
a string giving the label for the y-axis. |
xlim |
a numeric vector specifying the limits for the x-axis. |
ylim |
a numeric vector specifying the limits for the y-axis. |
Cusum charts display how the group summary statistics deviate above or below the process center or target value, relative to the standard errors of the summary statistics. Useful to detect small and permanent variation on the mean of the process.
Returns an object of class 'cusum.qcc'.
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
Scrucca, L. (2004). qcc: an R package for quality control charting and statistical process control. R News, 4(1), 11–17.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
Other control charts:
ewma(),
qcc()
## Grouped-data diameter <- qccGroups(data = pistonrings, diameter, sample) q <- cusum(diameter[1:25,], decision.interval = 4, se.shift = 1) summary(q) plot(q) q <- cusum(diameter[1:25,], newdata=diameter[26:40,]) summary(q) plot(q, chart.all=FALSE) ## Individual observations q <- with(viscosity, cusum(viscosity[trial], newdata = viscosity[!trial])) summary(q) plot(q)## Grouped-data diameter <- qccGroups(data = pistonrings, diameter, sample) q <- cusum(diameter[1:25,], decision.interval = 4, se.shift = 1) summary(q) plot(q) q <- cusum(diameter[1:25,], newdata=diameter[26:40,]) summary(q) plot(q, chart.all=FALSE) ## Individual observations q <- with(viscosity, cusum(viscosity[trial], newdata = viscosity[!trial])) summary(q) plot(q)
Compute and print descriptive statistics for a matrix or data frame, eventually conditioning on another variable.
describe(data, by, detailed = FALSE, ...) ## S3 method for class 'describe' print(x, digits = getOption("digits") - 3, ...)describe(data, by, detailed = FALSE, ...) ## S3 method for class 'describe' print(x, digits = getOption("digits") - 3, ...)
data |
a matrix or data frame. |
by |
a factor or character vector specifying the conditioning variable.
This may be a variable included in |
detailed |
a logical specifying if detailed statistics should be provided. |
... |
additional arguments to be passed to the generic function. |
x |
an object of class |
digits |
the number of significant digits to use. |
This function provides simple descriptive statistics for different types of variables, such as numeric, factor, and logical, conditioning or not on another variable.
Luca Scrucca
data(warpbreaks) describe(warpbreaks) describe(warpbreaks, detail = TRUE) describe(warpbreaks, by = wool)data(warpbreaks) describe(warpbreaks) describe(warpbreaks, detail = TRUE) describe(warpbreaks, by = wool)
In a textile finishing plant, dyed cloth is inspected for the occurrence of defects per 50 square meters. The data on ten rolls of cloth are presented.
dyedclothdyedcloth
A data frame with 10 observations on the following 2 variables:
number of nonconformities per 50 square meters (inspection units)
number of inspection units in roll (variable sample size)
Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 183–184
Other datasets in qcc package:
RyanMultivar,
antifreeze,
boiler,
circuit,
orangejuice,
pcmanufact,
pistonrings,
viscosity
Plot an ellipse chart for a bivariate quality control data.
ellipseChart( object, chart.all = TRUE, show.id = FALSE, ngrid = 50, confidence.level, correct.multiple = TRUE, title, xlim, ylim, xlab, ylab, restore.par = TRUE, ... )ellipseChart( object, chart.all = TRUE, show.id = FALSE, ngrid = 50, confidence.level, correct.multiple = TRUE, title, xlim, ylim, xlab, ylab, restore.par = TRUE, ... )
object |
an object of class |
chart.all |
a logical value indicating whether both statistics for
|
show.id |
a logical value indicating whether to plot point labels
( |
ngrid |
a value for the size of the grid over which the ellipse is evaluated. |
confidence.level |
a numeric value between 0 and 1 specifying the confidence level of the computed probability limits. |
correct.multiple |
a logical value indicating whether to correct or not for multiple comparisons. |
title |
a character string specifying the main title. Set |
xlim |
a numeric vector specifying the limits for the x-axis. |
ylim |
a numeric vector specifying the limits for the y-axis. |
xlab |
a string giving the label for the x-axis. |
ylab |
a string giving the label for the y-axis. |
restore.par |
a logical value indicating whether the previous
|
... |
additional arguments to be passed to the generic
|
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
mqcc(), stats.T2(), stats.T2.single()
# See examples in help(mqcc)# See examples in help(mqcc)
Create an object of class 'ewma.qcc' to compute and draw an
Exponential Weighted Moving Average (EWMA) chart for statistical quality
control.
ewma( data, sizes, center, std.dev, lambda = 0.2, nsigmas = 3, newdata, newsizes, ... ) ## S3 method for class 'ewma.qcc' print(x, digits = getOption("digits"), ...) ## S3 method for class 'ewma.qcc' summary(object, ...) ## S3 method for class 'ewma.qcc' plot( x, xtime = NULL, add.stats = qcc.options("add.stats"), chart.all = qcc.options("chart.all"), fill = qcc.options("fill"), label.center = "CL", label.limits = c("LCL", "UCL"), title, xlab, ylab, xlim, ylim, digits = getOption("digits"), ... )ewma( data, sizes, center, std.dev, lambda = 0.2, nsigmas = 3, newdata, newsizes, ... ) ## S3 method for class 'ewma.qcc' print(x, digits = getOption("digits"), ...) ## S3 method for class 'ewma.qcc' summary(object, ...) ## S3 method for class 'ewma.qcc' plot( x, xtime = NULL, add.stats = qcc.options("add.stats"), chart.all = qcc.options("chart.all"), fill = qcc.options("fill"), label.center = "CL", label.limits = c("LCL", "UCL"), title, xlab, ylab, xlim, ylim, digits = getOption("digits"), ... )
data |
a data frame, a matrix or a vector containing observed data for the variable to chart. Each row of a data frame or a matrix, and each value of a vector, refers to a sample or ”rationale group”. |
sizes |
a value or a vector of values specifying the sample sizes
associated with each group. If not provided the sample sizes are obtained
counting the non- |
center |
a value specifying the center of group statistics or target. |
std.dev |
a value or an available method specifying the within-group
standard deviation(s) of the process. Several methods are available for
estimating the standard deviation. See |
lambda |
the smoothing parameter |
nsigmas |
a numeric value specifying the number of sigmas to use for computing control limits. |
newdata |
a data frame, matrix or vector, as for the |
newsizes |
a vector as for the |
... |
additional arguments to be passed to the generic function. |
x |
an object of class |
digits |
the number of significant digits to use. |
object |
an object of class |
xtime |
a vector of date-time values as returned by
|
add.stats |
a logical value indicating whether statistics and other information should be printed at the bottom of the chart. |
chart.all |
a logical value indicating whether both statistics for
|
fill |
a logical value specifying if the in-control area should be
filled with the color specified in |
label.center |
a character specifying the label for center line. |
label.limits |
a character vector specifying the labels for control limits. |
title |
a character string specifying the main title. Set |
xlab |
a string giving the label for the x-axis. |
ylab |
a string giving the label for the y-axis. |
xlim |
a numeric vector specifying the limits for the x-axis. |
ylim |
a numeric vector specifying the limits for the y-axis. |
EWMA chart smooths a series of data based on a moving average with weights which decay exponentially. Useful to detect small and permanent variation on the mean of the process.
Returns an object of class 'ewma.qcc'.
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
Scrucca, L. (2004). qcc: an R package for quality control charting and statistical process control. R News, 4(1), 11–17.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
Other control charts:
cusum(),
qcc()
## Grouped-data diameter <- qccGroups(data = pistonrings, diameter, sample) q <- ewma(diameter[1:25,], lambda=0.2, nsigmas=3) summary(q) plot(q) ewma(diameter[1:25,], lambda=0.2, nsigmas=2.7, newdata=diameter[26:40,]) ## Individual observations q <- with(viscosity, ewma(viscosity[trial], lambda = 0.2, nsigmas = 2.7, newdata = viscosity[!trial])) summary(q) plot(q)## Grouped-data diameter <- qccGroups(data = pistonrings, diameter, sample) q <- ewma(diameter[1:25,], lambda=0.2, nsigmas=3) summary(q) plot(q) ewma(diameter[1:25,], lambda=0.2, nsigmas=2.7, newdata=diameter[26:40,]) ## Individual observations q <- with(viscosity, ewma(viscosity[trial], lambda = 0.2, nsigmas = 2.7, newdata = viscosity[!trial])) summary(q) plot(q)
Compute Exponential Weighted Moving Average.
ewmaSmooth(x, y, lambda = 0.2, start, ...)ewmaSmooth(x, y, lambda = 0.2, start, ...)
x |
a vector of x-values. |
y |
a vector of y-values. |
lambda |
the smoothing parameter. |
start |
the starting value. |
... |
additional arguments (currently not used). |
EWMA function smooths a series of data based on a moving average with weights which decay exponentially.
For each value the smoothed value is computed as
where controls the weights
applied.
Returns a list with elements:
x: ordered x-values.
y: smoothed y-values.
lambda: the smoothing parameter.
start: the starting value.
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
x = 1:50 y = rnorm(50, sin(x/5), 0.5) plot(x,y) lines(ewmaSmooth(x,y,lambda=0.1), col="red")x = 1:50 y = rnorm(50, sin(x/5), 0.5) plot(x,y) lines(ewmaSmooth(x,y,lambda=0.1), col="red")
Create an object of class 'mqcc' to perform multivariate statistical
quality control.
mqcc( data, type = c("T2", "T2.single"), center, cov, limits = TRUE, pred.limits = FALSE, data.name, labels, newdata, newlabels, confidence.level = (1 - 0.0027)^p, plot = TRUE, ... ) ## S3 method for class 'mqcc' print(x, digits = getOption("digits"), ...) ## S3 method for class 'mqcc' summary(object, ...) ## S3 method for class 'mqcc' plot( x, add.stats = qcc.options("add.stats"), chart.all = qcc.options("chart.all"), fill = qcc.options("fill"), label.limits = c("LCL", "UCL"), label.pred.limits = c("LPL", "UPL"), title, xlab, ylab, ylim, axes.las = 0, digits = getOption("digits"), restore.par = TRUE, ... )mqcc( data, type = c("T2", "T2.single"), center, cov, limits = TRUE, pred.limits = FALSE, data.name, labels, newdata, newlabels, confidence.level = (1 - 0.0027)^p, plot = TRUE, ... ) ## S3 method for class 'mqcc' print(x, digits = getOption("digits"), ...) ## S3 method for class 'mqcc' summary(object, ...) ## S3 method for class 'mqcc' plot( x, add.stats = qcc.options("add.stats"), chart.all = qcc.options("chart.all"), fill = qcc.options("fill"), label.limits = c("LCL", "UCL"), label.pred.limits = c("LPL", "UPL"), title, xlab, ylab, ylim, axes.las = 0, digits = getOption("digits"), restore.par = TRUE, ... )
data |
For subgrouped data, a list with a data frame or a matrix for each variable to monitor. Each row of the data frame or matrix refers to a sample or ”rationale” group. For individual observations, where each sample has a single observation, users can provide a list with a data frame or a matrix having a single column, or a data frame or a matrix where each rows refer to samples and columns to variables. See examples. |
type |
a character string specifying the type of chart:
|
center |
a vector of values to use for center of input variables. |
cov |
a matrix of values to use for the covariance matrix of input variables. |
limits |
a logical indicating if control limits (Phase I) must be
computed (by default using |
pred.limits |
a logical indicating if prediction limits (Phase II) must
be computed (by default using |
data.name |
a string specifying the name of the variable which appears on the plots. If not provided is taken from the object given as data. |
labels |
a character vector of labels for each group. |
newdata |
a data frame, matrix or vector, as for the |
newlabels |
a character vector of labels for each new group defined in
the argument |
confidence.level |
a numeric value between 0 and 1 specifying the
confidence level of the computed probability limits. By default is set at
|
plot |
logical. If |
... |
additional arguments to be passed to the generic function. |
x |
an object of class |
digits |
the number of significant digits to use when |
object |
an object of class |
add.stats |
a logical value indicating whether statistics and other information should be printed at the bottom of the chart. |
chart.all |
a logical value indicating whether both statistics for
|
fill |
a logical value specifying if the in-control area should be
filled with the color specified in |
label.limits |
a character vector specifying the labels for control limits (Phase I). |
label.pred.limits |
a character vector specifying the labels for prediction control limits (Phase II). |
title |
a character string specifying the main title. Set |
xlab |
a string giving the label for the x-axis. |
ylab |
a string giving the label for the y-axis. |
ylim |
a numeric vector specifying the limits for the y-axis. |
axes.las |
numeric in {0,1,2,3} specifying the style of axis labels. |
restore.par |
a logical value indicating whether the previous
|
Returns an object of class 'mqcc'.
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
Scrucca, L. (2004). qcc: an R package for quality control charting and statistical process control. R News, 4(1), 11–17.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
stats.T2(), stats.T2.single(), limits.T2(), limits.T2.single(), ellipseChart(), qcc()
## Subgrouped data q = mqcc(RyanMultivar, type = "T2") summary(q) ellipseChart(q) ellipseChart(q, show.id = TRUE) q = mqcc(RyanMultivar, type = "T2", pred.limits = TRUE) # Xbar-charts for single variables computed adjusting the # confidence level of the T^2 chart: q1 = with(RyanMultivar, qcc(X1, type = "xbar", confidence.level = q$confidence.level^(1/2))) summary(q1) q2 = with(RyanMultivar, qcc(X2, type = "xbar", confidence.level = q$confidence.level^(1/2))) summary(q2) require(MASS) # generate new "in control" data Xnew = list(X1 = matrix(NA, 10, 4), X2 = matrix(NA, 10, 4)) for(i in 1:4) { x = mvrnorm(10, mu = q$center, Sigma = q$cov) Xnew$X1[,i] = x[,1] Xnew$X2[,i] = x[,2] } qq = mqcc(RyanMultivar, type = "T2", newdata = Xnew, pred.limits = TRUE) summary(qq) # generate new "out of control" data Xnew = list(X1 = matrix(NA, 10, 4), X2 = matrix(NA, 10, 4)) for(i in 1:4) { x = mvrnorm(10, mu = 1.2*q$center, Sigma = q$cov) Xnew$X1[,i] = x[,1] Xnew$X2[,i] = x[,2] } qq = mqcc(RyanMultivar, type = "T2", newdata = Xnew, pred.limits = TRUE) summary(qq) ## Individual observations data q = mqcc(boiler, type = "T2.single", confidence.level = 0.999) summary(q) # generate new "in control" data boilerNew = mvrnorm(10, mu = q$center, Sigma = q$cov) qq = mqcc(boiler, type = "T2.single", confidence.level = 0.999, newdata = boilerNew, pred.limits = TRUE) summary(qq) # generate new "out of control" data boilerNew = mvrnorm(10, mu = 1.01*q$center, Sigma = q$cov) qq = mqcc(boiler, type = "T2.single", confidence.level = 0.999, newdata = boilerNew, pred.limits = TRUE) summary(qq) # provides "robust" estimates of means and covariance matrix rob = cov.rob(boiler) qrob = mqcc(boiler, type = "T2.single", center = rob$center, cov = rob$cov) summary(qrob)## Subgrouped data q = mqcc(RyanMultivar, type = "T2") summary(q) ellipseChart(q) ellipseChart(q, show.id = TRUE) q = mqcc(RyanMultivar, type = "T2", pred.limits = TRUE) # Xbar-charts for single variables computed adjusting the # confidence level of the T^2 chart: q1 = with(RyanMultivar, qcc(X1, type = "xbar", confidence.level = q$confidence.level^(1/2))) summary(q1) q2 = with(RyanMultivar, qcc(X2, type = "xbar", confidence.level = q$confidence.level^(1/2))) summary(q2) require(MASS) # generate new "in control" data Xnew = list(X1 = matrix(NA, 10, 4), X2 = matrix(NA, 10, 4)) for(i in 1:4) { x = mvrnorm(10, mu = q$center, Sigma = q$cov) Xnew$X1[,i] = x[,1] Xnew$X2[,i] = x[,2] } qq = mqcc(RyanMultivar, type = "T2", newdata = Xnew, pred.limits = TRUE) summary(qq) # generate new "out of control" data Xnew = list(X1 = matrix(NA, 10, 4), X2 = matrix(NA, 10, 4)) for(i in 1:4) { x = mvrnorm(10, mu = 1.2*q$center, Sigma = q$cov) Xnew$X1[,i] = x[,1] Xnew$X2[,i] = x[,2] } qq = mqcc(RyanMultivar, type = "T2", newdata = Xnew, pred.limits = TRUE) summary(qq) ## Individual observations data q = mqcc(boiler, type = "T2.single", confidence.level = 0.999) summary(q) # generate new "in control" data boilerNew = mvrnorm(10, mu = q$center, Sigma = q$cov) qq = mqcc(boiler, type = "T2.single", confidence.level = 0.999, newdata = boilerNew, pred.limits = TRUE) summary(qq) # generate new "out of control" data boilerNew = mvrnorm(10, mu = 1.01*q$center, Sigma = q$cov) qq = mqcc(boiler, type = "T2.single", confidence.level = 0.999, newdata = boilerNew, pred.limits = TRUE) summary(qq) # provides "robust" estimates of means and covariance matrix rob = cov.rob(boiler) qrob = mqcc(boiler, type = "T2.single", center = rob$center, cov = rob$cov) summary(qrob)
Computes the optimal number of classes/bins for an histogram as the maximum
between the Sturges and Freedman-Diaconis (FD) estimators. For small
datasets the Sturges value will usually be chosen, while larger datasets
will usually default to FD. Avoids the overly conservative behaviour of FD
and Sturges for small and large datasets, respectively. This is the default
option in numpy.histogram_bin_edges available in Python.
nclass.hist(x, ...)nclass.hist(x, ...)
x |
a vector of data values. |
... |
additional arguments to be passed to low level functions. |
The value of suggested number of classes/bins.
Luca Scrucca
grDevices::nclass.FD(), grDevices::nclass.Sturges()
set.seed(1) x <- stats::rnorm(111) nclass.hist(x) x <- stats::rnorm(1111) nclass.hist(x)set.seed(1) x <- stats::rnorm(111) nclass.hist(x) x <- stats::rnorm(1111) nclass.hist(x)
Draws the operating characteristic curves for a 'qcc' object.
ocCurves(object, ...) ocCurves.xbar( object, size = c(1, 5, 10, 15, 20), shift = seq(0, 5, by = 0.1), nsigmas = object$nsigmas, ... ) ocCurves.R( object, size = c(2, 5, 10, 15, 20), multiplier = seq(1, 6, by = 0.1), nsigmas = object$nsigmas, ... ) ocCurves.S( object, size = c(2, 5, 10, 15, 20), multiplier = seq(1, 6, by = 0.1), nsigmas = object$nsigmas, ... ) ocCurves.p(object, ...) ocCurves.c(object, ...) ## S3 method for class 'ocCurves' print(x, digits = getOption("digits"), ...) ## S3 method for class 'ocCurves' plot(x, what = c("beta", "ARL"), title, xlab, ylab, lty, lwd, col, ...)ocCurves(object, ...) ocCurves.xbar( object, size = c(1, 5, 10, 15, 20), shift = seq(0, 5, by = 0.1), nsigmas = object$nsigmas, ... ) ocCurves.R( object, size = c(2, 5, 10, 15, 20), multiplier = seq(1, 6, by = 0.1), nsigmas = object$nsigmas, ... ) ocCurves.S( object, size = c(2, 5, 10, 15, 20), multiplier = seq(1, 6, by = 0.1), nsigmas = object$nsigmas, ... ) ocCurves.p(object, ...) ocCurves.c(object, ...) ## S3 method for class 'ocCurves' print(x, digits = getOption("digits"), ...) ## S3 method for class 'ocCurves' plot(x, what = c("beta", "ARL"), title, xlab, ylab, lty, lwd, col, ...)
object |
an object of class |
... |
catches further ignored arguments. |
size |
a vector of values specifying the sample sizes for which to draw the OC curves. |
shift, multiplier
|
a vector of values specifying the shift or multiplier values (in units of sigma). |
nsigmas |
a numeric value specifying the number of sigmas to use for
computing control limits; if |
x |
an object of class |
digits |
the number of significant digits to use. |
what |
a string specifying the quantity to plot on the y-axis. Possible
values are |
title |
a character string specifying the main title. Set |
xlab, ylab
|
a string giving the label for the x-axis and the y-axis. |
lty, lwd, col
|
values or vector of values controlling the line type, line width and colour of curves. |
An operating characteristic curve graphically provides information about the
probability of not detecting a shift in the process. ocCurves is a
generic function which calls the proper function depending on the type of
'qcc' object. Further arguments provided through ... are
passed to the specific function depending on the type of chart.
The probabilities are based on the conventional assumptions about process
distributions: the normal distribution for "xbar", "R", and
"S", the binomial distribution for "p" and "np", and
the Poisson distribution for "c" and "u". They are all
sensitive to departures from those assumptions, but to varying degrees. The
performance of the "S" chart, and especially the "R" chart,
are likely to be seriously affected by longer tails.
The function returns an object of class 'ocCurves' which
contains a matrix or a vector of beta values (the probability of type II
error) and ARL (average run length).
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
Scrucca, L. (2004). qcc: an R package for quality control charting and statistical process control. R News, 4(1), 11–17.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
data(pistonrings) diameter = qccGroups(diameter, sample, data = pistonrings) oc = ocCurves.xbar(qcc(diameter, type="xbar", nsigmas=3)) oc plot(oc) data(orangejuice) oc = with(orangejuice, ocCurves(qcc(D[trial], sizes=size[trial], type="p"))) oc plot(oc) data(circuit) oc = with(circuit, ocCurves(qcc(x[trial], sizes=size[trial], type="c"))) oc plot(oc)data(pistonrings) diameter = qccGroups(diameter, sample, data = pistonrings) oc = ocCurves.xbar(qcc(diameter, type="xbar", nsigmas=3)) oc plot(oc) data(orangejuice) oc = with(orangejuice, ocCurves(qcc(D[trial], sizes=size[trial], type="p"))) oc plot(oc) data(circuit) oc = with(circuit, ocCurves(qcc(x[trial], sizes=size[trial], type="c"))) oc plot(oc)
Frozen orange juice concentrate is packaged in 6-ounce cardboard cans. A machine forms each can by spinning it from cardboard stock and attaching a metal bottom panel. A can is classified as nonconforming if an inspection indicates that it could leak when filled, either along the side seam or around the bottom joint.
orangejuice orangejuice2orangejuice orangejuice2
orangejuice is a data frame with 54 observations and orangejuice2
is a data frame with 64 observations. Both contain the following 4 variables:
sample id
number of defectives
sample sizes
trial samples (TRUE/FALSE)
Thirty samples of 50 cans each were collected at half-hour intervals while
the machine operated continuously over three shifts. A new batch of cardboard
stock was introduced beginning with sample 15, and an inexperienced operator
was temporarily assigned to the machine for sample 23. After these 30
samples, the machine was adjusted and 24 additional samples were collected.
The orangejuice2 dataset contains samples collected after this adjustment.
Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 152–159.
Other datasets in qcc package:
RyanMultivar,
antifreeze,
boiler,
circuit,
dyedcloth,
pcmanufact,
pistonrings,
viscosity
Computes a table of statistics and plot a Pareto chart.
paretoChart(data, ...) ## S3 method for class 'paretoChart' print(x, digits = getOption("digits") - 3, ...) ## S3 method for class 'paretoChart' plot( x, title, xlab, ylab = "Frequency", ylab2 = "Cumulative percentage", ylim, col = blues.colors(nlevels), ... )paretoChart(data, ...) ## S3 method for class 'paretoChart' print(x, digits = getOption("digits") - 3, ...) ## S3 method for class 'paretoChart' plot( x, title, xlab, ylab = "Frequency", ylab2 = "Cumulative percentage", ylim, col = blues.colors(nlevels), ... )
data |
a vector of values. |
... |
catch other optional arguments. |
x |
an object of class |
digits |
the number of significant digits to use. |
title |
a character string specifying the main title. Set |
xlab |
a string specifying the label for the x-axis. |
ylab |
a string specifying the label for the y-axis. |
ylab2 |
a string specifying the label for the second y-axis on the right side. |
ylim |
a numeric vector specifying the limits for the y-axis. |
col |
a value for the color, a vector of colors, or a palette for the
bars. See the help for |
plot |
a logical specifying if the chart should be provided
( |
A Pareto chart is a barplot where the categories are ordered in non increasing order, and a line is also added to show the cumulative sum.
Returns an object of class 'paretoChart' containing the
descriptive statistics used to draw the Pareto chart. This object has
associated a print and plot method.
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
Scrucca, L. (2004). qcc: an R package for quality control charting and statistical process control. R News, 4(1), 11–17.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
defect = c(80, 27, 66, 94, 33) names(defect) = c("price code", "schedule date", "supplier code", "contact num.", "part num.") pc = paretoChart(defect, ylab = "Error frequency") pc plot(pc) plot(paretoChart(defect, ylab = "Error frequency"), col=rainbow(length(defect)))defect = c(80, 27, 66, 94, 33) names(defect) = c("price code", "schedule date", "supplier code", "contact num.", "part num.") pc = paretoChart(defect, ylab = "Error frequency") pc plot(pc) plot(paretoChart(defect, ylab = "Error frequency"), col=rainbow(length(defect)))
A personal computer manufacturer counts the number of nonconformities per unit on the final assembly line. He collects data on 20 samples of 5 computers each.
pcmanufactpcmanufact
A data frame with 10 observations on the following 2 variables:
number of nonconformities (inspection units)
number of computers inspected
Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 181–182
Other datasets in qcc package:
RyanMultivar,
antifreeze,
boiler,
circuit,
dyedcloth,
orangejuice,
pistonrings,
viscosity
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, each of size 5, for the control phase I, 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.
pistonringspistonrings
A data frame with 200 observations on the following 3 variables:
a numeric vector
sample ID
preliminary sample indicator (TRUE/FALSE)
Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 206–213
Other datasets in qcc package:
RyanMultivar,
antifreeze,
boiler,
circuit,
dyedcloth,
orangejuice,
pcmanufact,
viscosity
Computes process capability indices for a 'qcc' object of type
"xbar" and plot the histogram.
processCapability( object, spec.limits, target, std.dev, nsigmas, confidence.level = 0.95, ... ) ## S3 method for class 'processCapability' print(x, digits = getOption("digits"), ...) ## S3 method for class 'processCapability' summary(object, ...) ## S3 method for class 'processCapability' plot( x, add.stats = qcc.options("add.stats"), breaks = nclass.hist, fill = adjustcolor(qcc.options("zones")$fill, alpha.f = 0.5), color = "white", title, xlab, digits = getOption("digits"), ... )processCapability( object, spec.limits, target, std.dev, nsigmas, confidence.level = 0.95, ... ) ## S3 method for class 'processCapability' print(x, digits = getOption("digits"), ...) ## S3 method for class 'processCapability' summary(object, ...) ## S3 method for class 'processCapability' plot( x, add.stats = qcc.options("add.stats"), breaks = nclass.hist, fill = adjustcolor(qcc.options("zones")$fill, alpha.f = 0.5), color = "white", title, xlab, digits = getOption("digits"), ... )
object |
a |
spec.limits |
a two-values vector specifying the lower and upper
specification limits. For one-sided specification limits, the value of the
missing limit must be set to |
target |
a value specifying the target of the process. If missing the
value from the |
std.dev |
a value specifying the within-group standard deviation. If
not provided is taken from the |
nsigmas |
a numeric value specifying the number of sigmas to use. If
not provided is taken from the |
confidence.level |
a numeric value between 0 and 1 specifying the level to use for computing confidence intervals. |
... |
catches further ignored arguments. |
x |
an object of class |
digits |
the number of significant digits to use. |
add.stats |
a logical value indicating whether statistics and capability indices should be added at the bottom of the chart. |
breaks |
a value or a function used to select the number of bins in a
histogram. See the help for |
fill, color
|
values specifying the colour of the filled area and the border used for drawing the histogram. |
title |
a character string specifying the plot title. Set |
xlab |
a character string specifying the label for the x-axis. |
This function calculates confidence limits for using the
method described by Chou et al. (1990). Approximate confidence limits for
, , and are computed
using the method in Bissell (1990). Confidence limits for
are based on the method of Boyles (1991); this method is
approximate and it assumes that the target is midway between the
specification limits.
Invisibly returns a list with components:
nobs: number of observations.
center: center.
std.dev: standard deviation.
target: target.
spec.limits: a vector of values giving the lower specification limit
(LSL) and the upper specification limit (USL).
indices: a matrix of capability indices (,
, , ,
) and the corresponding confidence limits.
exp: a vector of values giving the expected fraction, based on a normal
approximation, of the observations less than LSL and greater than USL.
obs: a vector of values giving the fraction of observations less than
LSL and greater than USL.
Luca Scrucca
Bissell, A. F. (1990). How reliable is your capability index? Applied Statistics, 39, 331–340.
Boyles, R. A. (1991). The Taguchi capability index. Journal of Quality Technology, 23, 107–126.
Chou, Y., Owen, D. B., and Borrego, S. A. (1990). Lower confidence limits on process capability indices. Journal of Quality Technology, 22, 223–229.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
data(pistonrings) diameter = qccGroups(data = pistonrings, diameter, sample) q = qcc(diameter[1:25,], type="xbar", nsigmas=3) pc = processCapability(q, spec.limits=c(73.95,74.05)) pc plot(pc) plot(processCapability(q, spec.limits=c(73.95,74.05), target=74.02)) plot(processCapability(q, spec.limits=c(73.99,74.01))) plot(processCapability(q, spec.limits = c(73.99, 74.1)))data(pistonrings) diameter = qccGroups(data = pistonrings, diameter, sample) q = qcc(diameter[1:25,], type="xbar", nsigmas=3) pc = processCapability(q, spec.limits=c(73.95,74.05)) pc plot(pc) plot(processCapability(q, spec.limits=c(73.95,74.05), target=74.02)) plot(processCapability(q, spec.limits=c(73.99,74.01))) plot(processCapability(q, spec.limits = c(73.99, 74.1)))
Create an object of class 'qcc' to perform statistical quality
control. This object may then be used to plot Shewhart charts, drawing OC
curves, computes capability indices, and more.
qcc( data, type = c("xbar", "R", "S", "xbar.one", "p", "np", "c", "u", "g"), sizes, center, std.dev, limits, newdata, newsizes, nsigmas = 3, confidence.level, rules = c(1, 4), rule.set = c("western-electric", "nelson"), ... ) ## S3 method for class 'qcc' print(x, digits = getOption("digits"), ...) ## S3 method for class 'qcc' summary(object, ...) ## S3 method for class 'qcc' plot( x, xtime = NULL, add.stats = qcc.options("add.stats"), chart.all = qcc.options("chart.all"), fill = qcc.options("fill"), label.center = "CL", label.limits = c("LCL ", "UCL"), title, xlab, ylab, xlim, ylim, digits = getOption("digits"), ... )qcc( data, type = c("xbar", "R", "S", "xbar.one", "p", "np", "c", "u", "g"), sizes, center, std.dev, limits, newdata, newsizes, nsigmas = 3, confidence.level, rules = c(1, 4), rule.set = c("western-electric", "nelson"), ... ) ## S3 method for class 'qcc' print(x, digits = getOption("digits"), ...) ## S3 method for class 'qcc' summary(object, ...) ## S3 method for class 'qcc' plot( x, xtime = NULL, add.stats = qcc.options("add.stats"), chart.all = qcc.options("chart.all"), fill = qcc.options("fill"), label.center = "CL", label.limits = c("LCL ", "UCL"), title, xlab, ylab, xlim, ylim, digits = getOption("digits"), ... )
data |
a data frame, a matrix or a vector containing observed data for the variable to chart. Each row of a data frame or a matrix, and each value of a vector, refers to a sample or ”rationale group”. |
||||||||||||||||||||||||||||||
type |
a character string specifying the group statistics to compute. Available methods are:
Furthermore, a user specified type of chart, say |
||||||||||||||||||||||||||||||
sizes |
a value or a vector of values specifying the sample sizes
associated with each group. For continuous data provided as data frame or
matrix the sample sizes are obtained counting the non- |
||||||||||||||||||||||||||||||
center |
a value specifying the center of group statistics or target. |
||||||||||||||||||||||||||||||
std.dev |
a value or an available method specifying the within-group
standard deviation(s) of the process. Several methods are available for
estimating the standard deviation in case of a continuous process variable;
see |
||||||||||||||||||||||||||||||
limits |
a two-values vector specifying control limits. |
||||||||||||||||||||||||||||||
newdata |
a data frame, matrix or vector, as for the |
||||||||||||||||||||||||||||||
newsizes |
a vector as for the |
||||||||||||||||||||||||||||||
nsigmas |
a numeric value specifying the number of sigmas to use for
computing control limits. It is ignored when the |
||||||||||||||||||||||||||||||
confidence.level |
a numeric value between 0 and 1 specifying the confidence level of the computed probability limits. |
||||||||||||||||||||||||||||||
rules |
a value or a vector of values specifying the rules to apply to
the chart. See |
||||||||||||||||||||||||||||||
rule.set |
a character string specifying how numeric |
||||||||||||||||||||||||||||||
... |
additional arguments to be passed to the generic function. |
||||||||||||||||||||||||||||||
x |
an object of class |
||||||||||||||||||||||||||||||
digits |
the number of significant digits to use. |
||||||||||||||||||||||||||||||
object |
an object of class |
||||||||||||||||||||||||||||||
xtime |
a vector of date-time values as returned by
|
||||||||||||||||||||||||||||||
add.stats |
a logical value indicating whether statistics and other information should be printed at the bottom of the chart. |
||||||||||||||||||||||||||||||
chart.all |
a logical value indicating whether both statistics for
|
||||||||||||||||||||||||||||||
fill |
a logical value specifying if the in-control area should be
filled with the color specified in |
||||||||||||||||||||||||||||||
label.center |
a character specifying the label for center line. |
||||||||||||||||||||||||||||||
label.limits |
a character vector specifying the labels for control limits. |
||||||||||||||||||||||||||||||
title |
a character string specifying the main title. Set |
||||||||||||||||||||||||||||||
xlab |
a string giving the label for the x-axis. |
||||||||||||||||||||||||||||||
ylab |
a string giving the label for the y-axis. |
||||||||||||||||||||||||||||||
xlim |
a numeric vector specifying the limits for the x-axis. |
||||||||||||||||||||||||||||||
ylim |
a numeric vector specifying the limits for the y-axis. |
Numeric rules values are interpreted within rule.set. By
default, rules = c(1,4) applies Western Electric rules 1 and 4 for
backward compatibility. Nelson rules can be requested with rules = 1:8, rule.set = "nelson".
Returns an object of class 'qcc'.
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
Scrucca, L. (2004). qcc: an R package for quality control charting and statistical process control. R News, 4(1), 11–17.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
qccRules(), ocCurves(), processCapability(), qccGroups()
Other control charts:
cusum(),
ewma()
## Continuous data diameter = qccGroups(data = pistonrings, diameter, sample) (q = qcc(diameter[1:25,], type="xbar")) plot(q) (q = qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,])) plot(q) q = qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,]) plot(q, chart.all=FALSE) plot(qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], nsigmas=2)) plot(qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], confidence.level=0.99)) q <- qcc(diameter[1:25,], type="R") q plot(q) plot(qcc(diameter[1:25,], type="R", newdata=diameter[26:40,])) plot(qcc(diameter[1:25,], type="S")) plot(qcc(diameter[1:25,], type="S", newdata=diameter[26:40,])) plot(qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], rules = 1:4)) # variable control limits out = c(9, 10, 30, 35, 45, 64, 65, 74, 75, 85, 99, 100) diameter = qccGroups(data = pistonrings[-out,], diameter, sample) plot(qcc(diameter[1:25,], type="xbar")) plot(qcc(diameter[1:25,], type="R")) plot(qcc(diameter[1:25,], type="S")) plot(qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,])) plot(qcc(diameter[1:25,], type="R", newdata=diameter[26:40,])) plot(qcc(diameter[1:25,], type="S", newdata=diameter[26:40,])) # to customize a Shewhart chart use q <- qcc(diameter[1:25, ], type = "xbar") graph = plot(q, ylim = c(73.9, 74.1)) # returned object is of class "patchwork", then add geom_* layer to the first element graph[[1]] <- graph[[1]] + geom_hline(yintercept = c(73.95, 74.05), lty = 2) graph ## Attribute data q <- with(orangejuice, qcc(D[trial], sizes=size[trial], type="p")) q plot(q) # remove out-of-control points (see help(orangejuice) for the reasons) outofctrl <- c(15,23) q1 <- with(orangejuice[-outofctrl,], qcc(D[trial], sizes=size[trial], type="p")) plot(q1) q1 <- with(orangejuice[-outofctrl,], qcc(D[trial], sizes=size[trial], type="p", newdata=D[!trial], newsizes=size[!trial])) plot(q1) data(orangejuice2) q2 <- with(orangejuice2, qcc(D[trial], sizes=size[trial], type="p")) plot(q2) q2 <- with(orangejuice2, qcc(D[trial], sizes=size[trial], type="p", newdata=D[!trial], newsizes=size[!trial])) plot(q2) data(circuit) plot(with(circuit, qcc(x[trial], sizes=size[trial], type="c"))) # remove out-of-control points (see help(circuit) for the reasons) outofctrl = c(15,23) q1 <- with(orangejuice[-outofctrl,], qcc(D[trial], sizes=size[trial], type="p")) plot(q1) q1 <- with(orangejuice[-outofctrl,], qcc(D[trial], sizes=size[trial], type="p", newdata=D[!trial], newsizes=size[!trial])) plot(q1) outofctrl = c(6,20) q1 <- with(circuit[-outofctrl,], qcc(x[trial], sizes=size[trial], type="c")) plot(q1) q1 <- with(circuit[-outofctrl,], qcc(x[trial], sizes=size[trial], type="c", newdata = x[!trial], newsizes = size[!trial])) plot(q1) q1 <- with(circuit[-outofctrl,], qcc(x[trial], sizes=size[trial], type="u", newdata = x[!trial], newsizes = size[!trial])) plot(q1) data(pcmanufact) q1 <- with(pcmanufact, qcc(x, sizes=size, type="u")) q1 plot(q1) data(dyedcloth) # variable control limits plot(with(dyedcloth, qcc(x, sizes=size, type="u"))) # standardized control chart q <- with(dyedcloth, qcc(x, sizes=size, type="u")) z <- (q$statistics - q$center)/sqrt(q$center/q$size) plot(qcc(z, sizes = 1, type = "u", center = 0, std.dev = 1, limits = c(-3,3)), title = "Standardized u chart") ## Continuous one-at-time data q <- with(viscosity, qcc(viscosity[trial], type = "xbar.one")) q plot(q) # batch 4 is out-of-control because of a process temperature controller # failure; remove it and recompute viscosity <- viscosity[-4,] plot(with(viscosity, qcc(viscosity[trial], type = "xbar.one", newdata = viscosity[!trial])))## Continuous data diameter = qccGroups(data = pistonrings, diameter, sample) (q = qcc(diameter[1:25,], type="xbar")) plot(q) (q = qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,])) plot(q) q = qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,]) plot(q, chart.all=FALSE) plot(qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], nsigmas=2)) plot(qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], confidence.level=0.99)) q <- qcc(diameter[1:25,], type="R") q plot(q) plot(qcc(diameter[1:25,], type="R", newdata=diameter[26:40,])) plot(qcc(diameter[1:25,], type="S")) plot(qcc(diameter[1:25,], type="S", newdata=diameter[26:40,])) plot(qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], rules = 1:4)) # variable control limits out = c(9, 10, 30, 35, 45, 64, 65, 74, 75, 85, 99, 100) diameter = qccGroups(data = pistonrings[-out,], diameter, sample) plot(qcc(diameter[1:25,], type="xbar")) plot(qcc(diameter[1:25,], type="R")) plot(qcc(diameter[1:25,], type="S")) plot(qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,])) plot(qcc(diameter[1:25,], type="R", newdata=diameter[26:40,])) plot(qcc(diameter[1:25,], type="S", newdata=diameter[26:40,])) # to customize a Shewhart chart use q <- qcc(diameter[1:25, ], type = "xbar") graph = plot(q, ylim = c(73.9, 74.1)) # returned object is of class "patchwork", then add geom_* layer to the first element graph[[1]] <- graph[[1]] + geom_hline(yintercept = c(73.95, 74.05), lty = 2) graph ## Attribute data q <- with(orangejuice, qcc(D[trial], sizes=size[trial], type="p")) q plot(q) # remove out-of-control points (see help(orangejuice) for the reasons) outofctrl <- c(15,23) q1 <- with(orangejuice[-outofctrl,], qcc(D[trial], sizes=size[trial], type="p")) plot(q1) q1 <- with(orangejuice[-outofctrl,], qcc(D[trial], sizes=size[trial], type="p", newdata=D[!trial], newsizes=size[!trial])) plot(q1) data(orangejuice2) q2 <- with(orangejuice2, qcc(D[trial], sizes=size[trial], type="p")) plot(q2) q2 <- with(orangejuice2, qcc(D[trial], sizes=size[trial], type="p", newdata=D[!trial], newsizes=size[!trial])) plot(q2) data(circuit) plot(with(circuit, qcc(x[trial], sizes=size[trial], type="c"))) # remove out-of-control points (see help(circuit) for the reasons) outofctrl = c(15,23) q1 <- with(orangejuice[-outofctrl,], qcc(D[trial], sizes=size[trial], type="p")) plot(q1) q1 <- with(orangejuice[-outofctrl,], qcc(D[trial], sizes=size[trial], type="p", newdata=D[!trial], newsizes=size[!trial])) plot(q1) outofctrl = c(6,20) q1 <- with(circuit[-outofctrl,], qcc(x[trial], sizes=size[trial], type="c")) plot(q1) q1 <- with(circuit[-outofctrl,], qcc(x[trial], sizes=size[trial], type="c", newdata = x[!trial], newsizes = size[!trial])) plot(q1) q1 <- with(circuit[-outofctrl,], qcc(x[trial], sizes=size[trial], type="u", newdata = x[!trial], newsizes = size[!trial])) plot(q1) data(pcmanufact) q1 <- with(pcmanufact, qcc(x, sizes=size, type="u")) q1 plot(q1) data(dyedcloth) # variable control limits plot(with(dyedcloth, qcc(x, sizes=size, type="u"))) # standardized control chart q <- with(dyedcloth, qcc(x, sizes=size, type="u")) z <- (q$statistics - q$center)/sqrt(q$center/q$size) plot(qcc(z, sizes = 1, type = "u", center = 0, std.dev = 1, limits = c(-3,3)), title = "Standardized u chart") ## Continuous one-at-time data q <- with(viscosity, qcc(viscosity[trial], type = "xbar.one")) q plot(q) # batch 4 is out-of-control because of a process temperature controller # failure; remove it and recompute viscosity <- viscosity[-4,] plot(with(viscosity, qcc(viscosity[trial], type = "xbar.one", newdata = viscosity[!trial])))
These functions are provided for compatibility with older versions of the package qcc, and they will likely be removed in the future.
pareto.chart(...) process.capability(...) oc.curves(...) qcc.overdispersion.test(...) cause.and.effect(...) qcc.groups(...)pareto.chart(...) process.capability(...) oc.curves(...) qcc.overdispersion.test(...) cause.and.effect(...) qcc.groups(...)
... |
all arguments are passed down. |
This function can be used to control the behavior of the 'qcc' library such as the background color, out-of-control points appearance, and many others.
qcc.options(...)qcc.options(...)
... |
the option to be set or retrieved. See details. |
The available options are:
exp.R.unscaled: a vector specifying, for each sample size, the expected
value of the relative range (i.e. ) for a normal
distribution. This appears as on most tables containing factors
for the construction of control charts.
se.R.unscaled: a vector specifying, for each sample size, the standard
error of the relative range (i.e. ) for a normal
distribution. This appears as on most tables containing factors
for the construction of control charts.
beyond.limits$pch: plotting character used to highlight points beyond
control limits.
beyond.limits$col: color used to highlight points beyond control
limits.
violating.runs$pch: plotting character used to highlight points
violating runs.
violating.runs$col: color used to highlight points violating runs.
run.length: the maximum value of a run before to signal a point as out
of control.
bg.margin: background color used to draw the margin of the charts.
bg.figure: background color used to draw the figure of the charts.
cex: character expansion used to draw plot annotations (labels, title,
tickmarks, etc.).
font.stats: font used to draw text at the bottom of control charts.
cex.stats: character expansion used to draw text at the bottom of
control charts.
If the functions is called with no argument return a list of available options.
If an option argument is provided the corresponding value is returned.
If a value is associated with an option argument, such option is set and the
list of updated option values is invisibly returned. In this case the list
.qcc.options is modified and any modification will remain in effect
for the rest of the session.
Luca Scrucca
old = qcc.options() # save defaults qcc.options("cex.stats") # get a single parameter qcc.options("cex.stats"=1.2) # change parameters qcc.options(bg.margin="azure2") qcc.options("violating.runs" = list(pch = 15, col = "purple")) qcc.options("beyond.limits" = list(pch = 15, col = "orangered")) qcc(rnorm(100), type = "xbar.one", std.dev = 0.7) # see the results qcc.options(old) # restore old defaultsold = qcc.options() # save defaults qcc.options("cex.stats") # get a single parameter qcc.options("cex.stats"=1.2) # change parameters qcc.options(bg.margin="azure2") qcc.options("violating.runs" = list(pch = 15, col = "purple")) qcc.options("beyond.limits" = list(pch = 15, col = "orangered")) qcc(rnorm(100), type = "xbar.one", std.dev = 0.7) # see the results qcc.options(old) # restore old defaults
This function allows to easily group data to use as input to the
qcc() function.
qccGroups(data, x, sample)qccGroups(data, x, sample)
data |
a data frame (or a similar structure which can be coerced to be
a |
x |
a name from |
sample |
a name from |
The function returns a matrix of suitable dimensions. If one or more
group have fewer observations than others, NA values are used to fill
empty values.
Luca Scrucca
data(pistonrings) # create a matrix of 40 samples made of 5 observations each qccGroups(data = pistonrings, diameter, sample) # remove some observations to get still a 40x5 matrix but filled with NAs qccGroups(data = pistonrings[-c(1,2,50,52,199),], diameter, sample)data(pistonrings) # create a matrix of 40 samples made of 5 observations each qccGroups(data = pistonrings, diameter, sample) # remove some observations to get still a 40x5 matrix but filled with NAs qccGroups(data = pistonrings[-c(1,2,50,52,199),], diameter, sample)
This function allows to test for overdispersed data in the binomial and poisson case.
qccOverdispersionTest( x, size, type = ifelse(missing(size), "poisson", "binomial") )qccOverdispersionTest( x, size, type = ifelse(missing(size), "poisson", "binomial") )
x |
a vector of observed data values |
size |
for binomial data, a vector of sample sizes |
type |
a character string specifying the distribution for testing,
either |
This very simple test amounts to compute the test statistic
where is the observed variance, is the theoretical
variance, and is the number of observations. The test statistic is
then compared to the critical value of a Chi-square distribution with
degrees of freedom.
The function returns a matrix of results.
Luca Scrucca
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
# data from Wetherill and Brown (1991) pp. 212--213, 216--218: x = c(12,11,18,11,10,16,9,11,14,15,11,9,10,13,12, 8,12,13,10,12,13,16,12,18,16,10,16,10,12,14) size = rep(50, length(x)) qccOverdispersionTest(x, size) x = c(11,8,13,11,13,17,25,23,11,16,9,15,10,16,12, 8,9,15,4,12,12,12,15,17,14,17,12,12,7,16) qccOverdispersionTest(x)# data from Wetherill and Brown (1991) pp. 212--213, 216--218: x = c(12,11,18,11,10,16,9,11,14,15,11,9,10,13,12, 8,12,13,10,12,13,16,12,18,16,10,16,10,12,14) size = rep(50, length(x)) qccOverdispersionTest(x, size) x = c(11,8,13,11,13,17,25,23,11,16,9,15,10,16,12, 8,9,15,4,12,12,12,15,17,14,17,12,12,7,16) qccOverdispersionTest(x)
Functions which implement rules to signal out-of-control (OOC) or out-of-trend (OOT) points in Shewhart control charts.
qccRules(object, rules = object$rules, rule.set = object$rule.set) qccRulesViolatingWER1(object, limits = object$limits) qccRulesViolatingWER2( object, run.points = 2, run.length = 3, k = object$nsigmas * 2/3 ) qccRulesViolatingWER3(object, ...) qccRulesViolatingWER4(object) qccRulesViolatingNEL1(object) qccRulesViolatingNEL2(object, run.length = 9) qccRulesViolatingNEL3(object) qccRulesViolatingNEL4(object) qccRulesViolatingNEL5(object) qccRulesViolatingNEL6(object) qccRulesViolatingNEL7(object) qccRulesViolatingNEL8(object)qccRules(object, rules = object$rules, rule.set = object$rule.set) qccRulesViolatingWER1(object, limits = object$limits) qccRulesViolatingWER2( object, run.points = 2, run.length = 3, k = object$nsigmas * 2/3 ) qccRulesViolatingWER3(object, ...) qccRulesViolatingWER4(object) qccRulesViolatingNEL1(object) qccRulesViolatingNEL2(object, run.length = 9) qccRulesViolatingNEL3(object) qccRulesViolatingNEL4(object) qccRulesViolatingNEL5(object) qccRulesViolatingNEL6(object) qccRulesViolatingNEL7(object) qccRulesViolatingNEL8(object)
object |
an object of class |
rules |
a vector of values specifying the rules used to declare a
process OOC or OOT. Numeric values are interpreted differently depending
on the value of |
rule.set |
a character string selecting the rule set used to interpret
numeric |
limits |
a two-column matrix containing the lower and upper control limits. |
run.points |
the minimum number of points beyond the sigma limit needed to signal a violation. |
run.length |
the number of consecutive points in the run. |
k |
the number of standard deviations from the center line used to define the sigma limits. |
... |
additional arguments, currently ignored. |
The qccRulesViolatingWER1, qccRulesViolatingWER2, ...,
qccRulesViolatingWER4 functions return the indices violating the
corresponding Western Electric rule:
One point plots outside 3-sigma control limits.
Two of three consecutive points plot beyond a 2-sigma limit.
Four of five consecutive points plot beyond a 1-sigma limit.
Eight consecutive points plot on one side of the center line.
The qccRulesViolatingNEL1, qccRulesViolatingNEL2, ...,
qccRulesViolatingNEL8 functions return the indices violating the
corresponding Nelson rule:
One point plots outside 3-sigma control limits.
Nine points in a row plot on the same side of the center line.
Six points in a row are steadily increasing or decreasing.
Fourteen points in a row alternate up and down.
Two of three consecutive points plot beyond a 2-sigma limit on the same side.
Four of five consecutive points plot beyond a 1-sigma limit on the same side.
Fifteen points in a row plot within 1 sigma of the center line.
Eight points in a row plot outside 1 sigma on both sides of the center line.
The function qccRules returns a vector of the same length as the statistics
charted with value NA if no rule is violated, and numerical values
corresponding to the violated rule. If more than one rule is violated, the
value returned corresponds to the most serious violation.
Luca Scrucca
Anas Sheashaey
Multivariate data from Ryan (2011, Table 9.2).
RyanMultivarRyanMultivar
Multivariate data on 20 samples of size 4 for two variables:
a list of two data frames, X1 and
X2, one for each variable.
Ryan, T. P. (2011), Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
Other datasets in qcc package:
antifreeze,
boiler,
circuit,
dyedcloth,
orangejuice,
pcmanufact,
pistonrings,
viscosity
Statistics used in computing and drawing a Shewhart c chart.
stats.c(data, sizes) sd.c(data, sizes, ...) limits.c(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.c(data, sizes) sd.c(data, sizes, ...) limits.c(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
The sample sizes. |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
std.dev |
The within-group standard deviation. |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
The function stats.c returns a list with components
statistics and center.
The function sd.c returns std.dev the standard deviation of
the statistic charted.
The function limits.c returns a matrix with lower and upper control
limits.
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
These functions are used to compute statistics required by the g chart (geometric distribution) for use with the qcc package.
stats.g(data, sizes) sd.g(data, sizes, ...) limits.g(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.g(data, sizes) sd.g(data, sizes, ...) limits.g(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
sample sizes (not used) |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
std.dev |
standard deviation of geometric distribution |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
The g chart plots the number of non-events between events. np charts do not work well when the probability of an event is rare (see example below). Instead of plotting the number of events, the g chart plots the number of non-events between events.
The geometric distribution is quite skewed so it is best to set conf
at the required confidence interval (0 < conf < 1) rather than as a
multiplier of sigma.
The function stats.g() returns a list with components
statistics and center.
The function sd.g() returns std.dev the standard deviation
.
The function limits.g() returns a matrix with lower and upper control
limits.
Greg Snow ([email protected])
Kaminsky, F. C., et al. (1992). Statistical Control Charts Based on a Geometric Distribution. Journal of Quality Technology, 24, 63–69.
Yang, Z., et al. (2002). On the Performance of Geometric Charts with Estimated Control Limits. Journal of Quality Technology, 34, 448–458.
success = rbinom(1000, 1, 0.01) num.noevent = diff(which(c(1,success)==1))-1 qcc(success, type = "np", sizes = 1) qcc(num.noevent, type = "g")success = rbinom(1000, 1, 0.01) num.noevent = diff(which(c(1,success)==1))-1 qcc(success, type = "np", sizes = 1) qcc(num.noevent, type = "g")
These functions are used to compute statistics required by the np chart.
stats.np(data, sizes) sd.np(data, sizes, ...) limits.np(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.np(data, sizes) sd.np(data, sizes, ...) limits.np(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
The sample sizes. |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
std.dev |
The within-group standard deviation. |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
The function stats.np returns a list with components
statistics and center.
The function sd.np returns std.dev the standard deviation of
the statistic charted.
The function limits.np returns a matrix with lower and upper control
limits.
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
These functions are used to compute statistics required by the p chart.
stats.p(data, sizes) sd.p(data, sizes, ...) limits.p(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.p(data, sizes) sd.p(data, sizes, ...) limits.p(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
The sample sizes. |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
std.dev |
The within-group standard deviation. |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
The function stats.p returns a list with components
statistics and center.
The function sd.p returns std.dev the standard deviation of
the statistic charted.
The function limits.p returns a matrix with lower and upper control
limits.
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
These functions are used to compute statistics required by the R chart.
stats.R(data, sizes) sd.R(data, sizes, std.dev = c("UWAVE-R", "MVLUE-R"), ...) limits.R(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.R(data, sizes) sd.R(data, sizes, std.dev = c("UWAVE-R", "MVLUE-R"), ...) limits.R(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
samples sizes. Optional |
std.dev |
within group standard deviation. Optional for |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
The function stats.R returns a list with components
statistics and center.
The function sd.R returns std.dev the standard deviation of
the statistic charted.
The function limits.R returns a matrix with lower and upper control
limits.
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
These functions are used to compute statistics required by the S chart.
stats.S(data, sizes) sd.S(data, sizes, std.dev = c("UWAVE-SD", "MVLUE-SD", "RMSDF"), ...) limits.S(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.S(data, sizes) sd.S(data, sizes, std.dev = c("UWAVE-SD", "MVLUE-SD", "RMSDF"), ...) limits.S(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
samples sizes. Optional |
std.dev |
within group standard deviation. Optional for |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
The function stats.S returns a list with components
statistics and center.
The function sd.S returns std.dev the standard deviation of
the statistic charted.
The function limits.S returns a matrix with lower and upper control
limits.
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
These functions are used to compute statistics required by the
chart.
stats.T2(data, center = NULL, cov = NULL) limits.T2(ngroups, size, nvars, conf)stats.T2(data, center = NULL, cov = NULL) limits.T2(ngroups, size, nvars, conf)
data |
the observed data values |
center |
a vector of values to use for center of input variables. |
cov |
a matrix of values to use for the covariance matrix of input variables. |
ngroups |
number of groups |
size |
sample size |
nvars |
number of variables |
conf |
confidence level (0 < |
The function stats.T2 returns a list with components:
statistics: a vector of values for the statistic.
means: a matrix of within group means for each variable.
center: sample/group center statistic.
S: covariance matrix.
The function limits.T2 returns a list with components:
control: control limits.
prediction: prediction limits.
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
These functions are used to compute statistics required by the
chart for individual observations.
stats.T2.single(data, center = NULL, cov = NULL) limits.T2.single(ngroups, size = 1, nvars, conf)stats.T2.single(data, center = NULL, cov = NULL) limits.T2.single(ngroups, size = 1, nvars, conf)
data |
the observed data values |
center |
a vector of values to use for center of input variables. |
cov |
a matrix of values to use for the covariance matrix of input variables. |
ngroups |
number of groups |
size |
sample size |
nvars |
number of variables |
conf |
confidence level (0 < |
The function stats.T2.single returns a list with components:
statistics: a vector of values for the statistic.
means: a matrix of within group means for each variable, equal to
data since samples are of size one.
center: sample/group center statistic.
S: covariance matrix.
The function limits.T2.single returns a list with components:
control: control limits.
prediction: prediction limits.
Luca Scrucca
Mason, R. L., and Young, J. C. (2002). Multivariate Statistical Process Control with Industrial Applications. SIAM.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
These functions are used to compute statistics required by the u chart.
stats.u(data, sizes) sd.u(data, sizes, ...) limits.u(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.u(data, sizes) sd.u(data, sizes, ...) limits.u(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
The sample sizes. |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
std.dev |
The within-group standard deviation. |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
The function stats.u returns a list with components
statistics and center.
The function sd.u returns std.dev the standard deviation of
the statistic charted.
The function limits.u returns a matrix with lower and upper control
limits.
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
These functions are used to compute statistics required by the xbar chart.
stats.xbar(data, sizes) sd.xbar( data, sizes, std.dev = c("UWAVE-R", "UWAVE-SD", "MVLUE-R", "MVLUE-SD", "RMSDF"), ... ) limits.xbar(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.xbar(data, sizes) sd.xbar( data, sizes, std.dev = c("UWAVE-R", "UWAVE-SD", "MVLUE-R", "MVLUE-SD", "RMSDF"), ... ) limits.xbar(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
samples sizes. Optional |
std.dev |
within group standard deviation. Optional for |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
The following methods are available for estimating the process standard deviation:
"UWAVE-R": UnWeighted AVErage of within-group estimates based on
within-group Ranges.
"UWAVE-SD": UnWeighted AVErage of within-group estimates based on
within-group Standard Deviations.
"MVLUE-R": Minimum Variance Linear Unbiased Estimator computed as a
weighted average of within-group estimates based on within-group Ranges.
"MVLUE-SD": Minimum Variance Linear Unbiased Estimator computed as a
weighted average of within-group estimates based on within-group Standard
Deviations.
"RMSDF": Root-Mean-Square estimator computed as a weighted average of
within-group estimates based on within-group Standard Deviations.
Depending on the chart, a method may be available or not, or set as the default according to the following table:
| Method | "xbar" |
"R" |
"S" |
"UWAVE-R" |
default | default | not available |
"UWAVE-SD" |
available | not available | default |
"MVLUE-R" |
available | available | not available |
"MVLUE-SD" |
available | not available | available |
"RMSDF" |
available | not available | available |
Detailed definitions of formulae implemented are available in the SAS/QC User's Guide.
The function stats.xbar returns a list with components
statistics and center.
The function sd.xbar returns std.dev the standard deviation of
the statistic charted. This is based on results from Burr (1969).
The function limits.xbar returns a matrix with lower and upper
control limits.
Luca Scrucca
Burr, I. W. (1969). Control charts for measurements with varying sample sizes. Journal of Quality Technology, 1(3), 163–167.
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
These functions are used to compute statistics required by the xbar chart for one-at-time data.
stats.xbar.one(data, sizes) sd.xbar.one(data, sizes, std.dev = c("MR", "SD"), r = 2, ...) limits.xbar.one(center, std.dev, sizes, nsigmas = NULL, conf = NULL)stats.xbar.one(data, sizes) sd.xbar.one(data, sizes, std.dev = c("MR", "SD"), r = 2, ...) limits.xbar.one(center, std.dev, sizes, nsigmas = NULL, conf = NULL)
data |
The observed data values. |
sizes |
samples sizes. Not needed, |
std.dev |
within group standard deviation. Optional for
|
r |
number of successive pairs of observations for computing the standard deviation based on moving ranges of r points. |
... |
catches further ignored arguments. |
center |
The sample/group center statistic. |
nsigmas |
Number of sigmas used to compute control limits.
Ignored when the |
conf |
Confidence level used to compute control limits.
Must be a numeric value in |
Methods available for estimating the process standard deviation:
"MR": moving range; this estimate is based on the scaled mean of moving
ranges.
"SD": sample standard deviation; this estimate is defined as
sd(x) / cd(n), where n is the number of individual measurements of
x.
The function stats.xbar.one returns a list with components
statistics and center.
The function sd.xbar.one returns std.dev the standard
deviation of the statistic charted.
The function limits.xbar.one returns a matrix with lower and upper
control limits.
Luca Scrucca
Montgomery, D.C. (2013). Introduction to Statistical Quality Control, 7th ed. New York: John Wiley & Sons.
Ryan, T. P. (2011). Statistical Methods for Quality Improvement, 3rd ed. New York: John Wiley & Sons, Inc.
Wetherill, G. B., and Brown, D. W. (1991). Statistical Process Control. New York: Chapman & Hall.
x <- antifreeze[["water"]] # See `?antifreeze` # 1) using MR (default) qcc(x, type="xbar.one", data.name="Water content (in ppm) of batches of antifreeze") # 2) using SD qcc(x, type="xbar.one", std.dev = "SD", data.name="Water content (in ppm) of batches of antifreeze") # "as the size increases further, we would expect sigma-hat to settle down # at a value close to the overall sigma-hat" (Wetherill and Brown, 1991, p. 121) sigma <- NA k <- 2:24 for (j in k) sigma[j] <- sd.xbar.one(x, k=j) plot(k, sigma[k], type="b") # plot estimates of sigma for abline(h=sd(x), col=2, lty=2) # different values of kx <- antifreeze[["water"]] # See `?antifreeze` # 1) using MR (default) qcc(x, type="xbar.one", data.name="Water content (in ppm) of batches of antifreeze") # 2) using SD qcc(x, type="xbar.one", std.dev = "SD", data.name="Water content (in ppm) of batches of antifreeze") # "as the size increases further, we would expect sigma-hat to settle down # at a value close to the overall sigma-hat" (Wetherill and Brown, 1991, p. 121) sigma <- NA k <- 2:24 for (j in k) sigma[j] <- sd.xbar.one(x, k=j) plot(k, sigma[k], type="b") # plot estimates of sigma for abline(h=sd(x), col=2, lty=2) # different values of k
"The viscosity of an aircraft primer paint is an important quality characteristic. The product is produced in batches, and because each batch takes several hours to produce, the production rate is too slow to allow for rational subgroups of size greater than one." (Montgomery, 2005, p. 232)
viscosityviscosity
A data frame with 35 observations on the following 3 variables.
batch number
viscosity measure
preliminary sample indicator (TRUE/FALSE)
Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed, New York, John Wiley & Sons, pp. 232-235
Other datasets in qcc package:
RyanMultivar,
antifreeze,
boiler,
circuit,
dyedcloth,
orangejuice,
pcmanufact,
pistonrings