 Control Charts in R using qcc; Control limits not correct

I'm using qcc to build an xbar and Range control chart.

qcc(diameter, type="xbar", std.dev=0.011021, nsigmas=3). is the line of code I'm using.

The resulting graphic looks fine, the mean is correct and it shows the standard deviation (SD) as the same one I input (0.011021). However the control limits are off.

It's for a university assignment and I'm not sure if my confusion is on account of being taught a rudimentary way of determining the control limits. Which is the; mean + 3*(standarddeviation) = UCL and mean - 3*(SD) = LCL. Does qcc compute them in another way?

I'm just wondering if anyone can tell me why this is happening and whether there's a way around it?

The formula you describe refers to the standard deviation of the population not of the sample, to estimate the population standard deviation, assuming normality among the subgroups' mean, there are other formulas that make use of precalculated factors, very likely you would found tables for this factors at the end of your text book.

To illustrate what qcc does, I made one vector of 100 data points and assigned it into groups of either 5 or 10 measurements. The resulting xbar charts have very different control limits relative to the reported standard deviation.

library(qcc)
#> Warning: package 'qcc' was built under R version 3.5.3
#> Package 'qcc' version 2.7
#> Type 'citation("qcc")' for citing this R package in publications.
set.seed(899)
Dat <- rnorm(100, mean = 0, sd = 1)
Runs1 = rep(LETTERS[1:20], each = 5)
Runs2 = rep(letters[1:10], each = 10)

Mat1 <- qcc.groups(Dat, Runs1)
Mat2 <- qcc.groups(Dat, Runs2)

Out1 <- qcc(Mat1, type = "xbar") Out2 <- qcc(Mat2, type = "xbar") Created on 2019-09-22 by the reprex package (v0.2.1)

Here is the code for the limits.xbar() function of the qcc package.

> limits.xbar
function (center, std.dev, sizes, conf)
{
if (length(unique(sizes)) == 1)
sizes <- sizes
se.stats <- std.dev/sqrt(sizes)
if (conf >= 1) {
lcl <- center - conf * se.stats
ucl <- center + conf * se.stats
}
else {
if (conf > 0 & conf < 1) {
nsigmas <- qnorm(1 - (1 - conf)/2)
lcl <- center - nsigmas * se.stats
ucl <- center + nsigmas * se.stats
}
else stop("invalid 'conf' argument. See help.")
}
limits <- matrix(c(lcl, ucl), ncol = 2)
rownames(limits) <- rep("", length = nrow(limits))
colnames(limits) <- c("LCL", "UCL")
return(limits)
}
<bytecode: 0x0000000026f05960>
<environment: namespace:qcc>
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.