Skip to content

sampleCovariance

sampleCovariance(x, y): number

Defined in: src/sample_covariance.js:16

Sample covariance of two datasets: how much do the two datasets move together? x and y are two datasets, represented as arrays of numbers.

number[]

a sample of two or more data points

number[]

a sample of two or more data points

number

sample covariance

if x and y do not have equal lengths

if x or y have length of one or less

sampleCovariance([1, 2, 3, 4, 5, 6], [6, 5, 4, 3, 2, 1]); // => -3.5