I'm working on practice exercises with R. From the data, I now have to determine the difference in predicted male compared to female spending while keeping all other predictors constant.
I replaced the sex 0,1 with male, female:
> spending$sex=factor(spending$sex)
> levels(spending$sex)=c("male", "female")
> tail(spending)
sex status income verbal gamble
42 male 61 15.00 9 69.7
43 male 75 3.00 8 13.3
44 male 66 3.25 9 0.6
45 male 62 4.94 6 38.0
46 male 71 1.50 7 14.4
47 male 71 2.50 9 19.2
> summary(spending)
sex status income verbal
male :28 Min. :18.00 Min. : 0.600 Min. : 1.00
female:19 1st Qu.:28.00 1st Qu.: 2.000 1st Qu.: 6.00
Median :43.00 Median : 3.250 Median : 7.00
Mean :45.23 Mean : 4.642 Mean : 6.66
3rd Qu.:61.50 3rd Qu.: 6.210 3rd Qu.: 8.00
Max. :75.00 Max. :15.000 Max. :10.00
gamble
Min. : 0.0
1st Qu.: 1.1
Median : 6.0
Mean : 19.3
3rd Qu.: 19.4
Max. :156.0
Now, this is where I got stumped, how do I set this up with constants and only use the sex variable?