To create an ARL table for an X-bar chart, we do the following. Consider as an example a process with a mean of 10, standard deviation of 1, and subgroup size of 9.
ARL<-function(mu_0,mu_1,sigma_0,n){
UCL<-mu_0+3*sigma_0/sqrt(n)
LCL<-mu_0-3*sigma_0/sqrt(n)
beta<-pnorm(q=UCL,mean=mu_1,sd=sigma_0/sqrt(n))-pnorm(q=LCL,mean=mu_1,sd=sigma_0/sqrt(n))
1/(1-beta)
}
Define a table of ARLs for an in-control mean of \(\mu_o=10\), \(\sigma_o=1\), and \(n=9\).
vals<-c(9.2,9.4,9.6,9.8,10,10.2,10.4,10.6,10.8)
df<-data.frame(vals,ARL(10,vals,1,9))
colnames(df)<-c("mu","ARL")
#use kable() to make the table output "pretty"
kable(df,caption = "ARL Table for X-Bar Chart with mu_o=10",align=c("c","c"),digits=2) %>% kable_styling(full_width=T,"striped") %>% row_spec(5, bold=TRUE)
| mu | ARL |
|---|---|
| 9.2 | 3.65 |
| 9.4 | 8.69 |
| 9.6 | 27.82 |
| 9.8 | 119.67 |
| 10.0 | 370.40 |
| 10.2 | 119.67 |
| 10.4 | 27.82 |
| 10.6 | 8.69 |
| 10.8 | 3.65 |
This is a plot the ARLs from \(\mu_1=9\) to \(\mu_1=11\).
vals<-seq(9,11,.01)
plot(vals,ARL(mu_0=10,vals,sigma_0=1,n=9),
type="l",main="ARL Plot for X-Bar Chart with n=9 and mu_0=10",
xlab="mu_1",
ylab="Avg Number of Subgroups to Signal Out-of-Control")
abline(v=10,lty=2)
Generate some sample data from a Normal(10,1) distribution. Arrange into \(m=20\) subgroups of size \(n=5\). Create \(\bar{X}\) chart.
testdat<-rnorm(100,10,1) #generate 100 random variates from a Normal(10,1) distribution
testmatrix<-matrix(testdat,20,5) #put into a matrix representing m=20 subgroups of size n=5
qcc(testmatrix, type = "xbar", title = "X-bar Chart")
## List of 11
## $ call : language qcc(data = testmatrix, type = "xbar", title = "X-bar Chart")
## $ type : chr "xbar"
## $ data.name : chr "testmatrix"
## $ data : num [1:20, 1:5] 10.58 10.97 9.27 9.5 10.06 ...
## ..- attr(*, "dimnames")=List of 2
## $ statistics: Named num [1:20] 10.91 9.93 10.03 10.19 9.79 ...
## ..- attr(*, "names")= chr [1:20] "1" "2" "3" "4" ...
## $ sizes : int [1:20] 5 5 5 5 5 5 5 5 5 5 ...
## $ center : num 9.92
## $ std.dev : num 1.11
## $ nsigmas : num 3
## $ limits : num [1, 1:2] 8.44 11.41
## ..- attr(*, "dimnames")=List of 2
## $ violations:List of 2
## - attr(*, "class")= chr "qcc"
Generate and ARL table for an np-chart
ARL<-function(p_0,p_1,n){
UCL<-n*p_0+3*sqrt(n*p_0*(1-p_0))
LCL<-n*p_0-3*sqrt(n*p_0*(1-p_0))
if(LCL<0) beta=pbinom(UCL,n,p_1) else beta=pbinom(UCL,n,p_1)-pbinom(LCL,n,p_1)
1/(1-beta)
}
Define a table of ARLs for subgroup sizes of \(n=100\) and an in-control proportion of defects being \(p_0=0.02\).
vals<-c(0.005,0.01,0.015,0.02,0.025,0.03,0.035,0.04)
df<-data.frame(vals,ARL(.02,vals,100))
colnames(df)<-c("p_0","ARL")
#use kable() to make the table output "pretty"
kable(df,caption = "ARL Table for np-chart with $p_o=.02$. Note that chart cannot detect downward shifts since the LCL=0, which correspondings entries are greyed out. The in-control ARL is in red.",align=c("c","c"),digits=3) %>% kable_styling(full_width=T,"striped") %>% row_spec(4, col="red") %>% row_spec(1:3,col="grey")
| p_0 | ARL |
|---|---|
| 0.005 | 1200586.272 |
| 0.010 | 14067.930 |
| 0.015 | 1233.277 |
| 0.020 | 246.181 |
| 0.025 | 77.056 |
| 0.030 | 32.023 |
| 0.035 | 16.166 |
| 0.040 | 9.399 |
This is a plot the ARLs from \(p_0=.02\) to \(p_1=.05\).
vals<-seq(.02,.05,.001)
plot(vals,ARL(p_0=.02,vals,n=100),
type="l",main="ARL Plot for np-chart with n=100 and p_0=.02",
xlab="p_1",
ylab="Avg Number of Subgroups to Signal Out-of-Control")
Generate and ARL table for a c-chart
ARL<-function(lambda_0,lambda_1){
UCL<-lambda_0+3*sqrt(lambda_0)
LCL<-lambda_0-3*sqrt(lambda_0)
if(LCL<0) beta=ppois(UCL,lambda_1) else beta=ppois(UCL,lambda_1)-ppois(LCL,lambda_1)
1/(1-beta)
}
Define a table of ARLs with an in-control rate of defect being \(\lambda_0=4\).
vals<-c(2,2.5,3,3.5,4,4.5,5,5.5,6)
df<-data.frame(vals,ARL(4,vals))
colnames(df)<-c("lambda_0","ARL")
#use kable() to make the table output "pretty"
kable(df,caption = "ARL Table for c-chart with lambda_0=4. Note that chart cannot detect downward shifts since the LCL=0, which correspondings entries are greyed out. The in-control ARL is in red.",align=c("c","c"),digits=3) %>% kable_styling(full_width=T,"striped") %>% row_spec(5, col="red") %>% row_spec(1:4,col="grey")
| lambda_0 | ARL |
|---|---|
| 2.0 | 120362.662 |
| 2.5 | 16226.678 |
| 3.0 | 3420.710 |
| 3.5 | 980.975 |
| 4.0 | 352.142 |
| 4.5 | 149.955 |
| 5.0 | 73.018 |
| 5.5 | 39.602 |
| 6.0 | 23.463 |
This is a plot the ARLs from \(\lambda_0=4\) to \(\lambda_1=6\).
vals<-seq(4,6,.01)
plot(vals,ARL(4,vals),
type="l",main="ARL Plot for c-chart with lambda_0=4",
xlab="lambda_1",
ylab="Avg Number of Subgroups to Signal Out-of-Control")