Shapiro-Wilk Test for Normality

DESCRIPTION:

Computes the Shapiro-Wilk W-statistic for testing for departures from normality.

USAGE:

shapiro.test(x) 

REQUIRED ARGUMENTS:

x
a numeric vector. Missing and infinite values are allowed, but are ignored in the calculation. The length of x must be less than 5000 after dropping nonfinite values.

VALUE:

an object of class "htest" representing the result of the Shapiro-Wilk normality test. This object has the following components:
statistic
the value of the test statistic.
p.value
the p-value for the test.
data.name
a character string describing the name of the data used in the test.
method
the name of the test applied (i.e., "Shapiro-Wilk Normality Test").

DETAILS:

The calculations for this test are based on the algorithm by Royston (1995).

BACKGROUND:

Shapiro and Wilk's W-statistic is a well-known goodness of fit test for the normal distribution. It is attractive because it has a simple, graphical interpretation: you can think of it as an approximate measure of the correlation in a normal quantile-quantile plot of the data.

REFERENCES:

Royston, P. (1995). A remark on algorithm AS 181: the W-test for normality. Applied Statistics 44: 547-551.

Shapiro, S.S. and Wilk, M.B. (1965). An analysis of variance test for normality (complete samples). Biometrika 52: 591-611.

SEE ALSO:

, , , , .

EXAMPLES:

# Should not be significant
shapiro.test(rnorm(30)) 

# Should be significant.
shapiro.test(runif(50))