4
$\begingroup$

I am running a hurdle model using the glmmTMB function. My dependent variable is continuous and >= 0. I was looking for a function that would allow me to model the binary response in a logistic regression (i.e the zero inflated model) and the non-zero response in a Gamma (log) regression (i.e the conditional model). However, the glmmTMB function does not allow to use the gamma family.

I have two questions:

  1. is there a function that allows to run a GLMM with gamma family? I tried to write my own code to have these two models but I am not sure about how to predict and calculate CIs.

  2. Is it appropriate to use a truncated negative binomial family for the conditional (non-zero values) model? I ran the model:

hpm_nb <- glmmTMB(percapita_dia ~ Tipo_residuo + (1|Trip_ID), zi=~Tipo_residuo, all, family=truncated_nbinom2)

The diagnostics plots look good and model predictions are reasonable. Is it still wrong to have a truncated negative binomial family?

diagnostics plots for hurdle model hpm_nb

$\endgroup$

1 Answer 1

4
$\begingroup$

I'm not sure why you say that glmmTMB can't handle zero-inflated Gamma responses: the glmmTMB news file says (for version 1.0.0, release 2020-02-03):

new ziGamma family (minor modification of stats::Gamma) allows zero-inflation (i.e., Gamma-hurdle models)

I'd say it's not crazy to use a truncated negative binomial, but I'd be worried as it doesn't make statistical sense (technically, the likelihood of any non-integer value is 0 ...) (If you really had count data, a zero-inflated NB rather than a hurdle would be a reasonable option ...)

Given the distribution/density functions for each distribution, parameterized in terms of the mean $\mu$ and a shape/dispersion parameter ($k$ for NB, $a$ for Gamma):

$$ \textrm{NB}: \qquad \frac{(k/(k+\mu))^k}{\Gamma(k)} \cdot \frac{\Gamma(k+x)}{x!} \cdot (\mu/(k+\mu))^x $$

$$ \textrm{Gamma}: \qquad \frac{1}{(\mu/a)^a \Gamma(a)} \cdot x^{a-1} \cdot e^{-(x/(\mu/a))} $$

I think you may? be able to show that NB converges approximately to Gamma for large $x$ (but someone better/more dedicated than I am will need to do the math ...)

An empirical demonstration (not "proof"!)

hist(rnbinom(100000,mu=100,size=2),freq=FALSE,ylim=c(0,0.008), breaks=100)
curve(dgamma(x,scale=100/2,shape=2),add=TRUE,col=2,lwd=2)

enter image description here

This definitely doesn't work for small mean (try it with mean=4 rather than 100 ...)

Your approach would be closely related to the fractional logistic model (probably with the same strengths and weaknesses).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.