[R] Chi square 1 d.f.
pdalgd at gmail.com
Fri May 17 00:52:28 CEST 2013
On May 16, 2013, at 23:41 , Luis Fernando García Hernández wrote:
> Dear Fellows,
> I am trying to find the exact p-value for some values using chisquare test
> with one d.f. So, for example the exact p-value for a calculated chi square
> of 14.62 would be 0,0038. I got this data on another software but I would
> like to know how to do it on R. Any advice will be really appreciated.
> pchisq(14.62, 1, lower=FALSE)
so that doesn't seem to be what you are looking for.
More likely, what your software is doing is to calculate the exact distribution of the chisquare statistic in the conditional distribution of a 2x2 table given both sets of marginals. Notice that this will depend on the particular table that you are looking at.
I suspect this is in one of the packages, but it shouldn't be too hard to code up explicitly using the hypergeometric distribution. The simulate.p.value argument to chisq.test does the same thing but using simulation.
> Thanks for your help!
> All the best!
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help