data("TeachingRatings")
Stock, J.H. and Watson, M.W. (2007). Introduction to Econometrics, 2nd ed. Boston: Addison Wesley.
## evaluation score vs. beauty plot(eval ~ beauty, data = TeachingRatings) fm <- lm(eval ~ beauty, data = TeachingRatings) abline(fm) summary(fm)
## prediction of Stock & Watson's evaluation score sw <- with(TeachingRatings, mean(beauty) + c(0, 1) * sd(beauty)) names(sw) <- c("Watson", "Stock") predict(fm, newdata = data.frame(beauty = sw))
## Hamermesh and Parker, 2005, Table 3 fmw <- lm(eval ~ beauty + gender + minority + native + tenure + division + credits, weights = students, data = TeachingRatings) coeftest(fmw, vcov = sandwich) ## (same coefficients but with different covariances)