MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / quartiles

Function quartiles

src/compute-engine/numerics/statistics.ts:267–278  ·  view source on GitHub ↗
(values: Iterable<number>)

Source from the content-addressed store, hash-verified

265 * returned: skewness and kurtosis do not change when all the deviations are
266 * multiplied by the same factor. The unit is a power of 2 near the largest
267 * deviation seen, so each scaled deviation is at most 1 in magnitude, and
268 * no power of a deviation overflows or underflows. Without this, the cube
269 * of the deviations of `[5·10¹⁰², −5·10¹⁰²]` overflows and the skewness is
270 * `NaN`, not `0`. When a larger deviation comes, the sums are converted to
271 * the new unit. A multiplication by a power of 2 is exact, so the unit does
272 * not add a rounding error.
273 */
274function centralMoments(
275 values: Iterable<number>
276): { n: number; m2: number; m3: number; m4: number } | undefined {
277 let n = 0;
278 let origin = 0;
279 // The exponent of the unit of the sums, or `undefined` while every
280 // deviation from the origin is zero (the sums are then zero).
281 let unit: number | undefined;

Callers 2

statistics.tsFile · 0.90
interquartileRangeFunction · 0.85

Calls 3

medianFunction · 0.70
sliceMethod · 0.65
floorMethod · 0.45

Tested by

no test coverage detected