I'm reading Gelman and Hill 'Data Analysis using linear regression and multilevel/hierarchical models'. I have a problem with exercise 2 in chapter 3.
Suppose that, for a certain population, we can predict log earnings from log height as follows:
- A person who is 66 inches tall is predicted to have earnings of $30,000. Every increase of 1% in height corresponds to a predicted increase of 0.8% in earnings.
- The earnings of approximately 95% of people fall within a factor of 1.1 of predicted values.
- Give the equation of the regression line and the residual standard deviation of the regression.
Suppose the standard deviation of log heights is 5% in this population. What, then, is the R2 of the regression model described here?
In R, I've used the following code to derive the equation for the regression line
alpha = log(30000) - (0.008/0.01) * log(66) # find the y-intercept
alpha
log.y = alpha + (0.008/0.01) * log(66)
exp(log.y) # we need to take the exponential of log.y to have our final result
The equation is $log(\text{earnings}) = 6.957229 + \frac{0.008}{0.01} * log(\text{height})$. To compute the standard deviation of the predictions, I've used a simple equation based on the second bullet point fact.
sd = 0.1 * .50 / .95
This returns a standard deviation for the residual of the regression of $0.05263158$. I have a hard time though when trying to resolve the last question; what is the R2 of our model?
sd.population = 0.05
R2 <- 1 - (sd^2 / sd.population^2)
This however returns a negative R-squared, which is clearly wrong. What am I doing wrong?
[self-study]
tag to your question. $\endgroup$