# the PRC process for the first 30 data points in the third application in
# "Design and properties of the Predictive Ratio Cusum (PRC) control charts"
### HISTORICAL DATA (FIRST BATCH)
HD <- c( 3, 3, 1, 5, 2, 1, 3, 3, 3, 0, 2, 1, 2, 1, 4, 1, 1, 0, 3, 2, 4, 6, 0, 1, 3, 2, 2, 4, 2, 1 )
### Bernoulli trials
nn <- 50
N0 <- length(HD)
NN0 <- rep(50, N0)
binom_PRC(data = HD, n = NN0)
# the PRC process for the last 10 data points in the third application in
# "Design and properties of the Predictive Ratio Cusum (PRC) control charts"
### prior parameters before the first batch
a0 <- 1/2
b0 <- 1/2
### posterior parameters after the first batch
ap <- sum(HD) + a0
bp <- sum(NN0) - sum(HD) + b0
hl = 4.332 # the decision limit is derived by the function binom_PRC_h
### CURRENT DATA (SECOND BATCH)
CD <- c(2, 4, 5, 2, 4, 8, 4, 4, 8, 5)
N <- length(CD)
NN <- rep(50, N)
binom_PRC(data = CD, n = NN, a0 = ap, b0 = bp, h = hl)
Run the code above in your browser using DataLab