The OpenD Programming Language

SkewnessAccumulator

Constructors

this
this(Slice!(Iterator, N, kind) slice)
this
this(SliceLike x)
this
this(Range range)

Members

Aliases

S
alias S = Summator!(T, summation)

Functions

centeredSumOfCubes
F centeredSumOfCubes()
centeredSumOfSquares
F centeredSumOfSquares()
count
size_t count()
mean
F mean()
scaledSumOfCubes
F scaledSumOfCubes(bool isPopulation)
skewness
F skewness(bool isPopulation)
variance
F variance(bool isPopulation)

Examples

twoPass

import mir.math.common: approxEqual, sqrt;
import mir.math.sum: Summation;
import mir.ndslice.slice: sliced;

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;

auto v = SkewnessAccumulator!(double, SkewnessAlgo.twoPass, Summation.naive)(x);
assert(v.skewness(true).approxEqual(12.000999 / 12));
assert(v.skewness(false).approxEqual(12.000999 / 12 * sqrt(12.0 * 11.0) / 10.0));

Meta