qcc.
Different functions are available for the different types of control charts.
stats.xbar(data, sizes) stats.s(data, sizes) stats.R(data, sizes) stats.p(data, sizes) stats.np(data, sizes) stats.c(data, sizes) stats.u(data, sizes) stats.ma(data, sizes = 2) stats.ms(data, sizes = 2) stats.mR(data, sizes = 2) stats.ewma(data, sizes = 1, wt = 0.25)
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 data is a
vector or one column matrix.
sizes corresponds to the number of units examined.
These functions are important to computing the
statistics and
center
components of a
"qcc" object in preparation to plotting a Shewhart or a
cusum quality control chart. The
sizes argument is passed in from
qcc
so must be provided if these functions are called separately.
The values for
statistics and
center for each type of chart are computed
as follows:
statistics <- apply(data, 1, mean)
center <- sum(sizes * statistics)/sum(sizes)
When
data is a list
sapply is used instead of
apply.
statistics <- sqrt(apply(data, 1, var))
center <- sum(sizes * statistics)/sum(sizes)
When
data is a list
sapply is used instead of
apply.
statistics <- apply(data, 1, range)
statistics <- statistics[2, ] - statistics[1, ]
center <- sum(sizes * statistics)/sum(sizes)
When
data is a list
sapply is used instead of
apply.
statistics <- data
center <- sum(sizes * data)/sum(sizes)
statistics <- data
center <- sizes * sum(data)/sum(sizes)
statistics <- data
center <- mean(statistics)
sizes is assumed equal to 1 (one).
statistics <- data
center <- sum(sizes * statistics)/sum(sizes)
statistics <- moving.ave(data, span = sizes)
sizes <- statistics$sizes
statistics <- statistics$aves
center <- sum(sizes * statistics)/sum(sizes)
statistics <- moving.sigma(data, span = sizes)
sizes <- statistics$sizes
statistics <- statistics$sigmas
center <- sum(sizes * statistics)/sum(sizes)
statistics <- moving.range(data, span = sizes)
sizes <- statistics$sizes
statistics <- statistics$ranges
center <- sum(sizes * statistics)/sum(sizes)
center <- mean(data)
statistics <- numeric(length(data) + 1)
statistics[1] <- center
for(i in seq(length(data)))
statistics[i + 1] <- wt * data[i] + (1 - wt) * statistics[i]
type 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.