[R] Help re zinb model

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Thu Jan 4 11:41:55 CET 2007

On Thu, 4 Jan 2007, blomsp at ozemail.com.au wrote:

> Remember that -2 * the difference in the likelihoods between the two 
> models is asymptotically chi-squared distributed, with degrees of 
> freedom equal to the difference in number of parameters between the 
> models. So you can just calculate that for your preferred and null 
> models, then use the pchisq function
> to test significance. Get the likelihoods from obj$maxlike.

The function lrtest() in package "lmtest" offers a flexible implementation 
of this which works for fitted models that provide a logLik() method. The 
zicounts() implementation does not, but zeroinfl() in package "pscl". E.g. 
you can do:

data("teeth", package = "zicounts")
fm1 <- zeroinfl(dmft ~ gender + age | gender + age, data = teeth,
   dist = "negbin")
fm2 <- zeroinfl(dmft ~ 1, data = teeth, dist = "negbin")

lrtest(fm1, fm2)


More information about the R-help mailing list