[R] Poisson example from Snedechor & Cochran
Christoph Scherber
Christoph.Scherber at agr.uni-goettingen.de
Wed Nov 15 18:14:06 CET 2006
Dear R users,
I am trying to reproduce table 7.4.12 (page 131) from Snedechor &
Cochran (eigth edition); the example is counts of weed seeds with a
fitted Poisson distribution, tested for goodness-of-fit using a Chi-square:
observed=c(3,17,26,16,18,9,3,5,0,1,0,0)
expected=dpois(0:11,lambda=3.020408)*98
chisq.test(observed,p=expected,rescale.p=T)
Now the problem I have is that chisq.test gives me the chi-squared value
of roughly 8.30 (which is the value given by Snedechor & Cochran), but I
am wondering why the warning message occurs at the end of the test.
Further, it is not clear to me how these calculations could be done
using the full dataset of N=98 observations:
observed.full=rep(0:11,c(3,17,26,16,18,9,3,5,0,1,0,0))
What would the correct specification for a chisq.test against a poisson
distribution look like in this case?
Thanks for your help!
Best wishes
Christoph
##
Chi-squared test for given probabilities
data: observed
X-squared = 8.2628, df = 8, p-value = 0.4082
Warning message:
Chi-squared approximation may be incorrect in: chisq.test(observed, p =
expected, rescale.p = T)
More information about the R-help
mailing list