I see this it. glm(..., family = poisson) is also used for nb in get_model_pars(). Is it because glm.nb fails for some input, in which case it has to fall back to the poisson model?
if (method == 'nb') {
fit <- 0
try(fit <- glm.nb(as.formula(model_str), data = data_step1), silent=TRUE)
if (inherits(x = fit, what = 'numeric')) {
fit <- glm(as.formula(model_str), data = data_step1, family = poisson)
fit$theta <- as.numeric(x = theta.ml(y = y, mu = fit$fitted))
}
return(c(fit$theta, fit$coefficients))
I see this it.
glm(..., family = poisson)
is also used fornb
inget_model_pars()
. Is it becauseglm.nb
fails for some input, in which case it has to fall back to the poisson model?