0

While I was working on a project, I stuck into an error saying

glm.fit: fitted probabilities numerically 0 or 1 occurred

when I tried glm() with full model. Before including quadratic and interaction terms into the model, it worked fine. How can I resolve this?

My data temp has 11 variables and 1 response variable (12 columns) with 201 rows (observations).

The below is my code:

test2 <- glm(Y ~ (Age_Q16 + COPD + HighSch + Widodiv + Married + DISABLED + CEREBROVASCULAR_DISEASE + VALVE_DISEASE + NITRATES + Q9 + Q14Down)^2
             + Age_Q16sq + Q9sq + Q14Downsq,temp,family=binomial("logit"),maxit=100)

summary(test2)
Maylo
  • 572
  • 5
  • 16
  • My guess is that you need more data to fit such a complex model. – Roman Luštrik Apr 23 '20 at 11:29
  • I am supposed to start with a full model with both interactions and quadratic terms. Then, I remove highest p-value regressors one by one and re-fit the model until I have all the remaining (excluding main terms when interaction or quadratic terms are significant) terms have p-values < 0.05. – Mincheol Shin Apr 23 '20 at 11:31
  • As @RomanLuštrik says, you probably have insufficient data to fit this model. I also noticed `Q14Down)^2` - if you want quadratic terms in your model you have to "protect" the exponentiation by the Inhibit function `I()`, that is you write `I(Q14Down^2)` if you want Q14Down^2 in your model – James Curran Apr 23 '20 at 12:06

0 Answers0