Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero Inflated Negative Binomial Model #404

Open
FishModeler opened this issue Apr 26, 2023 · 1 comment
Open

Zero Inflated Negative Binomial Model #404

FishModeler opened this issue Apr 26, 2023 · 1 comment

Comments

@FishModeler
Copy link

Hello! I am looking for help/resources to guide me on how to change this zero-inflate Poisson model into zero-inflated negative binomial model. I don't see a function like dzipois that would easily take care of this issue. Could I somehow use dgampois in a zero-inflated negative binomial model? Any ideas? Thank you!!!

SitePoisson <- ulam(
alist(
SportfishCount ~ dzipois(pbar,lamba),
logit(pbar) <- z1+z2*Dim2
log(lamba)a + b * Dim1+c * Dim2+d * HTOY,
a ~ dnorm(1.85,2.76),
b ~ dnorm(1,100),
c ~ dnorm(1,100),
d ~ dnorm(0,1),
c(z1,z2)~dnorm(0,1)
),
data = ModelData,
start=list(a=0,b=0,c=0,d=0,z1=0.1,z2=0.2),
iter=5000,warmup=2000,chains =3, cores = 4, log_lik = TRUE
)

@rmcelreath
Copy link
Owner

There is no template for zigampois unfortunately. I can add it to the feature list. It is just a slight modification of dzipois.

In the meantime, you could get very close to zigampois by just adding random intercepts on each observation. That will add dispersion like a negative-binomial. It might be hard to get it to sample right, unless it is non-centered however.

Another approach is the modify the Stan code, if you are comfortable doing that. You can replace poisson with an appropriately parameterized negative-binomial. That's all that should be necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants