So at sqrft = \(\bar{sqrft}\), the effect of bdrms on price is \(\beta_2 + \beta_3 \bar{sqrft}\)
Easy to obtain given \(\hat{\beta}_2\) and \(\hat{\beta}_3\) and \(\bar{sqrft}\)
Similarly in the previous slide \(\frac{\partial E(y | x_1 = \bar{x_1}, x_2)}{\partial x_1} = \beta_1 + 2\beta_2 \bar{x_1}\)
model <-lm(price ~ sqrft + bdrms +I(sqrft * bdrms), data = hprice1) model$coefficients["bdrms"] + model$coefficients["I(sqrft * bdrms)"] *mean(hprice1$sqrft)
bdrms
11.26181
Adjusted R-squared
Recall Econ 160
Adjusted R-squared is a modified version of R-squared that adjusts for the number of predictors in the model.
Compare goodness of fit of models with different numbers of X’s. \[\text{Adjusted-}R^2 = 1 - \left( \frac{(1 - R^2)(n - 1)}{n - k - 1} \right)\]\(R^2\) is the R-squared value, \(n\) is the # observations and \(k\) is the number of X’s
Penalizes the addition of unnecessary predictors
The F-test could be related to the adjusted R-squared.
Think abour \(UR\) and \(R\) models in the context of the F-test
F-test is useful when models are nested
Overfitting/overcontrolling
Including too many controls can distort causal interpretation.
Example: Estimating the effect of beer tax on traffic fatalities ins tates:
For any of the slopes to depend on gender, we simply interact it with \(female_i\), and include it
To test if the model is different between men and women, then we need a model where the intercept and all slopes can be different across the two groups