3.5.2.5 Correl

Description

This function returns the correlation coefficient between two datasets. Let X and Y be two datasets, then the correlation coefficient between the two is defined as:

$correl(x,y)=\frac{\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y}))}{\sqrt{\sum_{i=1}^{n}(x_i-\bar{x})^2\sum_{i=1}^{n}(y_i-\bar{y})^2}}$

Syntax

double correl(dataset vx, dataset vy)

Parameter

vx

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

vy

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

Return

Returns the correlation coefficient between two datasets vx and vy.

Example

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

correlation = correl(aa,bb);
correlation = ;