Function dAgostinoK

A test for normality of the distribution of a range of values. Based on the assumption that normally distributed values will have a sample skewness and sample kurtosis very close to zero.

TestRes dAgostinoK(T) (
  T range
)
if (doubleIterable!T);

Returns

A TestRes with the K statistic, which is Chi-Square distributed with 2 degrees of freedom under the null, and the P-value for the alternative that the data has skewness and kurtosis not equal to zero against the null that skewness and kurtosis are near zero. A normal distribution always has skewness and kurtosis that converge to zero as sample size goes to infinity.

Notes

Contrary to popular belief, tests for normality should usually not be used to deterimine whether T-tests are valid. If the sample size is large, T-tests are valid regardless of the distribution due to the central limit theorem. If the sample size is small, a test for normality will likely not be very powerful, and a priori knowledge or simple inspection of the data is often a better idea.

References

D'Agostino, Ralph B., Albert Belanger, and Ralph B. D'Agostino, Jr. "A Suggestion for Using Powerful and Informative Tests of Normality", The American Statistician, Vol. 44, No. 4. (Nov., 1990), pp. 316-321.