Report a bug
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# mir.stat.inference

This module contains statistical inference algorithms.
Authors:
Ilia Ki, John Michael Hall
template `dAgostinoPearsonTest`(KurtosisAlgo kurtosisAlgo = KurtosisAlgo.online, Summation summation = Summation.appropriate)

template `dAgostinoPearsonTest`(string kurtosisAlgo, string summation = "appropriate")
Tests that a sample comes from a normal distribution.
Parameters:
 kurtosisAlgo algorithm for calculating skewness and kurtosis (default: KurtosisAlgo.online) summation algorithm for calculating sums (default: Summation.appropriate)
Returns:
The kurtosis of the input, must be floating point

References D’Agostino, R. B. (1971), “An omnibus test of normality for moderate and large sample size”, Biometrika, 58, 341-348; D’Agostino, R. and Pearson, E. S. (1973), “Tests for departure from normality”, Biometrika, 60, 613-622

Examples:
```import mir.math.common: approxEqual, pow;
import mir.math.sum: Summation;
import mir.ndslice.slice: sliced;
import mir.test;

auto x = [0.0, 1.0, 1.5, 2.0, 3.5, 4.25,
2.0, 7.5, 5.0, 1.0, 1.5, 0.0];

double p;
x.dAgostinoPearsonTest(p).shouldApprox == 4.151936053369771;
p.shouldApprox == 0.12543494432988342;

p = p.nan;
x.dAgostinoPearsonTest!"threePass"(p).shouldApprox == 4.151936053369771;
p.shouldApprox == 0.12543494432988342;
```
F `dAgostinoPearsonTest`(Range, F)(Range `r`, out F `p`)
if (isFloatingPoint!F && isIterable!Range);
Parameters:
 Range `r` range, must be finite iterable F `p` null hypothesis probability