cusum(object, newdata, type, z.scores, decision.int = 5, se.shift = 1, target, std.dev, sizes, labels, label.bounds = c("LDB","UDB"), headstart = decision.int/2, reset = F, add.stats = T, chart.all = F, ylim.min = NULL, check.cl = F, highlight = list(pch=1, col=2))
Subsequent calls to cusum can pass the return value of a call to cusum, which includes newdata, in place of object with additional data in the newdata argument.
With the exception of cusum charts for s (the standard deviation), the vector of upper (U) and lower (L) cumulative sums are computed as U[i] <- max(0, ( z[i] - k ) + U[i-1] ) L[i] <- max(0, ( - z[i] - k ) + L[i-1] ) where k is the reference value equal to se.shift/2 and z <- ( statistics - target ) / std.err is the vector of z-scores computed by centering the group summary statistics about the target value equal to target object$target or object$center in that order of preference and dividing by the vector of standard errors of the group summary statistics.
For the cusum chart for s, only upper sums, U, are computed as follows:
U[i] <- max(0, statistics[i] - k * target + U[i-1]) where target is the target argument, object$target, or object$center in that order of preference.
The cusum chart is a composite plot of the upper sums, U, (the upper part of the plot) and the negative of the lower sums, -L (the lower part of the plot). The argument decision.int sets the width of the decision interval in standard errors of the summary statistics. The argument se.shift is used to specify the size of the shift you want to detect. Because Shewhart charts are primarily useful for detecting large shifts (2-3 standard errors) in the process' center, cusum charts are usually used in conjunction with Shewhart charts with settings appropriate for detecting 0.5 to 1.5 standard error shifts. se.shift specifies shifts in standard errors of the group summary statistics. By default se.shift = 1, for detecting a 1 standard error shift, and is equal to twice the reference value, k.
Usually when an out-of-control signal is generated by a large (or small) cumulative sum, a search is conducted and a cause is assigned and removed if possible to correct the process. In this case, the cumulative sums are reset and monitoring continues. By resetting the sums to something other than zero (called a headstart), a fast initial response (FIR) cusum is produced. This is useful for quickly detecting a process that hasn't been fully corrected. When reset = TRUE the cusums will be reset to headstart each time a cumulative sum exceeds one of the decision boundaries.
One additional improvement to cusum charts results from checking for a large deviation from the target value of a single group summary statistic. A group summary statistic greater than 3 standard errors from the target is equivalent to that summary statistic being outside 3-sigma Shewhart control limits. When check.cl = TRUE, summary statistics violating Shewhart control limits are flagged as well as large cumulative sums. If object is of class "shewhart", it will have a cntrl.limits component which will be used to check for violating summary statistics. Otherwise, 3-sigma Shewhart control limits, centered about target, will be computed to check for violating summary statistics.
The ylim.min argument can be used to expand the range of the y-axis if additional detail needs to be added to the chart. For example, additional limits can be added to a chart by setting ylim.min appropriately. If the additional limits are in addl.limits, then setting ylim.min = addl.limits will guarantee that the y-axis range is large enough for any subsequent calls to abline or lines. When low level plotting functions like abline are used to add detail to a cusum chart, you need to specify add.stats = FALSE in the call to cusum or else the coordinates will be incorrect for adding detail.
Ryan, T. P. (1989). Statistical Methods For Quality Improvement. New York: John Wiley & Sons.
Wetherill, G. B. and Brown, D. W. (1991). Statistical Process Control. New York: Chapman and Hall.
cusum(qcc(matrix(rnorm(100), ncol = 5), type = "xbar"))