[R] test the goodness of it for negative binomial type 2
casperyc
casperyc at hotmail.co.uk
Wed Mar 3 00:56:08 CET 2010
[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.
More information about the R-help
mailing list