[R] count regression zero count comparison
Achim.Zeileis at uibk.ac.at
Tue Sep 13 22:40:51 CEST 2011
On Tue, 13 Sep 2011, jekang wrote:
> It might be more of a statistical question than an R question.
> I was reading
> http://cran.r-project.org/web/packages/pscl/vignettes/countreg.pdf, and I
> was wondering why the following functions were used to compare zero counts
> (observed and predicted), instead of just using
> hist(fitted(fm_pois),plot=FALSE), then the counts of the bin of 0 (which is
> simply count of 0 from fitted values). This is because I get nice zero
> counts using the following functions, but my fitted (predicted) values are
> rather off, so I was wondering what the following comparison means as
> supposed to the fitted values.
fitted() computes the predicted means. These can be rather far from zero
while zero may still be the most likely count of the distribution
(especially in negative binomial models). See
for a somewhat more detailed example.
> R> round(c("Obs" = sum(dt$ofp < 1),
> + "ML-Pois" = sum(dpois(0, fitted(fm_pois))),
> + "NB" = sum(dnbinom(0, mu = fitted(fm_nbin), size = fm_nbin$theta)),
> + "NB-Hurdle" = sum(predict(fm_hurdle, type = "prob")[,1]),
> + "ZINB" = sum(predict(fm_zinb, type = "prob")[,1])))
> Obs ML-Pois NB NB-Hurdle ZINB
> 683 47 608 683 709
> Any comments would be appreciated. Thank you in advance.
> View this message in context: http://r.789695.n4.nabble.com/count-regression-zero-count-comparison-tp3810907p3810907.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help