I am running a logistic regression on a dataframe that contains numeric, binary and factor variables. The df is similar to this:
df <- data.frame(
"Industry"=
c("A","A","A","A","A","A","A","B","B","B","B","B","B","B","C","C","C","C","C","C","C"),
"Revenue"=rnorm(21),
"CEOCHAIRMAN"= c(TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE),
"Size"=rnorm(21))
Nevertheless, when I run my logistic regression, only 2 of the 3 factor levels are in the output:
mod1<-glm(df$CEOCHAIRMAN ~
+ factor(df$Industry)
+ df$Revenue
+ df$Size,
family=binomial, maxit=100)
Call: glm(formula = df$CEOCHAIRMAN ~ +factor(df$Industry) + df$Revenue +
df$Size, family = binomial, maxit = 100)
Coefficients:
(Intercept) factor(df$Industry)B factor(df$Industry)C df$Revenue
0.25228 -0.66707 -0.02695 -0.04896
df$Size
0.20427
Degrees of Freedom: 20 Total (i.e. Null); 16 Residual
Null Deviance: 29.06
Residual Deviance: 28.39 AIC: 38.39
How can I include all the levels?