1

I'm getting a weird error when modeling a section of the data, and I can't really figure out why.

The code goes as following:

model <- glm(var1 ~ var2, family = binomial(), data = data)

If you print model you get the model and it looks normal:

Call:  glm(formula = var1 ~ var2, family = binomial(), data = data)

Coefficients:
(Intercept)         var2  
   -3.34510      0.06737  

Degrees of Freedom: 28682 Total (i.e. Null);  28681 Residual
  (4794 observations deleted due to missingness)
Null Deviance:      13870 
Residual Deviance: 13740    AIC: 13740

If you try to extract the coefficient this too works:

model$coefficients %>% exp()

(Intercept)        var2 
  0.0352567   1.0696926 

but when trying to obtain the confidence interval it throws an error:

model %>% confint()

Error in profile.glm(object, which = parm, alpha = (1 - level)/4, trace = trace) : 
  profiling has found a better solution, so original fit had not converged

Thanks!

Edi Itelman
  • 423
  • 5
  • 14
  • [This related answer](https://stackoverflow.com/a/37336010/903061) suggests trying the `glm2` package. You could also try running more iterations, perhaps adding `control = list(maxit = 100)` as an argument to your `glm` call. I am suspicious that there are convergence issues with a 1-feature model... some plots of the data might help diagnose issues. – Gregor Thomas Dec 02 '20 at 15:49

0 Answers0