count regression zero count comparison

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

count regression zero count comparison

jekang
Hello,

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.

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.

Sincerely,

Jamie
Reply | Threaded
Open this post in threaded view
|

Re: count regression zero count comparison

Achim Zeileis-4
On Tue, 13 Sep 2011, jekang wrote:

> Hello,
>
> 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
https://stat.ethz.ch/pipermail/r-help/2011-June/279765.html
for a somewhat more detailed example.

hth,
Z

> 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.
>
> Sincerely,
>
> Jamie
>
> --
> 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.
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: count regression zero count comparison

jekang
Thank you, it helped me clear some confusions.

Jamie