Why Correlation and R-Squared Match in Simple Regression
In simple linear regression, one quantitative predictor is used to describe the relationship with one quantitative response. When the fitted line includes an intercept, the proportion of response variation summarized by R-squared has a particularly direct connection to the sample correlation between the two variables: it is the correlation squared. This is an algebraic property of the least-squares fit, not a separate assumption about the data.
The equality is useful, but it is easy to overread it. Squaring removes the sign, so R-squared summarizes the strength of the linear fit without saying whether the fitted slope is positive or negative. It also does not establish that changes in the predictor cause changes in the response.
Model and Conditions for the Identity
The usual simple linear regression model with an intercept is \(Y_i=\beta_0+\beta_1x_i+\varepsilon_i\). Here \(x_i\) is the predictor value for observation \(i\), \(\beta_0\) is the population intercept, \(\beta_1\) is the population slope, and \(\varepsilon_i\) is the error. In the conventional model for regression inference, the errors have mean zero, are independent, and have a common variance; normal errors are additionally assumed when exact small-sample \(t\) inference is required. These distributional conditions support inference, but they are not needed for the algebraic identity below.
For the identity, the necessary features are that the fitted line is an ordinary least-squares line with an intercept and that the observed predictor and response each have nonzero variation. Ordinary least squares chooses the line to minimize the residual sum of squares. With an intercept, its fitted slope and intercept are
The fitted value is \(\hat{y}_i=b_0+b_1x_i\). The sums of squares used here are the total sum of squares \(SST=\sum_{i=1}^n(y_i-\bar{y})^2\), the regression sum of squares \(SSR=\sum_{i=1}^n(\hat{y}_i-\bar{y})^2\), and the residual sum of squares \(SSE=\sum_{i=1}^n(y_i-\hat{y}_i)^2\). For this fitted model, \(SST=SSR+SSE\), and \(R^2=SSR/SST=1-SSE/SST\), provided \(SST>0\).
Deriving the Equality
The intercept makes the fitted line pass through \((\bar{x},\bar{y})\), so subtracting \(\bar{y}\) from each fitted value leaves a simple centered expression:
Squaring and adding these centered fitted values gives the regression sum of squares. Substituting the least-squares slope then gives:
Because \(SST=S_{yy}\), dividing this result by \(SST\) gives the desired identity:
The equality follows from the fitted slope and the centered sums of squares. Since the denominator in \(r\) is positive, the sign of \(r\) is the sign of \(S_{xy}\), which is also the sign of \(b_1=S_{xy}/S_{xx}\). But \(r^2\) and \(R^2\) are both nonnegative. They give the same summary of the strength of the linear relationship while leaving its direction out.
Worked Example: A Positive Linear Association
Suppose a hypothetical set of four observations records a predictor \(x\) and response \(y\):
| \(x\) | \(y\) |
|---|---|
| 1 | 2 |
| 2 | 3 |
| 3 | 5 |
| 4 | 4 |
The values are not all equal, so both centered sums of squares are positive. The sample means are \(\bar{x}=2.5\) and \(\bar{y}=3.5\). The centered products and squares give:
Thus the correlation is \(r=4/\sqrt{5\cdot5}=0.800\), and \(r^2=0.640\). The fitted slope is \(b_1=4/5=0.800\), and the intercept is \(b_0=3.5-(0.800)(2.5)=1.5\). The fitted values are \(2.3,3.1,3.9,4.7\). Therefore:
Since \(SST=S_{yy}=5\), \(R^2=3.20/5=0.640\), matching \(r^2\). In this hypothetical data set, the fitted line has a positive slope, while R-squared reports that the line accounts for 64.0% of the observed variation in the response around its mean.
Worked Example: A Negative Linear Association
Consider this hypothetical data set, in which larger predictor values tend to accompany smaller response values:
| \(x\) | \(y\) |
|---|---|
| 1 | 8 |
| 2 | 6 |
| 3 | 5 |
| 4 | 1 |
Here \(\bar{x}=2.5\) and \(\bar{y}=5\). The centered sums are \(S_{xx}=5\), \(S_{yy}=3^2+1^2+0^2+(-4)^2=26\), and
Consequently, \(r=-11/\sqrt{130}\approx-0.965\), so \(r^2=121/130\approx0.931\). The fitted slope is \(b_1=-11/5=-2.20\) response units per predictor unit, and the intercept is \(b_0=5-(-2.20)(2.5)=10.5\). The regression sum of squares is:
The correlation is negative, but R-squared is positive and has the same magnitude as the previous calculation of \(r^2\). The direction must be reported using the sign of the slope or correlation; R-squared alone does not communicate it.
Units, Interpretation, and Limits
The sample correlation is unitless. The slope \(b_1\), in contrast, is measured in response units per predictor unit. The equality does not mean that R-squared is a slope or that it describes a change in the response for a one-unit change in the predictor. For example, a slope of \(-2.20\) response units per predictor unit describes the fitted change in the response; an R-squared of about \(0.931\) summarizes the fraction of observed response variation accounted for by the fitted line.
The fraction described by R-squared is a feature of the fitted linear model and the data. A high value does not prove that the linear relationship is the only important pattern, that predictions will be accurate for new observations, or that the predictor causes the response. Context, the data collection process, and checks of the model fit still matter.
The intercept is essential to the derivation: it ensures that \(\hat{y}_i-\bar{y}=b_1(x_i-\bar{x})\), and the usual centered sum-of-squares decomposition applies. The equality established here should therefore be used for simple least-squares regression with an intercept, not assumed for every regression calculation. When \(S_{xx}=0\) or \(S_{yy}=0\), sample correlation is undefined, so the stated identity does not apply.
Common Mistake
A common mistake is to say, “R-squared is the correlation between \(x\) and \(y\).” That is not correct: in this setting, R-squared is the square of the correlation. If \(r=-0.70\), then \(R^2=0.49\), not \(-0.70\). The correction is to report direction separately, using the sign of \(r\) or the fitted slope, and to interpret \(R^2\) as a fraction of response variation summarized by the fitted line.
Check Your Understanding
Use the definitions and derivation above to answer these questions.
- What feature of the fitted regression model is needed for the centered fitted-value identity used in the derivation?
- If the sample correlation is \(r=0.60\), what is R-squared, and what does it summarize?
- If a fitted simple regression has a negative slope and \(R^2=0.81\), what is the sample correlation?
- Why does the algebraic equality not require normally distributed errors?
- Can \(R^2\) alone tell whether the fitted association is positive or negative? Explain.