Home / Shared Math Details / Shared Estimators and Tests / Shapiro-Wilk Test
Shapiro-Wilk Test¶
This page defines the Shapiro-Wilk normality test that Quantum XL uses. It is one of the selectable goodness-of-fit methods wherever a normality check is offered.
Notation¶
| Term | Description |
|---|---|
| \(n\) | number of data values |
| \(x_{(1)} \le x_{(2)} \le \cdots \le x_{(n)}\) | the data sorted in ascending order |
| \(\bar{x}\) | sample mean |
| \(a_i\) | Shapiro-Wilk coefficients from normal order statistics |
| \(W\) | Shapiro-Wilk statistic |
Test statistic¶
\(x_{(1)} \le \cdots \le x_{(n)}\) are the values sorted ascending and \(\bar{x}\) is their mean. The constants \(a_i\) are derived from the expected values and covariances of standard normal order statistics; Quantum XL computes them with Royston's Algorithm AS R94. \(W\) is close to \(1\) when the data follow a normal distribution.
p-value¶
The p-value comes from Royston's normalizing transformation. For \(n = 3\) the exact value \(p = \frac{6}{\pi}\left(\arcsin\sqrt{W} - \frac{\pi}{3}\right)\) is used. For \(4 \le n \le 11\) the statistic is transformed with \(y = -\ln\!\big(\gamma - \ln(1 - W)\big)\), and for \(n > 11\) with \(y = \ln(1 - W)\); in both cases \(y\) is standardized with sample-size-dependent mean and standard deviation polynomials, and the p-value is the upper tail of the standard normal distribution for the resulting \(z\).
Used by¶
- Summary Statistics: the normality-test section.
- Cpk/Histogram Math Details: the selectable goodness-of-fit method.
See Also¶
References¶
- Shapiro, S. S., and Wilk, M. B. (1965). An analysis of variance test for normality (complete samples). Biometrika, 52(3/4), 591-611.
- Royston, P. (1995). Remark AS R94: A remark on Algorithm AS 181: The W-test for normality. Journal of the Royal Statistical Society: Series C (Applied Statistics), 44(4), 547-551.
- Royston, P. (1992). Approximating the Shapiro-Wilk W-test for non-normality. Statistics and Computing, 2(3), 117-119.