limits.g {TeachingDemos} | R Documentation |
These functions are used to compute statistics required by the g chart (geometric distribution) for use with the qcc package.
stats.g(data, sizes) sd.g(data, sizes) limits.g(center, std.dev, sizes, conf)
data |
the observed data values |
center |
sample center statistic |
sizes |
sample sizes (not used) |
std.dev |
standard deviation of geometric distribution |
conf |
a numeric value used to compute control limits, specifying the number of standard deviations (if 'conf' > 1) or the confidence level (if 0 < 'conf' < 1). |
These functions work with the qcc package and may someday be moved into the qcc package.
The g chart plots the number of non-events between events. np charts do not work well when the probability of an event is rare (see example below). Instead of plotting the number of events, the g chart plots the number of non-events between events.
The function 'stats.g' returns a list with components 'statistics' and
'center'.
The function 'sd.g' returns 'std.dev' the standard deviation
(sqrt(1-p)/p).
The function 'limits.g' returns a matrix with lower and upper control limits.
The geometric distribution is quite skewed so using 'conf' > 1 does not give good limits, use a value of 'conf' between 0 and 1.
Greg Snow greg.snow@ihc.com
qcc
if(require(qcc)){ tmp <- rbinom(1000, 1, 0.01) tmp2 <- diff(which(c(1,tmp)==1))-1 qcc(tmp,'np',1) qcc(tmp2, "g") }