Description Usage Arguments Value Note Author(s) References See Also Examples
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | qcc(data, type, sizes, center, std.dev, limits,
data.name, labels, newdata, newsizes, newdata.name,
newlabels, nsigmas = 3, confidence.level,
rules = shewhart.rules, plot = TRUE, ...)
## S3 method for class 'qcc'
print(x, ...)
## S3 method for class 'qcc'
summary(object, digits = getOption("digits"), ...)
## S3 method for class 'qcc'
plot(x, add.stats = TRUE, chart.all = TRUE,
label.limits = c("LCL ", "UCL"), title, xlab, ylab, ylim,
axes.las = 0, digits = getOption("digits"),
restore.par = TRUE, ...)
|
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.
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 the ”target” value of the process. | ||||||||||||||||||||||||||||||
std.dev |
a value or an available method specifying the within-group standard deviation(s) of the process. | ||||||||||||||||||||||||||||||
limits |
a two-values vector specifying control limits. | ||||||||||||||||||||||||||||||
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 | ||||||||||||||||||||||||||||||
newsizes |
a vector as for the | ||||||||||||||||||||||||||||||
newdata.name |
a string specifying the name of the variable which appears on the plots. If not provided is taken from the object given as newdata. | ||||||||||||||||||||||||||||||
newlabels |
a character vector of labels for each new group defined in the argument | ||||||||||||||||||||||||||||||
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 function of rules to apply to the chart. By default, the | ||||||||||||||||||||||||||||||
plot |
logical. If | ||||||||||||||||||||||||||||||
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 | ||||||||||||||||||||||||||||||
label.limits |
a character vector specifying the labels for control limits. | ||||||||||||||||||||||||||||||
title |
a string giving the label for the main title. | ||||||||||||||||||||||||||||||
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. See | ||||||||||||||||||||||||||||||
digits |
the number of significant digits to use. | ||||||||||||||||||||||||||||||
restore.par |
a logical value indicating whether the previous | ||||||||||||||||||||||||||||||
object |
an object of class 'qcc'. | ||||||||||||||||||||||||||||||
x |
an object of class 'qcc'. | ||||||||||||||||||||||||||||||
... |
additional arguments to be passed to the generic function. |
Returns an object of class 'qcc'.
For a nice blog post discussing the qcc
package, in particular how to implement the Western Eletric Rules (WER), see http://blog.yhathq.com/posts/quality-control-in-r.html.
Luca Scrucca
Mason, R.L. and Young, J.C. (2002) Multivariate Statistical Process Control with Industrial Applications, SIAM.
Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons.
Ryan, T. P. (2000), Statistical Methods for Quality Improvement, 2nd 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.
shewhart.rules
, cusum
, ewma
, oc.curves
, process.capability
, qcc.groups
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | ##
## Continuous data
##
data(pistonrings)
attach(pistonrings)
diameter <- qcc.groups(diameter, sample)
qcc(diameter[1:25,], type="xbar")
qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,])
q <- qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], plot=FALSE)
plot(q, chart.all=FALSE)
qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], nsigmas=2)
qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], confidence.level=0.99)
qcc(diameter[1:25,], type="R")
qcc(diameter[1:25,], type="R", newdata=diameter[26:40,])
qcc(diameter[1:25,], type="S")
qcc(diameter[1:25,], type="S", newdata=diameter[26:40,])
# add warning limits at 2 std. deviations
q <- qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,], plot=FALSE)
(warn.limits <- limits.xbar(q$center, q$std.dev, q$sizes, 2))
plot(q, restore.par = FALSE)
abline(h = warn.limits, lty = 3, col = "chocolate")
# variable control limits
out <- c(9, 10, 30, 35, 45, 64, 65, 74, 75, 85, 99, 100)
diameter <- qcc.groups(pistonrings$diameter[-out], sample[-out])
qcc(diameter[1:25,], type="xbar")
qcc(diameter[1:25,], type="R")
qcc(diameter[1:25,], type="S")
qcc(diameter[1:25,], type="xbar", newdata=diameter[26:40,])
qcc(diameter[1:25,], type="R", newdata=diameter[26:40,])
qcc(diameter[1:25,], type="S", newdata=diameter[26:40,])
detach(pistonrings)
##
## Attribute data
##
data(orangejuice)
attach(orangejuice)
qcc(D[trial], sizes=size[trial], type="p")
# remove out-of-control points (see help(orangejuice) for the reasons)
inc <- setdiff(which(trial), c(15,23))
q1 <- qcc(D[inc], sizes=size[inc], type="p")
qcc(D[inc], sizes=size[inc], type="p", newdata=D[!trial], newsizes=size[!trial])
detach(orangejuice)
data(orangejuice2)
attach(orangejuice2)
names(D) <- sample
qcc(D[trial], sizes=size[trial], type="p")
q2 <- qcc(D[trial], sizes=size[trial], type="p", newdata=D[!trial], newsizes=size[!trial])
detach(orangejuice2)
# put on the same graph the two orange juice samples
oldpar <- par(no.readonly = TRUE)
par(mfrow=c(1,2), mar=c(5,5,3,0))
plot(q1, title="First samples", ylim=c(0,0.5), add.stats=FALSE, restore.par=FALSE)
par("mar"=c(5,0,3,3), yaxt="n")
plot(q2, title="Second samples", add.stats=FALSE, ylim=c(0,0.5))
par(oldpar)
data(circuit)
attach(circuit)
qcc(x[trial], sizes=size[trial], type="c")
# remove out-of-control points (see help(circuit) for the reasons)
inc <- setdiff(which(trial), c(6,20))
qcc(x[inc], sizes=size[inc], type="c", labels=inc)
qcc(x[inc], sizes=size[inc], type="c", labels=inc,
newdata=x[!trial], newsizes=size[!trial], newlabels=which(!trial))
qcc(x[inc], sizes=size[inc], type="u", labels=inc,
newdata=x[!trial], newsizes=size[!trial], newlabels=which(!trial))
detach(circuit)
data(pcmanufact)
attach(pcmanufact)
qcc(x, sizes=size, type="u")
detach(pcmanufact)
data(dyedcloth)
attach(dyedcloth)
qcc(x, sizes=size, type="u")
# standardized control chart
q <- qcc(x, sizes=size, type="u", plot=FALSE)
z <- (q$statistics - q$center)/sqrt(q$center/q$size)
plot(z, type="o", ylim=range(z,3,-3), pch=16)
abline(h=0, lty=2)
abline(h=c(-3,3), lty=2)
detach(dyedcloth)
##
## Continuous one-at-time data
##
# viscosity data (Montgomery, pag. 242)
x <- c(33.75, 33.05, 34, 33.81, 33.46, 34.02, 33.68, 33.27, 33.49, 33.20,
33.62, 33.00, 33.54, 33.12, 33.84)
qcc(x, type="xbar.one")
qcc(x, type="xbar.one", std.dev = "SD")
|
Package 'qcc' version 2.7
Type 'citation("qcc")' for citing this R package in publications.
List of 11
$ call : language qcc(data = diameter[1:25, ], type = "xbar")
$ type : chr "xbar"
$ data.name : chr "diameter[1:25, ]"
$ data : num [1:25, 1:5] 74 74 74 74 74 ...
..- attr(*, "dimnames")=List of 2
$ statistics: Named num [1:25] 74 74 74 74 74 ...
..- attr(*, "names")= chr [1:25] "1" "2" "3" "4" ...
$ sizes : Named int [1:25] 5 5 5 5 5 5 5 5 5 5 ...
..- attr(*, "names")= chr [1:25] "1" "2" "3" "4" ...
$ center : num 74
$ std.dev : num 0.00979
$ nsigmas : num 3
$ limits : num [1, 1:2] 74 74