I'm running a regression in RStudio with a continuous outcome and several predictors. One of my predictors is categorical and has 5 categories. Its classed as factor. When I run my regression all the categories but two disappear. I've checked my contrasts and know that the 'Home' category is being used as a reference category, but can't for the life of me figure out why my regression isn't showing the rest of the categories (multiple and other).
I'm aware I could code each category as a dummy variable, but I'd prefer not to since I'm trying to show students how to do this and am not sure why this is happening. I'm probably doing something stupid, but if anyone has ideas, that would be greatly appreciated!
USwave1$jobplace <- recode(USwave1$jbpl, "1='Home';2='Office';3='Travels';4='Multiple';5=NA;97='Other'")
table(USwave1$jobplace)
Home Multiple Office Other Travels
547 1734 19973 110 2146
contrasts(USwave1$jobplace)
Multiple Office Other Travels
Home 0 0 0 0
Multiple 1 0 0 0
Office 0 1 0 0
Other 0 0 1 0
Travels 0 0 0 1
model1 <- lm(data = USwave1, formula = "jbsat ~ jobplace + a_age_dv + male + commute + paytype + hours")
summary(model1)
Call:
lm(formula = "jbsat ~ jobplace + a_age_dv + male + commute + paytype + hours",
data = USwave1)
Residuals:
Min 1Q Median 3Q Max
-4.7483 -0.4544 0.5777 0.8533 2.7738
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.2635590 0.0635886 82.775 < 2e-16 ***
jobplaceOffice -0.1669841 0.0431742 -3.868 0.00011 ***
jobplaceTravels -0.1463690 0.0564316 -2.594 0.00950 **
a_age_dv 0.0076257 0.0008414 9.063 < 2e-16 ***
male -0.1201247 0.0227431 -5.282 1.29e-07 ***
commute -0.0025803 0.0004612 -5.595 2.23e-08 ***
paytypeSalaried 0.2036349 0.0234411 8.687 < 2e-16 ***
hours -0.0044555 0.0010723 -4.155 3.27e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.508 on 20815 degrees of freedom
(30171 observations deleted due to missingness)
Multiple R-squared: 0.01241, Adjusted R-squared: 0.01208
F-statistic: 37.37 on 7 and 20815 DF, p-value: < 2.2e-16 ```
jbsat ~ jobplace
? $\endgroup$