Re: [R] test the goodness of it for negative binomial type 2

2010-03-08 Thread casperyc

Hi Achim Zeileis-4,

That's very helpful.

Thanks!

-- 
View this message in context: 
http://n4.nabble.com/test-the-goodness-of-it-for-negative-binomial-type-2-tp1575892p1585357.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.


[R] test the goodness of it for negative binomial type 2

2010-03-02 Thread casperyc

[code]library(MASS)
x=c(rep(0,8096),
rep(1,1629),
rep(2,233),
rep(3,38),
rep(4,4)
)

x.bar=round(mean(x),4)
x.var=round(var(x),4)

p.hat=round(x.bar/x.var,4)
alpha.hat=round(x.bar*p.hat/(1-p.hat),4)

fitdistr(x, Negative Binomial)
fitdistr(x, Poisson)[/code]


1- fitdistr(x, Negative Binomial)
   the parameters got here, is it for negative binomial type 2?
   how can i ask it to use the methods of moments to calculat the
parameters?
   (p.hat and alpha.hat which i derived from methods of moments seem to give
a different value)

2-how can i fit it and than test the goodness of it?

3-then compare with the Poisson model?

Thanks

===

by negative binomial type two i mean 




-- 
View this message in context: 
http://n4.nabble.com/test-the-goodness-of-it-for-negative-binomial-type-2-tp1575892p1575892.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.