import { Quantity } from "../model/Quantity.js"; /** * The statistics a sample of measurements is described with. * * The centre and the scatter are taken from the median rather than from * the mean, because the departures a measurement over an edition looks * for are in the sample it is taken over. A mean and a standard * deviation would grow towards those departures until they no longer * stood out; a median and a median absolute deviation leave them out of * account. */ /** * The middle of a sample, the mean of the two middle values where it has an even number of them. * @internal */ export declare const medianOf: (values: readonly Quantity[]) => Quantity | undefined; /** * Where a sample sits and how far it scatters. * @category Collation and alignment */ export interface Spread { /** How many measurements it was taken over. */ n: number; /** The middle measurement. */ median: Quantity; /** * The scatter about the median, as the median absolute deviation * scaled to the standard deviation a normal sample of that scatter * would have. It is zero where more than half the sample sits at * one value, and no scatter can be read off such a sample. */ sigma: Quantity; } /** * Where the sample sits and how far it scatters, or nothing for an empty sample. * @internal */ export declare const spreadOf: (values: readonly Quantity[]) => Spread | undefined; /** * How far the value lies from the centre of the spread, in units of its scatter. * @internal */ export declare const standardise: (value: Quantity, spread: Spread) => number; /** * The share of a normal sample lying below `z` standard deviations. * @internal */ export declare const normalBelow: (z: number) => number; /** * The share of a normal sample lying further than `z` standard deviations from its centre, on either side. * @internal */ export declare const normalBeyond: (z: number) => number; /** * How many standard deviations out the given share of a normal sample * lies below, after Acklam's rational approximation, whose relative * error stays below 1.15e-9. The inverse of `normalBelow`. * @internal */ export declare const normalQuantile: (share: number) => number; /** * How much heavier the tails of a standardised sample are than a normal * sample's. Zero for a normal shape, positive where more of the sample * lies far out than the curve allows. * @internal */ export declare const excessKurtosisOf: (standardised: readonly number[]) => number; /** * How much of a sample lies beyond a given distance from its centre, against how much would under a normal curve. * @category Collation and alignment */ export interface Tail { /** The distance from the centre, in standard deviations. */ beyond: number; /** How many of the sample lie further out than that. */ observed: number; /** How many a normal sample of the same size would put there. */ expected: number; } /** * What the sample puts beyond the given distance, against what a normal sample would. * @internal */ export declare const tailOf: (standardised: readonly number[], beyond: number) => Tail; /** * A sample counted into bins of one width. * @category Collation and alignment */ export interface Histogram { /** The bounds of the bins, in order, one more of them than there are counts. */ edges: Quantity[]; /** How many of the sample fall in each bin. */ counts: number[]; } /** * The sample counted into bins of the given width, laid out on * multiples of that width so that two histograms of one width share * their bounds. Nothing for an empty sample or a width of nothing. * @internal */ export declare const histogramOf: (values: readonly Quantity[], binWidth: Quantity) => Histogram | undefined;