dagostinoPearsonTest
Performs the D'Agostino-Pearson omnibus normality test.
The null hypothesis is that sample was drawn from a normal distribution. The test combines D'Agostino's skewness test (1970) and Anscombe & Glynn's kurtosis test (1983) into a single chi-squared statistic K² = Z₁² + Z₂² with 2 degrees of freedom. This is equivalent to scipy's normaltest(). Complements shapiroWilkTest and andersonDarlingTest for assessing normality.
If all values are identical (zero variance), returns K² = 0.0 and p-value = 1.0.
Example:
val data = doubleArrayOf(-1.2, -0.5, 0.1, 0.3, 0.7, 1.0, 1.5,
0.2, -0.3, 0.8, -0.7, 0.4, 1.1, -0.1, 0.6, -0.9, 0.3, -0.2, 0.5, 1.3)
val result = dagostinoPearsonTest(data)
result.statistic // K² statistic
result.pValue // p-value from chi-squared distribution with df=2
result.degreesOfFreedom // 2.0
result.additionalInfo["z1"] // skewness z-score
result.additionalInfo["z2"] // kurtosis z-score
result.additionalInfo["skewness"] // sample skewness (population)
result.additionalInfo["kurtosis"] // sample kurtosis (population, non-excess)
result.isSignificant() // true if data deviates significantly from normalityContent copied to clipboard
Return
a TestResult containing the K² statistic, p-value, degrees of freedom (2.0), and additional info with "z1", "z2", "skewness", and "kurtosis".
Parameters
sample
the observed values. Must have at least 20 elements.