Cov

 

Description

This function returns the covariance between two datasets. Let X and Y be two datasets and \bar{x} and \bar{y} their respective means, then the covariance between the two is defined as:

cov(x,y,\bar{x},\bar{y})=\frac{1}{n-1}\sum_{i=1}^\mathit{n}(x_i-\bar{x})(y_i-\bar{y})

Syntax

double cov(dataset vx, dataset vy[, double avex, double avey])

Parameter

vx

A dataset, or a range pointing to a single dataset.

vy

A dataset, or a range pointing to a single dataset.

avex

Mean of dataset vx.

avey

Mean of dataset vy.
Note: In Origin 92, avex and avey can be omited when setting parameters. Their default values are the average of vx and vy datasets, respectively.

Minimum Origin Version Required: Origin 92 SR0

Return

Returns the covariance between two datasets vx and vy.

Example

newbook;
range aa = 1!1;
range bb = 1!2;
aa = uniform(32);
bb = uniform(32);
covariance = cov(aa,bb);
covariance = ;