Tom Hopper wrote: >The problem is the (apparent?) inability to produce moving range process >behavior (a.k.a. "control") charts with individuals data in the package >"qcc" (v. 2.0). I have also struggled with the same limitation in package >"IQCC" (v. 1.0).
The moving range chart has the same control limit factors (viz., D3, D4) as the range chart, so one should be able to feed an appropriately-constructed matrix into qcc(type = "R"). In other words, if one can transform the original individual observations 1..m into 1..(m - 1) rational subgroups of size two so that the range of the rational subgroup i equals the moving range of the individual observations i and i+1, it'll fool qcc's range chart into plotting the moving ranges (MR) as the range (R), computing the center line as the average MR instead of the average R, and computing the control limits as D3*MR and D4*MR instead of D3*R and D4*R. My solution for qcc, using Montgomery's viscosity data in "viscosity.txt": batch viscosity phase 1 34.05 setup 2 34.40 setup 3 33.59 setup ... observations <- read.table("viscosity.txt", TRUE) require(qcc) attach(observations) # identify "observation" and "batch" columns as providing the # observations and unit numbers observation <- qcc.groups(viscosity, batch) # number of batches in phase I ("setup") m <- length(phase[phase == "setup"]) # extract the batch numbers to display for the phase II ("monitoring") data setupBatches <- as.character(batch[phase == "setup"]) monitoringBatches <- as.character(batch[phase == "monitoring"]) # plot xbar chart obj <- qcc(data = observation[1,1:m], type = "xbar.one", newdata = observation[1,-(1:m)], labels = setupBatches, newlabels = monitoringBatches, axes.las = 3, chart.all = TRUE, title = "Individuals chart for aircraft primer paint viscosity", xlab = "Batch", ylab = "Value (viscosity units)") setupBatches <- setupBatches[-1] numberOfBatches <- length(observation) # intermediate matrix to coax qcc into plotting a moving range chart # # observations x[i], x[i + 1] appear in adjacentObservations[i] # whose range equals the moving range |x[[i]] - x[[i + 1]]| # adjacentObservations <- matrix(nrow = length(observation) - 1, ncol = 2) adjacentObservations[,1] <- observation[1,1:numberOfBatches - 1]; adjacentObservations[,2] <- observation[1,2:numberOfBatches]; # plot MR chart obj <- qcc(data = adjacentObservations[1:m - 1,], type = "R", newdata = adjacentObservations[-(1:m - 1),], labels = setupBatches, newlabels = monitoringBatches, axes.las = 3, chart.all = TRUE, title = "MR chart for aircraft primer paint viscosity", xlab = "Batch", ylab = "Moving range (viscosity units)") ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.