[R] chisq.test, basic question
Ivan Frohne
frohne at mtaonline.net
Tue Jul 30 20:51:30 CEST 2002
----- Original Message -----
From: "juli g. pausas" <juli at ceam.es>
To: "r-help" <r-help at stat.math.ethz.ch>
Sent: Tuesday, July 30, 2002 08:11
Subject: [R] chisq.test, basic question
> I've got the counts of a 2 x 2 contingency table, and I'd like to test
> the association:
>
> m <- matrix(c(15,28,32,135), 2, 2)
> colnames(m) <- c("R-", "R+"); rownames(m) <- c("P-", "P+")
> m
> # R- R+
> # P- 15 32
> # P+ 28 135
>
> chisq.test(m) # X-squared = 4.0027, df = 1, p-value = 0.04543
>
> Is this the correct way to test association between P and R? (I haven't
> got the original data).
This the right way to do the 2X2 table chi-square test.
> My problem is that if I use percentage, then I get different results:
>
> m2 <- 100*m/sum(m) #
> chisq.test(round(m2)) # X-squared = 1.5318, df = 1, p-value = 0.2158
This is incorrect. Don't use percentages. You could have the
same percentages with a total sample of 10, say, as with a
sample of 1000.
--Ivan Frohne
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list