Summary Statistics for Control Charts

DESCRIPTION:

Computes the group summary statistics for qcc. Different functions are available for the different types of control charts.

USAGE:

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) 

REQUIRED ARGUMENTS:

data
the data for computing the group summary statistics. For xbar, s and R charts, 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
vector of the number of observations in each group for xbar, s, and R charts. For p, np, and u charts, sizes corresponds to the number of units examined.

VALUE:

All these functions return a list with three components as follows:

statistics
a vector of group summary statistics.
center
an estimate of the center of the group summary statistics.
sizes
a vector of sample sizes for each group.

DETAILS:

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:

ARGUMENTS:

xbar
            statistics <- apply(data, 1, mean) 
            center <- sum(sizes * statistics)/sum(sizes) 

When data is a list sapply is used instead of apply.
s
            statistics <- sqrt(apply(data, 1, var)) 
            center <- sum(sizes * statistics)/sum(sizes) 

When data is a list sapply is used instead of apply.
R
            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.
p
            statistics <- data 
            center <- sum(sizes * data)/sum(sizes) 

np
            statistics <- data 
            center <- sizes * sum(data)/sum(sizes) 

c
            statistics <- data 
            center <- mean(statistics) 

sizes is assumed equal to 1 (one).
u
            statistics <- data 
            center <- sum(sizes * statistics)/sum(sizes) 

ma
            statistics <- moving.ave(data, span = sizes)
            sizes <- statistics$sizes
            statistics <- statistics$aves
            center <- sum(sizes * statistics)/sum(sizes)

ms
            statistics <- moving.sigma(data, span = sizes)
            sizes <- statistics$sizes
            statistics <- statistics$sigmas
            center <- sum(sizes * statistics)/sum(sizes)

mR
            statistics <- moving.range(data, span = sizes)
            sizes <- statistics$sizes
            statistics <- statistics$ranges
            center <- sum(sizes * statistics)/sum(sizes)

ewma
            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]



You may write your own version of any one of these functions and pass the name of your function to the 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.

SEE ALSO:

, , .