How to change the rule set in the qcc R package for Control Charts / Statistical Process Control

17 Views Asked by At

This question is related to this one:

Implementing additional standard run rules with R and qcc

The user MS Berends was kind enough to provide the functions to the new rules. One example:

nelsonr1 <- function(x, m = mean(x), s = sd(x)) {
    # Nelson's QC rule 1: detect values outside + or -3 sd
    which(abs((x - m) / s) >= 3)
}

But how do I actually use this rule? Do I need to change the code in the library? If not, how to properly call the function "inside" R?

I pasted the function, ran the code block and tried to call it inside the qcc command like this:

qcc(df$data, sample_size, type = "u", rules = nelsonr1(df$data))

It completes the plot, but nothing is marked in the chart graph. The violating point (+3 sd) is supposed to change color but it does not.

Does anyone know the way to implement those functions correctly?

0

There are 0 best solutions below