shapiro.test {stats}R Documentation

Shapiro-Wilk Normality Test

Description

Performs the Shapiro-Wilk test of normality.

Usage

shapiro.test(x)

Arguments

x

a numeric vector of data values. Missing values are allowed, but the number of non-missing values must be between 3 and 5000.

Value

A list with class "htest" containing the following components:

statistic

the value of the Shapiro-Wilk statistic.

p.value

an approximate p-value for the test. This is said in ⁠Royston (1995) to be adequate for p.value < 0.1.

method

the character string "Shapiro-Wilk normality test".

data.name

a character string giving the name(s) of the data.

Source

The algorithm used is a C translation of the Fortran code described in ⁠Royston (1995). The calculation of the p value is exact for n = 3, otherwise approximations are used, separately for 4 \le n \le 11 and n \ge 12.

References

Royston JP (1982). “An Extension of Shapiro and Wilk’s W Test for Normality to Large Samples.” Applied Statistics, 31(2), 115. doi:10.2307/2347973.

Royston JP (1982). “Algorithm AS 181: The W Test for Normality.” Applied Statistics, 31(2), 176. doi:10.2307/2347986.

Royston P (1995). “Remark AS R94: A Remark on Algorithm AS 181: The W-test for Normality.” Applied Statistics, 44(4), 547. doi:10.2307/2986146.

See Also

qqnorm for producing a normal quantile-quantile plot.

Examples

shapiro.test(rnorm(100, mean = 5, sd = 3))
shapiro.test(runif(100, min = 2, max = 4))

[Package stats version 4.6.0 Index]