anhoej / spc4hc

Mastering statistical process control charts - A practical guide for data scientists
1 stars 0 forks source link

improved c-chart code and reference - #3

Open ProfMohammed opened 3 months ago

ProfMohammed commented 3 months ago

To cite this article: Rudolf G. Kittlitz Jr. (2006) Calculating the (Almost) Exact Control Limits for #a C-Chart, Quality Engineering, 18:3, 359-366, DOI: 10.1080/08982110600719472

To link to this article: https://doi.org/10.1080/08982110600719472

you can copy and paste the codesnip below -

set.seed(91) y <- rpois(100,10) c_bar <-mean(y)

lcl <- ((c_bar+1/12)^(2/3) - 3(2/3)(c_bar)^(1/6))^(3/2)+1/4 ucl <- ((c_bar+1/12)^(2/3) + 3(2/3)(c_bar)^(1/6))^(3/2)-3/4

print(c(c_bar,lcl,ucl)) plot(y, type='b', ylim=c(1,25)) abline(h=c(c_bar,lcl,ucl), col='blue')

anhoej commented 3 months ago

Interesting. Improved code:

set.seed(91)
y <- rpois(100,10)
c_bar <-mean(y)

lcl <- ((c_bar + 1 / 12)^(2 / 3) - 3  *  (2 / 3)*(c_bar)^(1 / 6))^(3 / 2) + 1 / 4
ucl <- ((c_bar + 1 / 12)^(2 / 3) + 3 * (2 / 3) * (c_bar)^(1 / 6))^(3 / 2) - 3 / 4

print(c(c_bar,lcl,ucl))
plot(y, type='b', ylim=c(1,25))
abline(h=c(c_bar,lcl,ucl), col='blue')
qicharts2::qic(y, chart = 'c')
anhoej commented 3 months ago

How does this work for C charts with very large numbers? I often find that in such cases, the control limits become "too" narrow and the I chart may be more correct.

ProfMohammed commented 3 months ago

This is exactly the kind of thing our technical notes section should discuss. The limitations of each chart and what we advise folks to do when they are at the limits - ie switch to i-chart. Your skill with simulation may be particualrly useful here. I wonder if we might have a chapter on "how to stress test a chart using simulation"...?