Re: [R] Help re zinb model

From: Achim Zeileis <Achim.Zeileis_at_wu-wien.ac.at>
Date: Thu 04 Jan 2007 - 10:41:55 GMT

On Thu, 4 Jan 2007, blomsp@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:

library("pscl")
data("teeth", package = "zicounts")
fm1 <- zeroinfl(dmft ~ gender + age | gender + age, data = teeth,

   dist = "negbin")
summary(fm1)
fm2 <- zeroinfl(dmft ~ 1, data = teeth, dist = "negbin") summary(fm2)

library("lmtest")
lrtest(fm1, fm2)

hth,
Z



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Jan 04 21:47:29 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 04 Jan 2007 - 13:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.