Call:
lm(formula = income ~ race + education + race:education, data = Income)
Residuals:
Min 1Q Median 3Q Max
-25.064 -9.448 -1.453 6.167 56.936
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -6.536 14.980 -0.436 0.6639
raceH -10.069 26.527 -0.380 0.7053
raceW -19.333 18.293 -1.057 0.2940
education 2.799 1.182 2.368 0.0205 *
raceH:education 1.290 2.193 0.588 0.5582
raceW:education 2.411 1.418 1.700 0.0933 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 15.37 on 74 degrees of freedom
Multiple R-squared: 0.4825, Adjusted R-squared: 0.4475
F-statistic: 13.8 on 5 and 74 DF, p-value: 1.618e-09
anova(fit3)# tests individual effects of explanatory variables
Analysis of Variance Table
Response: income
Df Sum Sq Mean Sq F value Pr(>F)
race 2 3352.5 1676.2 7.0993 0.001512 **
education 1 12245.2 12245.2 51.8616 4.131e-10 ***
race:education 2 691.8 345.9 1.4650 0.237690
Residuals 74 17472.4 236.1
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A Linear Model Example: Salaries Data Set
income <-read.table("http://stat4ds.rwth-aachen.de/data/Salaries.dat", header=T)model.all <-lm(salary~years, data=income) # for all cases, ignoring gendersummary(model.all)
Call:
lm(formula = salary ~ years, data = income)
Residuals:
Min 1Q Median 3Q Max
-168.02 -68.41 -24.68 82.95 176.79
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1323.160 63.962 20.69 <2e-16 ***
years 96.730 2.969 32.58 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 100.3 on 24 degrees of freedom
Multiple R-squared: 0.9779, Adjusted R-squared: 0.977
F-statistic: 1062 on 1 and 24 DF, p-value: < 2.2e-16