R Programming Language Certification Quality Control & Assurance 4 — Questions and Answers
Question 1: In R, the `ewma()` function in the `qcc` package requires specifying which key parameter that controls the weighting of recent vs. historical data?
- lambda (Correct answer)
- alpha
- k
- span
Correct answer: lambda
The `lambda` parameter (0 < λ ≤ 1) in an EWMA chart controls how quickly older observations are discounted; smaller values give more weight to historical data.
Question 2: When assessing normality of residuals in an R-based quality study, which test is most appropriate for small samples (n < 50)?
- Shapiro-Wilk test via shapiro.test() (Correct answer)
- Kolmogorov-Smirnov test via ks.test()
- Anderson-Darling test via ad.test()
- Chi-squared goodness-of-fit test
Correct answer: Shapiro-Wilk test via shapiro.test()
`shapiro.test()` implements the Shapiro-Wilk test, which has the best power for detecting non-normality in small samples (n = 3 to 5000).
Question 3: In a Gauge R&R study conducted in R, 'reproducibility' specifically measures variation due to:
- Different operators measuring the same parts (Correct answer)
- The same operator measuring the same part repeatedly
- Part-to-part variation in the manufacturing process
- Calibration drift of the measurement instrument
Correct answer: Different operators measuring the same parts
Reproducibility captures the variation that occurs when different operators (or conditions) measure the same parts, while repeatability captures the within-operator variation.
Question 4: Which R function from base R computes the range of each row in a matrix of subgroup observations, used in Xbar-R chart calculations?
- apply(data, 1, function(x) diff(range(x))) (Correct answer)
- rowRanges(data)
- rangeByRow(data)
- subgroup.range(data)
Correct answer: apply(data, 1, function(x) diff(range(x)))
`apply()` with MARGIN=1 and a range-diff function computes the range for each subgroup row when building manual Xbar-R charts in base R.
Question 5: In R's `qcc` package, what happens when you set `plot=FALSE` in a `qcc()` call?
- The control chart object is returned without displaying a plot (Correct answer)
- The function returns only the summary statistics as a list
- An error is thrown because plotting is mandatory
- The function uses text-based output instead of graphics
Correct answer: The control chart object is returned without displaying a plot
Setting `plot=FALSE` suppresses the graphical output but still returns the full `qcc` object with all computed statistics, limits, and violations.
Question 6: What is the R command to extract the upper control limit (UCL) from an existing `qcc` object named `chart`?
- chart$limits[, 'UCL'] (Correct answer)
- chart$UCL
- UCL(chart)
- getUCL(chart)
Correct answer: chart$limits[, 'UCL']
The `qcc` object stores control limits in a `$limits` matrix with columns named 'LCL' and 'UCL', accessed via standard R matrix indexing.
Question 7: In R, which approach correctly performs a one-sample proportion test to check if a defect rate meets a quality target of 2%?
- prop.test(defects, n, p=0.02)
- t.test(defects/n, mu=0.02)
- binom.test(defects, n, p=0.02)
- Both A and C are correct (Correct answer)
Correct answer: Both A and C are correct
Both `prop.test()` (large-sample normal approximation) and `binom.test()` (exact binomial) test whether an observed proportion equals a target; choice depends on sample size.
In R, the `ewma()` function in the `qcc` package requires specifying which key parameter that controls the weighting of recent vs. historical data?