[R] chisq.test, basic question

Brett Magill bmagill at earthlink.net
Tue Jul 30 21:55:46 CEST 2002


>From help(chisq.test)

If `x' is a matrix with at least two rows and columns, it is taken as a
two-dimensional contingency table, and hence its entries should be nonnegative
"INTEGERS".

-----Original Message-----
From: juli g. pausas [mailto:juli at ceam.es]
Sent: Tuesday, July 30, 2002 12:12 PM
To: r-help
Subject: [R] chisq.test, basic question


Dear R-users,
I have a question, which I'm not sure if it is related to my
misunderstanding of basic statistics, or my misunderstanding of R, or
both.
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).
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

Should this give about the same (a part from the rounding)? Should the
degree of association between P and R be he same?  Or, am I using
chisq.test() wrongly?

Thanks in advance,

Juli


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._


------------------------------------------------------------------------------

Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that
may be confidential, proprietary copyrighted and/or legally privileged, and is
intended solely for the use of the individual or entity named in this message.
 If you are not the intended recipient, and have received this message in
error, please immediately return this by e-mail and then delete it.

==============================================================================


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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