The OpenD Programming Language

KurtosisAccumulator

Constructors

this
this(Range r)
this
this(T x)

Members

Aliases

S
alias S = Summator!(T, summation)

Functions

centeredSumOfCubes
F centeredSumOfCubes()
centeredSumOfQuarts
F centeredSumOfQuarts()
centeredSumOfSquares
F centeredSumOfSquares()
count
size_t count()
kurtosis
F kurtosis(bool isPopulation, bool isRaw)
mean
F mean()
put
void put(Range r)
put
void put(T x)
put
void put(KurtosisAccumulator!(U, kurtAlgo, sumAlgo) v)
scaledSumOfCubes
F scaledSumOfCubes(bool isPopulation)
scaledSumOfQuarts
F scaledSumOfQuarts(bool isPopulation)
skewness
F skewness(bool isPopulation)
variance
F variance(bool isPopulation)

Examples

online

import mir.math.common: approxEqual, pow;
import mir.ndslice.slice: sliced;
import mir.test: shouldApprox;

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].sliced;

KurtosisAccumulator!(double, KurtosisAlgo.online, Summation.naive) v;
v.put(x);
v.kurtosis(true, true).shouldApprox == (792.784119 / 12) / pow(54.765625 / 12, 2.0);
v.kurtosis(true, false).shouldApprox == (792.784119 / 12) / pow(54.765625 / 12, 2.0) - 3;
v.kurtosis(false, false).shouldApprox == (792.784119 / 12) / pow(54.765625 / 12, 2.0) * (11.0 * 13.0) / (10.0 * 9.0) - 3.0 * (11.0 * 11.0) / (10.0 * 9.0);
v.kurtosis(false, true).shouldApprox == (792.784119 / 12) / pow(54.765625 / 12, 2.0) * (11.0 * 13.0) / (10.0 * 9.0) - 3.0 * (11.0 * 11.0) / (10.0 * 9.0) + 3;

v.put(4.0);
v.kurtosis(true, true).shouldApprox == (745.608180 / 13) / pow(57.019231 / 13, 2.0);
v.kurtosis(true, false).shouldApprox == (745.608180 / 13) / pow(57.019231 / 13, 2.0) - 3;
v.kurtosis(false, false).shouldApprox == (745.608180 / 13) / pow(57.019231 / 13, 2.0) * (12.0 * 14.0) / (11.0 * 10.0) - 3.0 * (12.0 * 12.0) / (11.0 * 10.0);
v.kurtosis(false, true).shouldApprox == (745.608180 / 13) / pow(57.019231 / 13, 2.0) * (12.0 * 14.0) / (11.0 * 10.0) - 3.0 * (12.0 * 12.0) / (11.0 * 10.0) + 3;

Meta