[R] chisq.test() as a goodness of fit test
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Thu Jan 13 19:39:08 CET 2005
On Thu, 13 Jan 2005 18:23:37 +0100 (CET) Vito Ricci wrote:
> Dear R-Users,
>
> How can I use chisq.test() as a goodness of fit test?
> Reading man-page Ive some doubts that kind of test is
> available with this statement. Am I wrong?
>
> X2=sum((O-E)^2)/E)
>
> O=empirical frequencies
> E=expected freq.
You can do
chisq.test(O, p = E/sum(E))
but note that this assumes that the expected frequencies/probabilities
are known (and not estimated).
> calculated with the model (such as normal distribution)
"Normal distribution" is not a fully specified model! If you estimate
the parameters by ML, the inference will typically not be valid. Another
approach would be to estimate the parameters by grouped ML or minimum
Chi-squared instead. See also ?pearson.test from package nortest and the
references therein.
For discrete distributions, this Chi-squared statistic is more natural
(though not always without problems): see ?goodfit in package vcd.
Z
> See:
> http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm
> for X2 used as a goodness of fit test.
>
> Any help will be appreciated.
> Thank a lot. Bye.
> Vito
>
>
> =====
> Diventare costruttori di soluzioni
> Became solutions' constructors
>
> "The business of the statistician is to catalyze
> the scientific learning process."
> George E. P. Box
>
> Top 10 reasons to become a Statistician
>
> 1. Deviation is considered normal
> 2. We feel complete and sufficient
> 3. We are 'mean' lovers
> 4. Statisticians do it discretely and continuously
> 5. We are right 95% of the time
> 6. We can legally comment on someone's posterior distribution
> 7. We may not be normal, but we are transformable
> 8. We never have to say we are certain
> 9. We are honestly significantly different
> 10. No one wants our jobs
>
>
> Visitate il portale http://www.modugno.it/
> e in particolare la sezione su Palese
> http://www.modugno.it/archivio/palese/
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list