2
$\begingroup$

I am trying to fit a zero-inflated Poisson GAM to my count data, and I want a log link. ziP() from the mgcv package does not support the log link.

What can I do?

$\endgroup$

2 Answers 2

1
$\begingroup$

If you mean you want a log link for the Poisson part then the model is actually parameterised in terms of $\log(\mu_i)$ where $\mu_i = E(y_i)$. In other words the link is implied but you need to take care of any backtransformation; predictions and fitted values will be on the log scale, even if you use predict(..., type = 'response') (double check I have this right as it's a while since I used this and I'm going off the help page; run predict() with type = 'link' and type = 'response', and note if they are the same.)

The other option in mgcv is to use the ziplss(), but it again is coded in terms of the log Poisson response and the login of probability of presence, such that both links are 'identity'.

$\endgroup$
0
$\begingroup$

an option that I know is available to you is to fit a Bayesian model in brms Bürkner (2017). This uses an lme4-style syntax.

This package has zero-inflated poission models with a log-link, as listed here: https://rdrr.io/cran/brms/man/brmsfamily.html

It also allows for the fitting of smooth terms using similar syntax to mgcv. Here is an example tutorial: https://fromthebottomoftheheap.net/2018/04/21/fitting-gams-with-brms/

The only downside will be if you are completely unfamiliar with Bayesian methods, this will require some reading up, fortunately, the brms and Stan documentation is very detailed and helpful. You will probably need to specify non-flat priors for the sampling to run properly.

Bürkner, P. C. (2017). brms: An R package for Bayesian multilevel models using Stan. Journal of statistical software, 80(1), 1-28.

$\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.