/** * Calculates the [Pearson correlation coefficient]{@link https://en.wikipedia.org/wiki/Pearson_correlation_coefficient} * for paired arrays of values. * * @method pearson * @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 Pearson correlation coefficient, or NaN if arrays have fewer than two elements or zero variance. * @example * * ran.dependence.pearson([], []) * // => NaN * * ran.dependence.pearson([1, 2, 3], [1, 1, 1]) * // => NaN * * ran.dependence.pearson([1, 2, 3], [4, 5, 6]) * // => 1 * * ran.dependence.pearson([1, 9, 10], [1, 2, 10]) * // => 0.6643835616438358 */ export default function (x: number[], y: number[]): number;