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.
>
Hmmm,
> pchisq(14.62, 1, lower=FALSE)
[1] 0.0001315114
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
> 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.
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com