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)) 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% what is the difference between the two thanks bragadeesh
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 >
On Saturday 10 December 2005 17:37, 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))X and Y here are read as two columns of data when you use cbind with five rows. With cbind you have 4 DOF.> > 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%When not using cbind, you have 16 DOF. The numbers may look the same to you, but you are specifying two quite different sets of data,> > > what is the difference between the two > > thanks > > bragadeeshJWDougherty