assumeZeroMean
import mir.math.common: approxEqual, pow; import mir.math.sum: Summation; 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; SkewnessAccumulator!(double, SkewnessAlgo.assumeZeroMean, Summation.naive) v; v.put(x); assert(v.skewness(true).approxEqual((117.005859 / 12) / pow(54.765625 / 12, 1.5))); assert(v.skewness(false).approxEqual((117.005859 / 12) / pow(54.765625 / 11, 1.5) * 12.0 ^^ 2 / (11.0 * 10.0))); v.put(4.0); assert(v.skewness(true).approxEqual((181.005859 / 13) / pow(70.765625 / 13, 1.5))); assert(v.skewness(false).approxEqual((181.005859 / 13) / pow(70.765625 / 12, 1.5) * 13.0 ^^ 2 / (12.0 * 11.0)));