I have troubles understanding how goodfit() function in the vcd package
computes the Pearson coefficient. Can anybody provide more information
on the computation?
In particular, for HorseKicks data in vcd package, goodfit() yields
> oo <- goodfit(HorseKicks,type="poisson",method="MinChisq")
> summary(oo)
Goodness-of-fit test for poisson distribution
X^2 df P(> X^2)
Pearson 0.594649 3 0.8976563
Warning message:
In summary.goodfit(oo) : Chi-squared approximation may be incorrect
However, if I compute the Pearson coefficient by hand, I get a different
value for chi-squared
> with(oo, sum( (observed-fitted)^2/fitted ))
[1] 0.694577
I am not sure where I am making a mistake. Any suggestions?
Regards,
Boris.
______________________________________________
[email protected] 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.