.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Statistics::Normality 3pm" .TH Statistics::Normality 3pm "2016-09-14" "perl v5.22.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Statistics::Normality \- test whether an empirical distribution can be taken as being drawn from a normally\-distributed population .SH "VERSION" .IX Header "VERSION" Version 0.01 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Statistics::Normality \*(Aq:all\*(Aq; \& use Statistics::Normality \*(Aqshapiro_wilk_test\*(Aq; \& use Statistics::Normality \*(Aqdagostino_k_square_test\*(Aq; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Various situations call for testing whether an empirical sample can be presumed to have been drawn from a normally (Gaussian ) distributed population, especially because many downstream significance tests depend upon the assumption of normality. This package implements some of the more well-known tests from the mathematical statistics literature, though there are also others that are not included. The tests here are all so-called \fIomnibus\fR tests that find departures from normality on the basis of skewness and/or kurtosis [Dagostino71]. Note that, although the Kolmogorov-Smirnov test can also be used in this capacity, it is a \&\fIdistance\fR test and therefore not advisable [Dagostino71]. This, and other distance tests (e.g. Chi-square) are not implemented here. .SH "TESTS" .IX Header "TESTS" The subtleties and esoterica of various statistical tests for normality require some familiarity with the mathematical statistics literature. We give rules-of-thumb for specific tests, where they exist, but it may be advisable to try several different tests to check the consistency of the conclusion. It is probably also a good idea to check results graphically, either by direct plotting or by a Q\-Q plot . In general, small samples will often pass a normality test suggesting the \fIpossibility\fR that there is insufficient information to detect departure from normal for such cases, should it exist. .PP Each of the methods here is a frequentist test, i.e. one that tests against the null-hypothesis that the sample is normal. In other words, a low p\-value recommends rejecting the null. .SH "EXPORT" .IX Header "EXPORT" A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module. .SS "Shapiro-Wilk Test" .IX Subsection "Shapiro-Wilk Test" The Shapiro-Wilk W\-Statistic test [Shapiro65] is considered to be among the most objective tests of normality [Royston92] and also one of the most powerful ones for detecting non-normality [Chen71]. Its statistic is essentially the roughly best unbiased estimator of population standard deviation to the sample variance [Dagostino71]. The test is mathematically complex and most implementations use several conventional approximations (as we do here), including Blom's formula for the expected value of the order statistics [Harter61] and transformation to standard normal distribution for evaluation, especially for large samples [Royston92]. .PP .Vb 2 \& $pval = shapiro_wilk_test ([0.34, \-0.2, 0.8, ...]); \& ($pval, $w_statistic) = shapiro_wilk_test ([0.34, \-0.2, 0.8, ...]); .Ve .PP This test may not be the best if there are many repeated values in the test distribution or when the number of points in the test distribution is very large, e.g. more than 5000. The routine will carp about the latter, but not the former. This particular implementation of the test also requires at least 6 data points in the sample distribution and will croak otherwise. .SS "D'Agostino K\-Squared Test" .IX Subsection "D'Agostino K-Squared Test" The D'Agostino K\-Squared test is a good test against non-normality arising from kurtosis and/or skewness [Dagostino90]. .PP .Vb 2 \& $pval = dagostino_k_square_test ([0.34, \-0.2, ...]); \& ($pval, $ksq_statistic) = dagostino_k_square_test ([0.34, \-0.2, ...]); .Ve .PP The test statistic depends upon both the sample kurtosis and skewness, as well as the moments of these parameters from a normal population, as quantified by Pearson's coefficients [Pearson31]. These are transformed [Dagostino70,Anscombe83] to expressions that sum to the K\-squared statistic, which is essentially chi-square-distributed with 2 degrees of freedom [Dagostino90]. The kurtosis transform, and thus the overall test, generally works best when the sample distribution has at least 20 data points [Anscombe83] and the routine will carp otherwise. .SH "REFERENCES" .IX Header "REFERENCES" .IP "\(bu" 4 [Anscombe83] Anscombe, F. J. and Glynn, W. J. (1983) \&\fIDistribution of the Kurtosis Statistic B2 for Normal Samples\fR, Biometrika \fB70\fR(1), 227\-234. .IP "\(bu" 4 [Chen71] Chen, E. H. (1971) \&\fIThe Power of the Shapiro-Wilk W Test for Normality in Samples from Contaminated Normal Distributions\fR, Journal of the American Statistical Association \fB66\fR(336), 760\-762. .IP "\(bu" 4 [Dagostino70] D'Agostino, R. B. (1970) \&\fITransformation to Normality of the Null Distribution of G1\fR, Biometrika \fB57\fR(3), 679\-681. .IP "\(bu" 4 [Dagostino71] D'Agostino, R. B. (1971) \&\fIAn Omnibus Test of Normality for Moderate and Large Size Samples\fR, Biometrika \fB58\fR(2), 341\-348. .IP "\(bu" 4 [Dagostino90] D'Agostino, R. B. et al. (1990) \&\fIA Suggestion for Using Powerful and Informative Tests of Normality\fR, American Statistician \fB44\fR(4), 316\-321. .IP "\(bu" 4 [Harter61] Harter, H. L. (1961) \&\fIExpected values of normal order statistics\fR, Biometrika \fB48\fR(1/2), 151\-165. .IP "\(bu" 4 [Pearson31] Pearson, E. S. (1931) \&\fINotes on Tests for Normality\fR, Biometrika \fB22\fR(3/4), 423\-424. .IP "\(bu" 4 [Royston92] Royston, J. P. (1992) \&\fIApproximating the Shapiro-Wilk W\-test for non-normality\fR, Statistics and Computing \fB2\fR(3) 117\-119. .IP "\(bu" 4 [Shapiro65] Shapiro, S. S. and Wilk, M. B. (1965) \&\fIAn analysis of variance test for normality \- complete samp1es\fR, Biometrika \fB52\fR(3/4), 591\-611. .SH "AUTHOR" .IX Header "AUTHOR" Mike Wendl, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-statistics\-normality at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Statistics::Normality .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright (C) 2011 Washington University .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place \- Suite 330, Boston, \s-1MA 02111\-1307, USA.\s0