# Calculation of optimal parameters of the percentile-based control charts
#using "pbcc"" package.
# Set the maximum possible sample size in each h units is 10.
nmax=10
# Set the process in-control time to signal is at least 100 samples.
T1=100
# Set the control chart time to signal is at most 1 samples
# when shift occur in the process mean or/and std.dev.
T2=3
# Set the sampling intersample intervals to 0.5(0.5) T2 units of time.
hv=seq(0.5, T2, by=0.5)
#Set the lower and upper bounds of parameters(n and h) used in the optimization.
mat=matrix(c(2, nmax, 1, length(hv)), 2,2, byrow=TRUE)
p1=0.05 # Set the probability of guaranteed in-control signals is 5%.
p2=0.05 # Set the probability of guaranteed out-of-control signals is 5%.
# Optimal parameters of two-sided percentile-based Xbar control chart.
d=3 # Set the shift size in the process mean is 3 (large shift).
Q1<- odpbc(nmax, T1, T2, hv, mat, p1, p2, d, delta=1.5, type= "Xbar")
# Optimal parameters of one-sided percentile-based variance control chart.
delta=2 # Set the shift size in the process dispersion is 2 (moderate shift).
Q2<- odpbc(nmax, T1, T2, hv, mat, p1, p2, d=1.0, delta, type= "S2", sided="one")
#Optimal parameters of two-sided percentile-based joint Xbar& S control chart.
d=1.0 # Set the shift size in the process mean is 1 (small shift).
delta=2 # Set the shift size in the process dispersion is 2 (moderate shift).
Q3<- odpbc(nmax, T1, T2, hv, mat, p1, p2, d, delta, type= "Xbar-S")
Run the code above in your browser using DataLab