[R] Why two chisq.test p values differ when the contingency
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Tue Jul 15 22:00:04 CEST 2003
On 15-Jul-03 Tao Shi wrote:
>>x
> [,1] [,2]
> [1,] 149 151
> [2,] 1 8
>>t(x)
> [,1] [,2]
> [1,] 149 1
> [2,] 151 8
>>chisq.test(x, simulate.p.value=T, B=100000)
> Pearson's Chi-squared test with simulated p-value (based on
> 1e+05 replicates)
> data: x
> X-squared = 5.2001, df = NA, p-value = 0.03774
>
>>chisq.test(t(x), simulate.p.value=T, B=100000)
> Pearson's Chi-squared test with simulated p-value (based on
> 1e+05 replicates)
> data: t(x)
> X-squared = 5.2001, df = NA, p-value = 0.01642
Possibly you may just have been unlucky, though the 0.03774 seems large:
c2x<-chisq.test(x, simulate.p.value=T, B=100000)$p.value
for(i in (1:9)){c2x<-c(c2x,chisq.test(x, simulate.p.value=T,
B=100000)$p.value)}
c2tx<-chisq.test(tx, simulate.p.value=T, B=100000)$p.value
for(i in (1:9)){c2tx<-c(c2tx,chisq.test(tx, simulate.p.value=T,
B=100000)$p.value)}
cbind(c2x,c2tx)
c2x c2tx
[1,] 0.01627 0.01720
[2,] 0.01672 0.01690
[3,] 0.01662 0.01669
[4,] 0.01733 0.01656
[5,] 0.01679 0.01777
[6,] 0.01715 0.01769
[7,] 0.01765 0.01769
[8,] 0.01703 0.01740
[9,] 0.01704 0.01708
[10,] 0.01669 0.01655
sd(c2x)
[1] 0.0003946715
sd(c2tx)
[1] 0.0004737099
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 15-Jul-03 Time: 21:00:04
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list