import type { array, matrix } from "../types"; /** * Computes the central moment of a dataset. * * Computes the k-th central moment of a dataset around the mean. The first moment * is always zero, the second moment equals variance, and higher moments describe shape. * * @param x Input array or matrix * @param k Order of the moment to compute * @param dim Dimension to compute along (0 for rows, 1 for columns). Default is 0 * @returns Central moment values * @throws When input is invalid * * @example Second moment (variance) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(moment([1, 2, 3, 4, 5], 2), 2); * * ``` * * @example First moment (always zero) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(moment([1, 2, 3], 1), 0); * * ``` * * @example Matrix moments * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(moment([[1, 2], [3, 4]], 2), [0.25, 0.25]); * ``` */ export default function moment(x: array, k: number, dim?: 0 | 1): number; /** * Computes the central moment of a dataset. * * Computes the k-th central moment of a dataset around the mean. The first moment * is always zero, the second moment equals variance, and higher moments describe shape. * * @param x Input array or matrix * @param k Order of the moment to compute * @param dim Dimension to compute along (0 for rows, 1 for columns). Default is 0 * @returns Central moment values * @throws When input is invalid * * @example Second moment (variance) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(moment([1, 2, 3, 4, 5], 2), 2); * * ``` * * @example First moment (always zero) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(moment([1, 2, 3], 1), 0); * * ``` * * @example Matrix moments * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(moment([[1, 2], [3, 4]], 2), [0.25, 0.25]); * ``` */ export default function moment(x: matrix, k: number, dim?: 0 | 1): array; //# sourceMappingURL=moment.d.ts.map