# Ask for Definition: Coefficient of Correlation $r$ and (Pearson) correlation coefficient $p$

The Coefficient of Determination $R^2=SSR/SSTO$ and Coefficient of Correlation $r=\pm \sqrt{R^2}$ where the slop of the fitted regression line determine the positive or negative.

However, I also remember another correlation coefficient https://en.wikipedia.org/wiki/Pearson_correlation_coefficient.

My question was that: Were they equivalent? If not what was the difference?

For the simpler linear model, $r^2$, which is the square of sample Pearson correlation coefficient, is equivalent to $R^2$. The prove is straightforward as you can find in @Benjamin's answer. For multiple regression, $R^2$ equals the square of Pearson correlation coefficient between the actual $y$ values and the fitted values, $\hat{y}$.
When an intercept is included in linear regression(sum of residuals is zero), they are equivalent. $$\begin{eqnarray*} ρ(y_i,\hat y_i)&=&\frac{cov(y_i,\hat y_i)}{\sqrt{var(y_i)var(\hat y_i)}}\\&=&\frac{\sum_{i=1}^n{(y_i - \bar{y})(\hat y_i - \bar{y})}}{\sqrt{\sum_{i=1}^n{(y_i - \bar{y})^2}\sum_{i=1}^n{(\hat y_i - \bar{y})^2}}} \\&=&\frac{\sum_{i=1}^n{(y_i -\hat y_i+\hat y_i- \bar{y})(\hat y_i - \bar{y})}}{\sqrt{\sum_{i=1}^n{(y_i - \bar{y})^2}\sum_{i=1}^n{(\hat y_i - \bar{y})^2}}}\\&=&\frac{\sum_{i=1}^n{(y_i -\hat y_i)(\hat y_i - \bar{y})}+\sum_{i=1}^n{(\hat y_i- \bar{y})^2}}{\sqrt{\sum_{i=1}^n{(y_i - \bar{y})^2}\sum_{i=1}^n{(\hat y_i - \bar{y})^2}}} \end{eqnarray*}$$ $$\begin{eqnarray*} \sum_{i=1}^n(y_i-\hat y_i)(\hat y_i-\bar y)&=&\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)(\beta_0+\beta_1x_i-\bar y)\\&=&(\beta_0-\bar y)\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)+\beta_1\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)x_i \end{eqnarray*}$$
In Least squares regression, the sum of the squares of the errors is minimized. $$SSE=\displaystyle\sum\limits_{i=1}^n \left(e_i \right)^2= \sum_{i=1}^n\left(y_i - \hat{y_i} \right)^2= \sum_{i=1}^n\left(y_i -\beta_0- \beta_1x_i\right)^2$$ Take the partial derivative of SSE with respect to $$\beta_0$$ and setting it to zero. $$\frac{\partial{SSE}}{\partial{\beta_0}} = \sum_{i=1}^n 2\left(y_i - \beta_0 - \beta_1x_i\right)^1 (-1) = 0$$ So $$\sum_{i=1}^n \left(y_i - \beta_0 - \beta_1x_i\right)^1 (-1) = 0$$ Take the partial derivative of SSE with respect to $$\beta_1$$ and setting it to zero. $$\frac{\partial{SSE}}{\partial{\beta_1}} = \sum_{i=1}^n 2\left(y_i - \beta_0 - \beta_1x_i\right)^1 (-x_i) = 0$$ So $$\sum_{i=1}^n \left(y_i - \beta_0 - \beta_1x_i\right)^1 x_i = 0$$ Hence, when an intercept is included in linear regression(sum of residuals is zero), $$\begin{eqnarray*} ρ(y_i,\hat y_i)&=&\frac{\sum_{i=1}^n{(y_i -\hat y_i)(\hat y_i - \bar{y})}+\sum_{i=1}^n{(\hat y_i- \bar{y})^2}}{\sqrt{\sum_{i=1}^n{(y_i - \bar{y})^2}\sum_{i=1}^n{(\hat y_i - \bar{y})^2}}}\\&=&\frac{0+\sum_{i=1}^n{(\hat y_i- \bar{y})^2}}{\sqrt{\sum_{i=1}^n{(y_i - \bar{y})^2}\sum_{i=1}^n{(\hat y_i - \bar{y})^2}}}\\&=&\sqrt{\frac{\sum_{i=1}^n{(\hat y_i- \bar{y})^2}}{\sum_{i=1}^n{(y_i- \bar{y})^2}}}\\&=&\sqrt{\frac{SSR}{SST}}\\&=&\sqrt{R^2} \end{eqnarray*}$$