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

Example:

pearson(W1, W1)

 

returns: 1.0

Example:

pearson(W1, W1/2)

 

returns: 1.0

Example:

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:

 

image\pearson01.gif

 

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

 

image\pearson02.gif

 

where the arithmetic mean is defined as:

 

image\pearson03.gif

 

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.

See Also:

AUTOCOR

CROSSCOR

LINFIT

LINREG2

PFIT

TREND