@thi.ng/vectors
Version:
Optimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts
88 lines • 2.9 kB
TypeScript
import type { ReadonlyVec } from "./api.js";
/**
* Computes variance of vector components in `a`. If `isCentered` is false
* (default), the vector will first be {@link center}ed (copy) in order to
* compute the result.
*
* @remarks
* If `corrected` is true, applies Bessel's correction for computing the sample
* variance of an unknown population size: `var(a) = magSq(a) / (len(a)-1)`
*
* If `corected` is false, assumes the given vector represents the full
* population and computes uncorrected variance: `var(a) = magSq(a) / len(a)`
*
* Returns 0 if `len(a) < k` where `k=2` for corrected and `k=1` for
* uncorrected.
*
* For angular values, use {@link circularVariance}.
*
* References:
*
* - https://en.wikipedia.org/wiki/Variance
* - https://en.wikipedia.org/wiki/Bessel's_correction
*
* @param a -
* @param isCentered -
* @param corrected -
*/
export declare const variance: (a: ReadonlyVec, isCentered?: boolean, corrected?: boolean) => number;
/**
* Computes standard deviation of vector components in `a`. If `isCentered` is
* false (default), the vector will first be {@link center}ed (copy) in order to
* compute the result.
*
* @remarks
* If `corrected` is true, applies Bessel's correction for computing the sample
* SD of an unknown population size: `sd(a) = sqrt(magSq(a) / (len(a)-1))`
*
* If `corected` is false, assumes the given vector represents the full
* population and computes uncorrected SD: `sd(a) = sqrt(magSq(a) / len(a))`
*
* Returns 0 if `len(a) < k` where `k=2` for corrected and `k=1` for
* uncorrected.
*
* For angular values, use {@link circularSD}.
*
* Reference:
*
* - https://en.wikipedia.org/wiki/Standard_deviation
* - https://en.wikipedia.org/wiki/Bessel's_correction
*
* @param a -
* @param isCentered -
* @param corrected -
*/
export declare const sd: (a: ReadonlyVec, isCentered?: boolean, corrected?: boolean) => number;
/**
* Computes the standard error of vector components in `a`. If `isCentered` is
* false (default), the vector will first be {@link center}ed (copy) in order to
* compute the result.
*
* @remarks
* Also see {@link sd} comments about role of `corrected` param.
*
* sderr(a) = sd(a) / sqrt(len(a))
*
* Reference:
* https://en.wikipedia.org/wiki/Standard_error
*
* @param a -
* @param isCentered -
* @param corrected -
*/
export declare const sdError: (a: ReadonlyVec, isCentered?: boolean, corrected?: boolean) => number;
/**
* Computes the mean absolute deviation of vector components in `a`. If
* `isCentered` is false (default), the vector will first be {@link center}ed
* (copy) in order to compute the result.
*
* @remarks
* Reference:
*
* - https://en.wikipedia.org/wiki/Average_absolute_deviation
*
* @param a
* @param isCentered
*/
export declare const meanAD: (a: ReadonlyVec, isCentered?: boolean) => number;
//# sourceMappingURL=variance.d.ts.map