# ===============================
# Example 1: g and h charts
# -------------------------------
# Refer to Kaminsky et al. (1992) and Table 2 of Park, et al. (2021).
tmp = c(
11, 2, 8, 2, 4, 1, 1, 11, 2, 1, 1, 7, 1, 1, 9,
5, 1, 3, 6, 5, 13, 2, 3, 3, 4, 3, 2, 6, 1, 5,
2, 2, 8, 3, 1, 1, 3, 4, 6, 5, 2, 8, 1, 1, 4,
13, 10, 15, 5, 2, 3, 6, 1, 5, 8, 9, 1, 18, 3, 1,
3, 7, 14, 3, 1, 7, 7, 1, 8, 1, 4, 1, 6, 1, 1,
1, 14, 2, 3, 7, 19, 9, 7, 1, 8, 5, 1, 1, 6, 1,
9, 5, 6, 2, 2, 8, 15, 2, 3, 3, 4, 7, 11, 4, 6,
7, 5, 1, 14, 8, 3, 3, 5, 21,10, 11, 1, 6, 1, 2,
4, 1, 2, 11, 5, 3, 5, 4, 10, 3, 1, 4, 7, 3, 2,
3, 5, 4, 2, 3, 5, 1, 4, 11,17, 1, 13, 13, 2, 1)
data = matrix(tmp, byrow=TRUE, ncol=5)
# g chart with cdf (trimming) method.
# Print LCL, CL, UCL.
result = racc(data, gamma=0.9, type="g", location=1)
print(result)
# Summary of a control chart
summary(result)
plot(result, cex.text=0.8)
# h chart with MM (truncated geometric) method.
racc(data, gamma=0.9, type="h", location=1, gEstimator="MM")
# ===============================
# Example 2: g and h charts (unbalanced data)
# -------------------------------
x1 = c(11, 2, 8, 2, 4)
x2 = c(1, 1, 11, 2, 1)
x3 = c(1, 7, 1)
x4 = c(5, 1, 3, 6, 5)
x5 = c(13, 2, 3, 3)
x6 = c(3, 2, 6, 1, 5)
x7 = c(2, 2, 8, 3, 1)
x8 = c(1, 3, 4, 6, 5)
x9 = c(2, 8, 1, 1, 4)
data = list(x1, x2, x3, x4, x5, x6, x7, x8, x9)
result = racc(data, gamma=0.9, type="g", location=1, gEstimator="cdf", nk=5)
summary(result)
plot(result)
Run the code above in your browser using DataLab