# How different will that be between the R-squared of linear regression y~x and square of cor(x,y)

Generally, both of them can represent the linear relationship between x and y scale to [0,1]. Are they 99% very similar?

• Not the same thing. See answers. – BruceET Jun 19 at 5:41

Computationally, R-sq in computer printouts is the square $$r^2$$of the (Pearson) correlation $$r.$$ Sometimes $$r^2$$ is called the 'coefficient of determination'. Because $$-1 \le r \le 1$$ we have $$0 \le r^2 \le 1.$$

Suppose we have the simple linear regression model $$Y_i = \beta_0 + \beta_1 x_i + e_i,$$ for $$i = 1,2, \dots,n$$ where $$e_i \stackrel{iid}{\sim}\mathsf{Norm}(0, \sigma_e).$$

In regression $$r^2$$ is sometimes referred to (intuitively) as the proportion of the variability in $$Y$$ that is explained by regression on $$x.$$ This interpretation roughly matches the equation $$S_{Y|x}^2 = \frac{n-1}{n-2}S_Y^2(1 - r^2),$$ where $$S_Y^2$$ is the sample variance of the $$Y_i$$ and $$S_{Y|x}^2$$ is the sum of squared residuals divided by $$n-2,$$ sometimes referred to as the variance about the regression line.

Thus if $$r = \pm 1$$ so that $$r^2 = 1,$$ then $$S_{Y|x}^2 = 0$$ and all of the $$(x_i,Y_i)$$-points lie precisely on the regression line. Also, if $$r \approx 0,$$ then $$S_{Y|x}^2 \approx S_Y^2$$ and the $$x_i$$ have no role to play in 'explaining' the $$Y_i.$$

Sometimes, the Pearson 'correlation coefficient' $$r$$ is said to express the 'linear component' of the association of $$X_i$$ and $$Y_i.$$

• @mkt. Thanks for fixing typo. – BruceET Jun 19 at 5:59

R-squared or coefficient of determination generally has the value between 0 and 1. However cor(x,y) is between -1 and 1. Definition of R-squared for a multiple linear regression is the square of correlation between output (y) and predicted values(f). For the case of simple linear regression with an intercept and one explanatory variable it happens R-squared is as same as square of cor(x,y). I hope this helps you.

• Definitely they are not same, but for simple linear regression : Y=ax+b (x is a single variable and not a vector), value of coefficient of determination is equal to square of correlation between x and y. – Masoud Norouzi Darabad Jun 19 at 5:19