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!