/** * Calculates the [sample covariance]{@link https://en.wikipedia.org/wiki/Covariance#Calculating_the_sample_covariance} * for paired arrays of values. * * @method covariance * @memberof ran.dependence * @param {number[]} x First array of values. * @param {number[]} y Second array of values. * @throws {Error} If the arrays have different lengths. * @returns {number} The sample covariance, or NaN if either array has fewer than 2 elements. * @example * * ran.dependence.covariance([], []) * // => NaN * * ran.dependence.covariance([1], [2]) * // => NaN * * ran.dependence.covariance([1, 2, 3], [4, 5, 6]) * // => 1 * * ran.dependence.covariance([1, 9, 10], [1, 2, 10]) * // => 16.166666666666668 */ export default function (x: number[], y: number[]): number;