Tutorials › Regression Analysis (Undergraduate) › Why Simple Regression R-Squared Is Squared Correlation

Model Fit and Nested Comparisons · Tutorial 250 of 991

Why Simple Regression R-Squared Is Squared Correlation

Learn the algebra behind the equality between simple-regression R-squared and squared sample correlation, and see how to calculate and interpret both from data.

Intermediate 9 min read

What You'll Learn

  • Define the centered sums of squares and the sample correlation used in the identity.
  • Derive the equality between R-squared and squared sample correlation for least-squares regression with an intercept.
  • Calculate both quantities from a small hypothetical data set and verify they agree.
  • Explain why R-squared does not reveal whether the fitted association is positive or negative.
  • Identify the role of the intercept and avoid interpreting R-squared as evidence of causation.

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.

Definition: For observations \((x_i,y_i)\), \(i=1,\ldots,n\), define the centered sums of squares and cross-products by \(S_{xx}=\sum_{i=1}^n(x_i-\bar{x})^2\), \(S_{yy}=\sum_{i=1}^n(y_i-\bar{y})^2\), and \(S_{xy}=\sum_{i=1}^n(x_i-\bar{x})(y_i-\bar{y})\). When \(S_{xx}>0\) and \(S_{yy}>0\), the sample correlation is \(r=S_{xy}/\sqrt{S_{xx}S_{yy}}\).

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

$$ b_1=\frac{S_{xy}}{S_{xx}},\qquad b_0=\bar{y}-b_1\bar{x}. $$

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:

$$ \hat{y}_i-\bar{y} =b_0+b_1x_i-\bar{y} =b_1(x_i-\bar{x}). $$

Squaring and adding these centered fitted values gives the regression sum of squares. Substituting the least-squares slope then gives:

$$ \begin{aligned} SSR &=\sum_{i=1}^n(\hat{y}_i-\bar{y})^2\\ &=\sum_{i=1}^n\{b_1(x_i-\bar{x})\}^2\\ &=b_1^2S_{xx}\\ &=\left(\frac{S_{xy}}{S_{xx}}\right)^2S_{xx}\\ &=\frac{S_{xy}^2}{S_{xx}}. \end{aligned} $$

Because \(SST=S_{yy}\), dividing this result by \(SST\) gives the desired identity:

$$ R^2=\frac{SSR}{SST} =\frac{S_{xy}^2}{S_{xx}S_{yy}} =\left(\frac{S_{xy}}{\sqrt{S_{xx}S_{yy}}}\right)^2 =r^2. $$
Theorem: In ordinary least-squares simple linear regression with an intercept, if \(S_{xx}>0\) and \(S_{yy}>0\), then \(R^2=r^2\), where \(r\) is the sample correlation between the observed predictor and response. This is a statement about the fitted values for the observed data; it does not require normally distributed errors.

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\)
12
23
35
44

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:

$$ S_{xx}=(-1.5)^2+(-0.5)^2+(0.5)^2+(1.5)^2=5, $$
$$ S_{yy}=(-1.5)^2+(-0.5)^2+(1.5)^2+(0.5)^2=5, $$
$$ S_{xy}=(-1.5)(-1.5)+(-0.5)(-0.5)+(0.5)(1.5)+(1.5)(0.5)=4. $$

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:

$$ SSR=(2.3-3.5)^2+(3.1-3.5)^2+(3.9-3.5)^2+(4.7-3.5)^2 =1.44+0.16+0.16+1.44=3.20. $$

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\)
18
26
35
41

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

$$ S_{xy}=(-1.5)(3)+(-0.5)(1)+(0.5)(0)+(1.5)(-4)=-11. $$

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:

$$ SSR=b_1^2S_{xx}=(-2.20)^2(5)=24.2, \qquad R^2=\frac{24.2}{26}\approx0.931. $$

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.

Key takeaway: In simple least-squares regression with an intercept, \(SSR=b_1^2S_{xx}\), so dividing by \(SST=S_{yy}\) yields \(R^2=r^2\). The equality connects two summaries of linear fit, but squaring removes the direction of association.

Check Your Understanding

Use the definitions and derivation above to answer these questions.

  1. What feature of the fitted regression model is needed for the centered fitted-value identity used in the derivation?
  2. If the sample correlation is \(r=0.60\), what is R-squared, and what does it summarize?
  3. If a fitted simple regression has a negative slope and \(R^2=0.81\), what is the sample correlation?
  4. Why does the algebraic equality not require normally distributed errors?
  5. Can \(R^2\) alone tell whether the fitted association is positive or negative? Explain.