Hi all, I am hoping someone can help with a problem I have. I want to do a zero-inflated negative binomial model on some count data. I have found how to get the model (using zicounts), and the test of each predictor on both the negative binomial and zero-inflated parts of the distribution. Can anyone tell me how I can also get an omnibus test of significance for the fit of the model? Stata I think gives a likelihood ratio chi-square test of the full versus null model for the zinb model. Is there a way to get this in R? Alternatively, is there a way I use the deviance, or maximum likelihood value to derive this? Cheers Philippe Lacherez
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. HTH, Simon. Philippe Lacherez wrote: [Hide Quoted Text]> Hi all, > > I am hoping someone can help with a problem I have. I want to do a > zero-inflated negative binomial model on some count data. I have found > how to get the model (using zicounts), and the test of each predictor on > both the negative binomial and zero-inflated parts of the distribution. > Can anyone tell me how I can also get an omnibus test of significance for > the fit of the model? Stata I think gives a likelihood ratio chi-square > test of the full versus null model for the zinb model. Is there a way to > get this in R? Alternatively, is there a way I use the deviance, or > maximum likelihood value to derive this? > > Cheers > Philippe Lacherez > > ______________________________________________ > R-help at 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. >-- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. ---------------------------------------------------------------- This message was sent using MyMail
Of course that should have been differences in the log-likelihoods in my previous post. Aaargh. Simon. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. ---------------------------------------------------------------- This message was sent using MyMail
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: 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