Phelo Pitsha
Phelo Pitsha

Reputation: 23

r codes to model robust zero-inflated negative binomial and poisson

How to model the robust count data models such as zero-inflated negative binomial and Poisson in r, specifically I wanted their R codes if they differ from their standard normal but I believe they are

This is what I have tried

# Fit zero-inflated negative binomial model
zeroinf_nb_model <- zeroinfl(counts ~ predictor | 1, data = data, dist = "negbin", link = "logit")

but I believe this is more like the standard zero-inflated negative binomial not the robust zero-inflated negative binomial

Upvotes: 2

Views: 325

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226182

Are you looking for robust estimates of the covariance matrix? If so, this RPubs document seems to give the answer, e.g.:

library(pscl)
library(sandwich)
library(lmtest)
fm_zip <- zeroinfl(art ~ . | 1, data = bioChemists)
coeftest(fm_zip, vcov = sandwich)

Using dist="negbin" seems to work just as well. To confirm that vcov = sandwich is actually doing something, run coeftest() without it and compare the results ...

Upvotes: 3

Related Questions