PEARSON

Purpose:

Calculates Pearson's Linear Correlation Coefficient.

Syntax:

PEARSON(x, y)

 x - An input series. y - An input series

Returns:

A number, the correlation coefficient.

Example:

W1: gsin(100, .01, 4)

W2: gsin(100, .01, 4, pi/3)

pearson(W1, W2)

returns: 0.5

pearson(W1, W1)

returns: 1.0

Example:

pearson(W1, W1/2)

returns: 1.0

pearson(W1, -W1)

returns -1.0

Example:

pearson(gsin(100, 0.01, 2), gcos(100, 0.01, 2))

returns -1.867950E-016

Remarks:

Pearson’s correlation coefficient for a population is defined as the covariance of two variables divided by the product of their standard deviations:

By substituting the sample estimates of the covariance and standard deviations, the sample correlation coefficient computed by PEARSON becomes:

where the arithmetic mean is defined as:

PEARSON returns the degree of linear correlation between the two input series. The result ranges from -1 to 1.

PEARSON assumes X and Y have the same number of points.

See LINREG2 to fit a line to X and Y values using the method of least squares.