qcc.
Different functions are available for the different types of control charts.
sd.xbar(data, sizes, sd = NULL, equal.sd = T) sd.s(data, sizes, sd = NULL, equal.sd = T) sd.R(data, sizes, sd = NULL, equal.sd = T) sd.p(data, sizes) sd.np(data, sizes) sd.c(data, sizes) sd.u(data, sizes) sd.ma(data, sizes = 1, sd = NULL, sigma.span = 2, moving.sigma = "range") sd.ms(data, sizes = 1, sd = NULL, sigma.span = 2, moving.sigma = "s") sd.mR(data, sizes = 1, sd = NULL, sigma.span = 2, moving.sigma = "range") sd.ewma(data, sizes = 1, sd = NULL, sigma.span = 2, moving.sigma = "range")
data may be a matrix or list. For p, np,
c, and u charts,
data must be a vector or matrix with one column.
For ma, ms, mR and ewma charts
data must be a vector or one column matrix.
sizes corresponds to the number of units examined.
For xbar, s, and R charts,
sizes is optional. For p, np, and u charts,
sizes is required. For the c chart sizes is assumed equal to 1.
For ma, ms, mR, and ewma charts,
sizes is ignored. For these latter four
cases
sizes is set equal to
sigma.span which controls the number of
observations used in standard deviation calculations.
TRUE. This argument is currently only available for
sd.xbar,
sd.s and sd.R.
These functions are important to computing the
std.dev component of a
"qcc"
object in preparation to plotting a Shewhart or a cusum quality
control chart. Missing values (NA) must be removed prior to using these
functions.
The argument
equal.sd for
"xbar",
"s", and
"R" charts is
built in for added user control. It is not, however, controllable from
the argument list to
qcc. Consequently, you can either use
sd.xbar,
sd.s
. or
sd.R on your data, setting
equal.sd = F, and passing the
resulting value as the
std.dev argument to
qcc or make your own copy
of these two functions with the default setting changed. References for
the two different methods for computing the standard deviation for xbar
and s charts are Burr(1969, 1976).
The value for
std.dev for each type of chart are computed as follows:
Define
c4 <- function(n)
(sqrt(2/(n - 1)) * gamma(n/2))/gamma((n - 1)/2)
var.df <- sum(sizes - 1)
and
var.within as the vector of within group variances.
If
equal.sd = TRUE
std.dev <- sqrt(sum((sizes - 1) * var.within)/var.df)
std.dev <- std.dev/c4(var.df + 1)
If
equal.sd = FALSE
g <- c4(sizes)/(1 - c4(sizes)^2)
h <- g * c4(sizes)
std.dev <- sum(g * sqrt(var.within))/sum(h)
std.dev is computed in the same way it is for an
"xbar" chart.
std.dev is computed in the same way it is for an
"xbar" chart.
pbar <- sum(sizes * data)/sum(sizes)
std.dev <- sqrt(pbar * (1 - pbar))
pbar <- sum(data)/sum(sizes)
std.dev <- sqrt(sizes * pbar * (1 - pbar))
std.dev <- sqrt(mean(data))
sizes is assumed equal to 1 (one).
std.dev <- sqrt(sum(sizes * data)/sum(sizes))
std.dev <- moving.sigma(data, span = sigma.span)
std.dev <- moving.sigma(data, span = sigma.span)
std.dev <- moving.sigma(data, span = sigma.span)
std.dev <- moving.sigma(data, span = sigma.span)
You may write your own version of any one of these functions and pass the
name of your function to the
std.dev argument of
qcc. You can use these
functions as templates. Be sure, however, to include either a
sizes argument
or the
... argument, since
qcc will pass in
sizes in the call to your
function.
Burr, I. W. (1969).
Control charts for measurements with varying sample sizes.
Journal of Quality Technology
1:163-167.
Burr, I. W. (1976).
Statistical Quality Control Methods, Volume 16.
New York: Marcel Decker, Inc.