Reputation: 1
I get an error response when a full simple logistic model is run in R. However this only occur when I include SHTCVD191_A (which is not the variable with the most missing values). Including the variables with the most missing values SHTCVD19NM_A and SHOTTYPE_A without SHTCVD191_A (which is integral to the study) runs perfectly. On the other hand, running a model with SHTCVD191_A and all other predictors excluding SHTCVD191NM_A and SHOTTYPE_A runs perfectly. All variables have been confirmed to be factors and missing values have been dropped. I would appreciate insight into how to fix this.
model_8c <- glm(CVD ~ SEX_A + PHSTAT_A + AGEP_A + EDUCP_A + RACEALLP_A + SHTCVD191_A + SHOTTYPE_A + SHTCVD19NM_A, family = binomial, data = data)
Error in ``contrasts<-(
tmp, value = contr.funs[1 + isOF[nn]])
:
contrasts can be applied only to factors with 2 or more levels`
I have tried running other model as well. multinomial and removing missing data. I have also tried using the methods I came across on stack overflow. However, it still didn't fix the error response.
Upvotes: 0
Views: 21