require(mosaic)
D
1. Response: salary Explanatory: sex
2. Response: salary Explanatory: years.experience
3. Response: promoted Explanatory: race
4. Response: laid.off Explanatory: age
a) Intercept: 3 z coef: 17 y coef: 4 x coef: -7
b) Intercept: 1.22 educ coef: 0.27 age coef: 0.12 age:educ coef: 0.04
c) Intercept: 8 colorRed coef: 3 colorBlue: -4
cps = fetchData("CPS85")
swim = fetchData("swim100m.csv")
utils = fetchData("utilities.csv")
feet = fetchData("KidsFeet")
a) 32
lm(age ~ married - 1, data = cps)
Call:
lm(formula = age ~ married - 1, data = cps)
Coefficients:
marriedMarried marriedSingle
39.2 32.3
b) C
lm(age ~ married, data = cps)
Call:
lm(formula = age ~ married, data = cps)
Coefficients:
(Intercept) marriedSingle
39.20 -6.88
c) 65
lm(time ~ sex - 1, data = swim)
Call:
lm(formula = time ~ sex - 1, data = swim)
Coefficients:
sexF sexM
65.2 54.7
d) -150
lm(ccf ~ as.factor(month), data = utils)
Call:
lm(formula = ccf ~ as.factor(month), data = utils)
Coefficients:
(Intercept) as.factor(month)2 as.factor(month)3
192.000 2.375 -62.250
as.factor(month)4 as.factor(month)5 as.factor(month)6
-113.625 -141.625 -178.111
as.factor(month)7 as.factor(month)8 as.factor(month)9
-182.667 -180.333 -176.556
as.factor(month)10 as.factor(month)11 as.factor(month)12
-149.875 -88.778 -0.875
a) B
b) B
c) E
a) -0.2599
b) -0.324
c) 0.174
a) A
b) A
c) C