Skip to main content
added 416 characters in body
Source Link

EDIT

As per request, I include a very silly repex that shows the issue

# generate data with 75% zero
y <- tibble(observed = rep(c(1,0,0,0), 25))

# fit the model w/o zero-inflation, then turn to ~1 to fix and run it
mod <- glmmTMB(observed ~ 1, 
            family = truncated_nbinom2(),
            data = y, 
            ziformula = ~ 0)

summary(mod)

EDIT

As per request, I include a very silly repex that shows the issue

# generate data with 75% zero
y <- tibble(observed = rep(c(1,0,0,0), 25))

# fit the model w/o zero-inflation, then turn to ~1 to fix and run it
mod <- glmmTMB(observed ~ 1, 
            family = truncated_nbinom2(),
            data = y, 
            ziformula = ~ 0)

summary(mod)
added 207 characters in body
Source Link

I should note that I am adding random effects in my model, and I believe glmmTMBis the only package that can handle all the aspects at once. If that's not the case, please let me know.

When implementing thosethe hurdle/zi in glmmTMB, the argument ziformula = enables the zero-inflation model, while family = truncated_nbinom2() defines the hurdle model

m0 <- glmmTMB(formulay ~ var1 + ... + varN + (1 | id),   
          offset = log(offset), 
          data = df,                  
          family = truncated_nbinom2(),
          ziformula= ~ .)

When implementing those in glmmTMB, the argument ziformula = enables the zero-inflation model, while family = truncated_nbinom2() defines the hurdle model

m0 <- glmmTMB(formula + (1 | id),   
          offset = log(offset), 
          data = df,                  
          family = truncated_nbinom2(),
          ziformula= ~ .)

I should note that I am adding random effects in my model, and I believe glmmTMBis the only package that can handle all the aspects at once. If that's not the case, please let me know.

When implementing the hurdle/zi in glmmTMB, the argument ziformula = enables the zero-inflation model, while family = truncated_nbinom2() defines the hurdle model

m0 <- glmmTMB(y ~ var1 + ... + varN + (1 | id),   
          offset = log(offset), 
          data = df,                  
          family = truncated_nbinom2(),
          ziformula= ~ .)
added 167 characters in body
Source Link

Choosing between the two becomes a crucial analytical design conditioning the interpretation of the results, conditional to the study design and tested hypotheses.

Choosing between the two becomes a crucial analytical design conditioning the interpretation of the results, conditional to the study design and tested hypotheses.

Source Link
Loading