# Calculating R-squared using standard errors

I have the following estimated model: $$\hat{y} = 0.2857 + 0.8019x_1 - 0.0741x_2$$ (the $$t$$-statistics are $$1.8959$$, $$8.4198$$, and $$-3.7017$$, respectively).

Furthermore, I know the sample size $$N = 92$$, the sum of squared residuals (SSR) [sum of squared errors (SSE)] $$SSR = \sum_{i=1}^N[\hat{u}_i^2]=39.3601$$, and the (average sample) standard deviation of the dependent variable $$\hat{\sigma}_y = 0.8861$$.

Lastly, in an earlier question I have (correctly) calculated the standard error of the regression:

• Mean of Squared Residuals (MSR) [Mean Squared Error (MSE)]: $$MSR = \frac{1}{89} \cdot 39.3601 \approx 0.4422$$
• Standard Error of the Regression (Root MSR [Root MSE]): $$SE_R = \sqrt{0.4422} \approx 0.6650$$

Central Question: how to calculate $$R^2$$? (The answer should be (approximately) $$0.4491$$)

This answer (https://math.stackexchange.com/questions/834681/when-residual-standard-error-is-equal-to-standard-deviation-of-dependent-variabl) suggests using the formula $$SE_R = (1-R^2)\hat{\sigma}_y$$, but using it yields $$R^2 \approx 0.4995$$ $$(*)$$.

Update 1:

Using https://people.duke.edu/~rnau/mathreg.htm, that is, the formulas $$SE_R = \sqrt{1 - \bar{R}^2} \cdot \hat{\sigma}_y$$ and $$\bar{R}^2 = 1 - \frac{N-1}{N-k-1}(1 - R^2)$$ I do arrive at $$R^2 \approx 0.4491$$, but it seems to me that this result can be reached more easily (that is, without computing $$\bar{R}^2$$), but how?

Update 2:

Yes, indeed, there is. We already know that $$SSR = 39.3601$$, so in order to compute $$R^2$$ using the simple formula $$R^2 = 1 - \frac{SSR}{SST}$$ we only have to determine $$SST$$.

We have that $$\hat{\sigma}_y = 0.8861$$ (average sample standard deviation (of the dependent variable)), so $$MST = \hat{\sigma}_y^2 \approx 0.7852$$ (average sample variance) and it then follows that $$SST = 91 \cdot MST \approx 39.3601$$ (total sample variance) and ultimately that $$R^2 \approx 0.4491$$ (which was the correct answer).

Remaining question:

Can the formula $$SE_R = (1-R^2)\hat{\sigma}_y$$ also be used to calculate $$R^2$$? If so, what goes wrong at $$(*)$$?

Solution

The correct formula is $$\hat{\sigma}_{\hat{u},\color{red}{unbiased}} = (1-R^2)\hat{\sigma}_y$$. It is important to realize that $$SE_R = \hat{\sigma}_{\hat{u},\color{red}{biased}}$$!

We can determine $$\hat{\sigma}_{\hat{u},unbiased}$$ by using the formula $$SE_R = \hat{\sigma}_{\hat{u},unbiased} \cdot \sqrt{\frac{N-1}{N-k-1}}$$ (i.e. by performing a bias correction), which yields $$\hat{\sigma}_{\hat{u},unbiased} \approx 0.6577$$.

Finally, using $$\hat{\sigma}_{\hat{u},unbiased} = (1-R^2)\hat{\sigma}_y$$ we find that $$R^2 \approx 0.4491$$ (which was the correct answer).