rqcccontrol-charts

How does it works the argument run.length of the fuction qcc.options


I've been trying to understand what is the real use of this argument. In the qcc documentation it writes "the maximum value of a run before to signal a point as out of control" but that concept really confuses me. I have notice that default value is 7 and when i increase that value the violating points diminish, and in the other way, when i use a value as 1 for example all points transform in violations. Here is the code I'm writing with its respective Range control chart:

library("qcc")
attach(Schart1)

datapch<-data.frame(Replica_1,Replica_2,Replica_3,Replica_4,Replica_5)
head(datapch)

#-------------------------------------------#
#Pruebas para la función qcc.options#
#-------------------------------------------#
qcc.options()
qcc.options(se.R.unscaled=c())
qcc.options(bg.figure="yellow", bg.margin="yellow")
qcc.options(cex.stats=c(1),font.stats=2)
qcc.options("violating.runs" = list(pch = 16, col = "purple",bg="purple"))
qcc.options("beyond.limits" = list(pch = 25, col = "red"))
qcc.options(cex=0.9)
qcc.options(run.length=7)

pitch<-qcc(datapch,type enter code here= "xbar")
qcc(datapch,type = "R")
qcc.options(old)

enter image description here


Solution

  • This is more of a quality engineering question than an R question so possibly not suited for this forum. Is this forum more suited? Nevertheless, I can explain it to you. The run length indicates the number of consecutive points in your control chart that are above or below the centre line. This one of the Western Electric rules (e.g. see here, rule nr 4) that help to detect out-of-control events in your control charts.

    For instance, if I plot the R chart from the example from the qcc quick tour I can vary the run length and demonstrate what it does. With:

    library(qcc) # using qcc version 2.7
    data(pistonrings)
    diameter = with(pistonrings, qcc.groups(diameter, sample))
    

    and:

    q2 = qcc(diameter[1:25,], type="R")
    qcc.options(run.length = 7)
    

    We get this plot:

    enter image description here

    There are no out of control points because there are no sequences of length 7 or more above or below the centre line. But if I reduce run length to 5, we can see that the R chart flags one out-of-control point: the 5th point below the centre line in a sequence:

    qcc.options(run.length = 5)
    q2 = qcc(diameter[1:25,], type="R")
    

    enter image description here

    If you further reduce the run length, the control chart will flag more out-of-control points:

    qcc.options(run.length = 3)
    q2 = qcc(diameter[1:25,], type="R")
    

    Now we will flag each sequence of 3 or more points below or above the centre line. And there are now two sequences that qualify:

    enter image description here

    It should be obvious to you now that if you set qcc.options(run.length = 1) that the control chart will flag each data point to be out-of-control.