/** * Order statistics and the two joint statistics. * * `percentile` interpolates linearly between the two ranks either side, which * `stdlib.md` section 9 states. The nearest rank method, which returns an * actual member of the lookback, is the other common choice and gives a visibly * different answer for an even length lookback; it is not what is specified here. * * `covariance` and `correlation` are the population forms, and both are taken * in two passes: the mean first, then the deviations from it. The single pass * arrangement, summing squares and cross products and subtracting at the end, * needs one fewer pass and loses most of its significant digits when the values * are large and their spread is small, which is exactly what a price series is. * `stdlib.md` fixes neither arrangement, so this one is chosen and stated. */ import type { Series, StateRecord, Tail, Value } from '../values/index.js'; import type { Pair } from './changes.js'; /** * `percentile(src, len, p)`: the value at percentile `p` of the lookback, * linearly interpolated, from bar `len - 1`. */ export declare function percentileStep(state: StateRecord, key: string, value: Value, len: number | null, p: number | null): Value; /** `percentile(src, len, p)` as a tail. */ export declare function percentileTail(len: number, p: number): Tail; /** `percentile(src, len, p)` over a whole series. */ export declare function percentile(src: Series, len: number, p: number): Value[]; /** * `median(src, len)`: the middle value of the lookback, from bar `len - 1`. * * The 50th percentile by the same interpolation, so an even length lookback is * the mean of its two middles rather than one of them chosen by a rule nobody * remembers. */ export declare function medianTail(len: number): Tail; /** `median(src, len)` over a whole series. */ export declare function median(src: Series, len: number): Value[]; /** * `percentRank(src, len)`: what percentage of the lookback this bar's value * exceeds, from bar `len - 1`. * * The lookback is the last `len` bars including this one, which is what the * declared warmup of bar `len - 1` says: a lookback of the `len` bars before this * one would not have its first answer until bar `len`. This bar is therefore * one of the values counted, so the reading runs from `100 / len` to 100 rather * than from 0. */ export declare function percentRankStep(state: StateRecord, key: string, value: Value, len: number | null): Value; /** `percentRank(src, len)` as a tail. */ export declare function percentRankTail(len: number): Tail; /** `percentRank(src, len)` over a whole series. */ export declare function percentRank(src: Series, len: number): Value[]; /** `covariance(a, b, len)`: the population covariance, from bar `len - 1`. */ export declare function covarianceStep(state: StateRecord, key: string, pair: Pair, len: number | null): Value; /** `correlation(a, b, len)`: linear correlation, -1 to 1, from bar `len - 1`. */ export declare function correlationStep(state: StateRecord, key: string, pair: Pair, len: number | null): Value; /** `covariance(a, b, len)` as a tail. */ export declare function covarianceTail(len: number): Tail; /** `correlation(a, b, len)` as a tail. */ export declare function correlationTail(len: number): Tail; /** `covariance(a, b, len)` over whole series. */ export declare function covariance(a: Series, b: Series, len: number): Value[]; /** `correlation(a, b, len)` over whole series. */ export declare function correlation(a: Series, b: Series, len: number): Value[]; //# sourceMappingURL=statistics.d.ts.map