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, kurtosisAlgo, sumAlgo) v)
scaledSumOfCubes
F scaledSumOfCubes(bool isPopulation)
scaledSumOfQuarts
F scaledSumOfQuarts(bool isPopulation)
skewness
F skewness(bool isPopulation)
variance
F variance(bool isPopulation)

Examples

assumeZeroMean

import mir.math.common: approxEqual, pow;
import mir.ndslice.slice: sliced;
import mir.stat.transform: center;

auto a = [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;
auto x = a.center;

KurtosisAccumulator!(double, KurtosisAlgo.assumeZeroMean, Summation.naive) v;
v.put(x);
assert(v.kurtosis(true, true).approxEqual((792.784119 / 12) / pow(54.765625 / 12, 2.0)));
assert(v.kurtosis(true, false).approxEqual((792.784119 / 12) / pow(54.765625 / 12, 2.0) - 3.0));
assert(v.kurtosis(false, false).approxEqual(792.784119 / pow(54.765625 / 11, 2.0) * (12.0 * 13.0) / (11.0 * 10.0 * 9.0) - 3.0 * (11.0 * 11.0) / (10.0 * 9.0)));
assert(v.kurtosis(false, true).approxEqual(792.784119 / pow(54.765625 / 11, 2.0) * (12.0 * 13.0) / (11.0 * 10.0 * 9.0) - 3.0 * (11.0 * 11.0) / (10.0 * 9.0) + 3.0));

v.put(4.0);
assert(v.kurtosis(true, true).approxEqual((1048.784119 / 13) / pow(70.765625 / 13, 2.0)));
assert(v.kurtosis(true, false).approxEqual((1048.784119 / 13) / pow(70.765625 / 13, 2.0) - 3.0));
assert(v.kurtosis(false, false).approxEqual(1048.784119 / pow(70.765625 / 12, 2.0) * (13.0 * 14.0) / (12.0 * 11.0 * 10.0) - 3.0 * (12.0 * 12.0) / (11.0 * 10.0)));
assert(v.kurtosis(false, true).approxEqual(1048.784119 / pow(70.765625 / 12, 2.0) * (13.0 * 14.0) / (12.0 * 11.0 * 10.0) - 3.0 * (12.0 * 12.0) / (11.0 * 10.0) + 3.0));

Meta