- x-bar and R charts for Question 5
library(qcc)
## Package 'qcc', version 2.6
## Type 'citation("qcc")' for citing this R package in publications.
#x-Bar
Q5x=c(476,488,482,498,473,484,482,496,478,484,476,485,490,475,474)
xbarchart = qcc(Q5x, type="xbar.one", limits = c(469.12,498.16), restore.par=FALSE)

#Range
r=c(32,24,26,25,24,24,22,23,25,24,25,29,25,22,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
Q5r <- matrix(cbind(r[1:15], r[16:30]), ncol=2)
rchart = qcc(Q5r, type="R", center = 25.16, limits = c(0,53.19))

- p Chart for Question 4
library(qcc)
par(mfrow=c(1,1))
Q4 = c(3,1,0,0,0,2,0,2,1,0,1,2,0,3,1,3,0,1,2,0,4,0,0,1,0)
units = c(15,15,15,15,15,17,17,17,17,17,15,15,15,15,15,17,17,17,17,17,15,15,15,15,15)
pchart = qcc(Q4, sizes = units, type = 'p', center = 0.068, limits = c(0,0.258))

- Based on the definition of process capability indices, draw the schematic diagrams showing the relationship of standard deviation and the specification limits with the following Cp and Cpk values: (refer to lecture)
- Cp=2.00, Cpk=2.00
- Cp=2.00, Cpk=1.33
- Cp=1.33, Cpk=1.00

- Type B OC curve for Question 1
x <- seq(0,1,0.001)
plot(x, pbinom(2, 10, x),xlim = c(0,0.31), ylim = c(0.4,1), type = 'l',
xlab = 'Fraction nonconforming (p)',
ylab = expression('Probability of acceptance' (p[a])))
points(0.01,pbinom(2,10,0.01))
