# load STAR data star_df = read.csv("star_data.csv") star_df = star_df[complete.cases(star_df) , ] # regress math on school but tabulate school first! table(star_df$school) lm( math ~ school, data = star_df) # predicted value of someone in rural school? 536.34 + 25.43 # predicted value of someone in inner-city school? 536.34 prop.table(table(star_df$lunch, star_df$school)) # add lunch lm( math ~ school + lunch, data = star_df) # regress math on star lm( math ~ star, data = star_df) m = lm( math ~ star + gender + ethnicity + lunch + degree + experience + school, data = star_df) summary(m) # R2 = 0.086 lm( math ~ gender + experience, star_df)