<< ST_ivplot Distribution-Tests Outlier-Tests >>

samplestat >> samplestat > Distribution-Tests > ST_shapirowilk

ST_shapirowilk

Shapiro-Wilk test of normality

Syntax

[normal] = ST_shapirowilk(v, p)
[normal, W] = ST_shapirowilk(v, p)

Arguments

v:

m-by-1 or 1-by-n matrix of doubles

p:

statistical confidence level (%) as a string or the level of significance (alpha) as a decimal value, "90%", "95%", "99%" or 0.1, 0.05, 0.01 resp. (see examples).

normal:

Returns %T if the null hypothesis of normality is not rejected, otherwise %F.

W:

Shapiro-Wilk W test statistic (optional second output).

Description

The Shapiro-Wilk test is a statistical significance test that tests the hypothesis that the underlying population of a sample is normally distributed.

The Shapiro-Wilk test exhibiting high power, leading to good results even with a small number of observations. In contrast to other comparison tests the Shapiro-Wilk test is only applicable to check for normality.

The test can be used for sample sizes from 3 to 50 values. It returns a boolean (%T or %F) whether the dataset is normally distributed or not and as a second return value (W) the test statistic. The value W is particularly useful because it allows to see exactly how well or poorly a dataset passes or fails the normality test, rather than just seeing %T or %F.

The theory behind Shapiro-Wilk can be find at Distribution Overview.

The test reacts very sensitively to outliers, both for one-sided and two-sided ones. Outliers can strongly distort the distribution pattern so that the normal distribution assumption could be erroneously rejected.

The test is relatively susceptible to Ties, i.e. if there are many identical values, the test strength is strongly affected.

Although the Shapiro-Wilk test has a big test strength, especially for smaller sample sizes, it should not be used blindfolded for the reasons mentioned above.

Check the results graphically with individual value plot, histogram, QQ-plot or box-plot. The latter two are provided in the toolbox STIXBOX.

Examples

scf();
data1 = [200, 545, 290, 165, 190, 355, 185, 205, 175, 255];
normal = ST_shapirowilk(data1, "95%") // normal = %F => non-normally distr.
ST_ivplot(data1,"data1");
scf();
data2 = [-15.6, -21.6, -19.5, -19.1, -20.9, -20.7, -19.3, -18.3, -15.1];
normal = ST_shapirowilk(data2, "95%") // normal = %T => normally distributed
ST_ivplot(data2,"data2");

See also

Authors

Bibliography

Shapiro, S.S. & Wilk, M.B. (1965). An Analysis of Variance Test for Normality (Complete Samples). Biometrika 52(3/4), 591-611.


Report an issue
<< ST_ivplot Distribution-Tests Outlier-Tests >>