This regards an old post that posed the question: Tom Hodgess 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 package "qAnalyst" (v. 0.6.0) provides an option to produce a moving range chart with individuals data. " [It does, but the look of the qAnalyst chart is very different from the qcc chart, and the qcc charts generally provide more information.] To which Filthy McNasty replied [on 16 Jan 2010]: ----- 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)") ----- For the life of me, I can't get the above to work. I use "qcc" in a production environment, and Xmr charts would be valuable to have, and they should look like the charts produced by qcc. Here is my work around [note, I am not a programmer. I'm sure it is ugly, and there are no doubt more elegant ways to do this.] temp.data looks like this [lot number and value. Lot number header left off for other manipulations, lot numbers needed for some manipulations and not others. Adjacent data (see below) does not need lot numbers]: pH 08-10538 7.6 08-11736 7.5 08-12453 8.1 08-12557 7.9 08-13202 7.4 # read table, with header z<-read.table('temp.data',1) # create 'group' column, populate with sequence of integers z2<-cbind(z, group=seq(1,length(z[,1]),1)) # use length(z[,1]) -1 units of data to create adjacent data z3<-rbind(z2, c(z2[-1,])) # renumber the adjacent data's groups z3[(length(z[,1]) + 1):(length(z3[,1])),2] <- z3[(length(z[,1]) + 1): (length(z3[,1])),2] - 1 # remove the last member of the initial data, so the groups all have # two values z4<-z3[-(length(z[,1])),] # now group with qcc obj<-qcc.groups(z4$pH, z4$group) # now plot using the R graph function of qcc xmr<-qcc(obj, type="R", title="Xmr Chart") I've checked it against my manual calculations, and it seems to work the way I want it. If you're trying to produce Xmr charts with "qcc", this is one example of how to do it. -- jim smith <n0oct at sbcglobal.net>