[R] Limited number of replicates in qcc()?
Katrien Baert
Katrien.Baert at UGent.be
Thu Aug 13 14:49:08 CEST 2009
Dear R-users,
I'm encoutering some problems with the qcc()-function. When there are
more than 25 replicates per "sample" the estimate for the standard
deviation becomes NA, implying that nothing is plotted (error message:
"Error in plot.window(...) : need finite 'ylim' values")
On the forum I found a way to work around the error message, but this
does not really solve the problem since the chart does not have control
limits. The code below might make things clear.
> data <- matrix(ncol = 30, nrow = 4)
> for(i in 1:4){
+ data[i,] <- rnorm(30)
+ }
> obj <- qcc(data, type = "xbar")
Error in plot.window(...) : need finite 'ylim' values
> obj <- qcc(data, type = "xbar", ylim = c(-1, 1))
> obj <- qcc(data[, 1:25], type = "xbar")
In the source code I find this part that calculates the standard
deviation, and I don't see where the restriction to 25 replicates in
implemented:
if (missing(std.dev)) {
if (type == "xbar")
std.dev <- "UWAVE-R"
else if (type == "R")
std.dev <- "UWAVE-R"
else if (type == "S")
std.dev <- "UWAVE-SD"
else std.dev <- NULL
std.dev <- do.call(sd, list(data, sizes, std.dev))
}
else {
if (is.character(std.dev)) {
std.dev <- do.call(sd, list(data, sizes, std.dev))
}
else {
if (!is.numeric(std.dev))
stop("if provided the argument 'std.dev' must be a
method available or a numerical value. See help(qcc).")
}
}
I do not really see what this do.call()-function does and what is the
function of "UWAVE-R".
Is there a reason to restrict to 25 replicates? If not, how could I
change the function such that the standard deviation is correctly estimated?
With kind regards,
Katrien
--
Katrien Baert
Statistical Consultant
IOF valorisatieconsortium Stat-Gent
T 32 9 264 47 66
http://www.statgent.org/
More information about the R-help
mailing list