Prestige <- read.table('http://math.uttyler.edu/nathan/classes/statistics/data/prestige.data',header=TRUE) attach(Prestige) ### Up to this point: plot(education,prestige) m1 <- lm(prestige ~ education) abline(m1) summary(m1) plot(income,prestige) m2 <- lm(prestige ~ income) abline(m2) summary(m2) ### How do we combine these? ## prestige_i = b_0 + b_1 income + b_2 education + e_i m3 <- lm(prestige ~ income + education) summary(m3) #Call: #lm(formula = prestige ~ income + education) # #Residuals: # Min 1Q Median 3Q Max #-19.40399 -5.33079 0.01542 4.98027 17.68893 # #Coefficients: # Estimate Std. Error t value Pr(>|t|) #(Intercept) -6.8477787 3.2189771 -2.127 0.0359 * #income 0.0013612 0.0002242 6.071 2.36e-08 *** #education 4.1374444 0.3489120 11.858 < 2e-16 *** #--- #Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # #Residual standard error: 7.81 on 99 degrees of freedom #Multiple R-squared: 0.798, Adjusted R-squared: 0.7939 #F-statistic: 195.6 on 2 and 99 DF, p-value: < 2.2e-16 #H0: intercept=0 vs H1: intercept =/= 0, with all other terms in model # i.e. H0: b_0 = 0 vs H1: b_0 =/= 0 # p.value = .0359 -- reject H0 #H0: income_slope = 0 vs H1: income_slope =/= 0, with all other terms in model # i.e. H0: b_1 = 0 vs H1: b_1 =/= 0 # p.value = 2.36e-08 = .0000000236 -- reject H0 summary(lm(prestige ~ income + education + census)) summary(lm(prestige ~ census))