Linear XY Regression: Coefficient of Correlation (r)

Abbreviation: LinXYReg r
Category: Regression

Input Parameters:

Name Range Default
X Axis Close
Y Axis Close
Regression Periods Int >= 3 40

 
Calculation:

[ n * sum(X*Y) – sum(X) * sum(Y) ]

sqrt ( [n * sum(X*X) – sum(X) * sum(X)] * [n * sum(Y*Y) – sum(Y) * sum(Y)] )

where
sum(X*X) = sum of X*X over the last n periods
sum(Y*Y) = sum of Y*Y over the last n periods
sum(X*Y) = sum of X*Y over the last n periods
sum(X) = sum of X over the last n periods
sum(Y) = sum of Y over the last n periods

X = X Axis
Y = Y Axis
n = Regression Periods

 
Discussion:

Computes the coefficient of correlation (r) for the linear regression line. The coefficient of determination is a measure of the degree of linear correlation between two time series. The closer the value is to one, the stronger the positive correlation. The closer the value is to negative one, the stronger the negative correlation. A value of zero indicates a lack of correlation. Note that the coefficient of determination is simply the square of the coefficient of correlation.
 

Was this article helpful?

Related Articles