# codes for mini project of simple and multiple regressions install.packages("HistData") library(HistData) data(GaltonFamilies) attach(GaltonFamilies) head(GaltonFamilies) # Q1 summary(lm(childHeight~father)) # Q3 40.13929 + 0.38451*70 # Q4 summary(lm(childHeight~mother)) summary(lm(childHeight~father))$r.squared summary(lm(childHeight~mother))$r.squared # Q5-6 summary(lm(childHeight~father))$coef summary(lm(childHeight~father+mother))$coef cov(father, mother) # Q8 rhat = resid(lm(father~mother)) summary(lm(childHeight~rhat))$coef # Q9 m = summary(lm(childHeight~father+mother)) names(m) m$fstatistic summary(lm(childHeight~father+mother))