The OpenD Programming Language

dAgostinoPearsonTest

Tests that a sample comes from a normal distribution.

  1. F dAgostinoPearsonTest(Range r, F p)
    template dAgostinoPearsonTest(KurtosisAlgo kurtosisAlgo = KurtosisAlgo.online, Summation summation = Summation.appropriate)
    F
    dAgostinoPearsonTest
    (
    Range
    F
    )
    (
    Range r
    ,
    out F p
    )
  2. template dAgostinoPearsonTest(string kurtosisAlgo, string summation = "appropriate")

Members

Functions

dAgostinoPearsonTest
F dAgostinoPearsonTest(Range r, F p)

Parameters

kurtosisAlgo

algorithm for calculating skewness and kurtosis (default: KurtosisAlgo.online)

summation

algorithm for calculating sums (default: Summation.appropriate)

Return Value

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;

Meta