# How to calculate R-square from adjusted r-square, n, and p?

Let $\bar{R}^2$ denote the adjusted coefficient of determination.

I have $\bar{R}^2 = 0.9199$ with 15 cases. Now I am trying to find $R^2$ given the results below.

I found the formula for $R^2$ but did not understand it. How do you calculate $R^2$ from $\bar{R}^2$?

$\bar{R}^2 = 1-\dfrac{(n-1)(1- R^2)}{n-p-1}$

-
0.9199=1-(15-i)(1-RSQ)/(15-p), like this? But p unknown and i unknown?! – hhh May 24 '13 at 9:48
The wikipedia page says that the $i$ should be a $1$ and that $p$ is the number of regressors not counting the constant term. This would be $2$ in your case. Now, you should be able to isolate $R^2$. – Stefan Hansen May 27 '13 at 5:43

Given the equation for $\bar{R}^2$ you have:

$\bar{R}^2 = 1-\dfrac{(n-1)(1- R^2)}{n-p-1}$

You have $3$ regressors and a sample of $15$, thus substituting these and $\bar{R}2$ into the equation yields:

$0.9199 = 1 - \dfrac{(15-1)(1-R^2)}{15-3-1}$

Rearranging this expression and solving for $R^2$ gives:

$R^2 = 0.9371$

-

Well, I think there is a little mistake in the equation. $p$ stands for the number of parameters, which means the number of predictors plus one for the constant.

$k$ stands for the number of predictors. Thus, \begin{align} p=k+1\tag{1}. \end{align}

The equation using $p$ is as follows: \begin{align} 1-\frac{(n-1)(1-R^2)}{n-p} \tag{2}. \end{align}

If you substitute equation $(1)$ in $(2)$ you got $$1-\frac{(n-1)(1-R^2)}{n-(k+1)}=1-\frac{(n-1)(1-R^2)}{n-k-1}.$$ The equation using $k$ is as follows: $$1-\frac{(n-1)(1-R^2)}{n-k-1}.$$ I know it is very common mistake. The degree of freedom for the SSR is $p-1$. For simple regression, the $\mathrm{df}$ of SSR is either $k=p-1=1$.

-

As was stated above answer by GovEcon is wrong.

Wiki defines p in the above formula as: "where p is the total number of explanatory variables in the model (not including the constant term), and n is the sample size."

The parameters three parameters. Excluding the intercept (constant/beta0) p = 2.

That being said it would be easier to calculate R^2 as follows.

Formula for R^2 adjusted can be given as

R^2 adjusted = 1 - (n-1)(MSE/SST), MSE = SSE/(n-p-1)

= 1- (n-1)[(SSE/n-p-1)/SST] = 1- [(n-1)/(n-p-1)]*(SSE/SST)

If you recall definition of that R^2 adjusted controls for increase in R^2 due to increase in parameters then it makes sense that removing [(n-1)/(n-p-1)] should give you R^2

R^2 = 1- SSE/SST

Check by plugging in

SSE/SST = 1-R^2

Original formula:

R^2 adjusted = 1- [(n-1)/(n-p-1)]*(1-R^2) = original formula

Then, R^2 adjusted = 1 - (n-1)*(MSE/SST) = 1- (15-1)(8224/1436706) = ~.9198

R^2 = 1- SSE/SST = 1- 98690/1436706 = ~.931 NOT .9371

Note: the anova table is already rounded MSE = SSE/ (n-p-1) = 98690/(15-2-1) = 8224.16666 = ~8224. So discrepancies with table arise from here.

Aside: I don't know how to format equations and don't have time to do it now, but I do not want the current answer to mislead more people.

-

You must also take into consideration what does constant mean. If it is Intercept, then you have two independent variables, which means $k=2$, not $3$.

-