Shapiro-Wilk Test for Normality

The Shapiro-Wilk test, which is denoted by W, is a test of whether a data set has been drawn from an underlying normal distribution. The null and alternative hypotheses being tested are

\( H_0 \): The data have been drawn from a normal distribution

\( H_a \): The data are drawn from a non-normal distribution

The test is conducted as follows (from Gilbert 1987, pp. 158-160).

  1. Compute: \( \large \quad d = \displaystyle\sum_{i=1}^n (x_i - \bar x)^2 \)

  2. Order the \(n\) data from smallest to largest to obtain the sample order statistics: \( \quad x_{[1]} \leq x_{[2]} \leq \dotsb \leq x_{[n]} \)

  1. Compute \(k\), where

            \( k = \frac{n}{2} \) if n is even

            \( k = \frac{n-1}{2} \) if n is odd

4. Find coefficients \( a_1 , a_2 , a_3 , \dotsb , a_k \) from Table A6 in Gilbert (1987, pages 259-260).

5. Compute: \( \large W = \frac{1}{d} \left[ \displaystyle\sum_{i=1}^k a_i ( x_{[n-i+1]} - x_i ) \right]^2 \)

6. Reject \( H_0 \) and accept \( H_a \) at the \( \alpha \) significance level if \(W\) is less than the appropriate percentile, \( W_{\alpha} \), of the W statistic given in Table A7 of Gilbert (1987, page 261).

Test provided courtesy of ProUCL.

References:

Gilbert, R.O. 1987. Statistical Methods for Environmental Pollution Monitoring, Wiley, NY.

ProUCL. 2004. ProUCL Version 3.0 User Guide April 2004. Available for download from http://www.epa.gov/nerlesd1/tsc/tsc.htm