[R] Help: chisq.test

Kjetil Brinchmann Halvorsen kjetilbrinchmannhalvorsen at gmail.com
Sun Dec 11 02:53:27 CET 2005


Thanjavur Bragadeesh wrote:
> I have two groups of patients (improved or not improved) named x and y group 
> respectively after being treated with 5 different drugs
> 
> X<-c(43,52,25,48,57) and
> 
> Y<-c(237,198,245,212,233)
> 
> when I run
> 
> chisq.test(cbind(x,y))
> 

This takes cbind(X,Y) as a contingency table,which is what you want.

> I get a p value of <0.0024
> 
> but if I run
> 
> chisq.test(x,y)   I get a p value of 0.22 not significant at 5%

This is the same as chisq.test(table(X,Y)), which is the test on the 
contingency table

 > table(X,Y)
     Y
X    198 212 233 237 245
   25   0   0   0   0   1
   43   0   0   0   1   0
   48   0   1   0   0   0
   52   1   0   0   0   0
   57   0   0   1   0   0

which is not what you want.

Kjetil

> 
> 
> what is the difference between the two
> 
> thanks
> 
> bragadeesh
> 
> ______________________________________________
> 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