0
$\begingroup$

I am trying to fit a GAM to a continuous variable which is zero-inflated. However, since my variable is continuous, I am not able to use ziP() for a zero-inflated quasi-Poisson. Is there someway to fit a zero-inflated Quasi-Poisson to the family in GAM using the package mgcv?

Thanks!

$\endgroup$
2
$\begingroup$

No, there is no zero-inflated quasi-Poisson family in mgcv.

For a continuous response with point mass on 0, you can use the tw() family to fit a model where the response is assumed to be a draw from one of the Tweedie family of distributions with support on the non-negative real values. The specific Tweedie distributions allowed in mgcv are those where the power parameter of the distribution lies within the range 1 and 2, the endpoints indicating a Poisson or a Gamma distribution respectively.

If needed, the twlss() allows you model the location (mean) as well as the scale and shape parameters of the Tweedie family of distributions.

The idea here would be that the covariates would help identify those parts of the covariate space where you gets 0s (which we hope we can model as having a small mean and possibly other parameters such that the zeroes in the data, in this part of the covariate space, are well modelled and not considered excess).

If your covariates are not informative for the zeroes, then you aren't going to be able to fit a model you need using mgcv. There are zero-altered or hurdle Gamma families in the brms and gamlss packages and both, to some extent allow you to use mgcv-like smooths in the definition of the model formula. I have had good success with such models in the brms package in particular, which fits models in a fully Bayesian framework using the Stan probabilistic programming language, with brms providing the friendly interface. gamlss takes a likelihood-based approach to estimation, and for reasonable amounts of data is not especially fast, so you're not going to gain much computationally over the HMC (MCMC)-based brms/Stan.

It might be worth thinking about how you get 0s in a continuous variable. Can you actually measure a 0 and differentiate that from a value that is almost but not quite zero in your measurement system? For example, in environmental fields, 0s crop up a lot where people really have a censored data problem; observations that fall below a certain lower limit of detection are coded (sometimes) as zero and hence aren't true zeros. A zero-altered/hurdle Gamma would work OK in that situation, or if you know the limit of detection, you could also use a censored Gamma model, which brms can also handle nicely.

$\endgroup$
  • $\begingroup$ Thank you Gavin for the detailed explanation. I used the Tweedie family and it worked quite well. The zeros in my data are actually informative and show an important biological response which is why I had to keep them. $\endgroup$ – ChzM Oct 31 '19 at 15:25

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