[Rd] chi-square test

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Tue Apr 19 11:05:38 CEST 2005


if you print "chisq.test()" you'll see when this warning message 
appears (i.e., if any expected count is less than 5, in which case it 
is known that the approximation to the Chi-squared distribution may 
not be adequate).

Alternatively, you could simulate to approximate the reference 
distribution of the statistic and obtain an estimation of the p-value 
using:

chisq.test(matrix(c(20.1, 18.5, 2.6, 32.9, 23.5, 5.4), nc = 2), 
simulate.p.value = TRUE)

I hope it helps.

Best,
Dimitris

p.s., you should send this message to r-help and not r-devel.

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm



----- Original Message ----- 
From: "Benjamin Chan [BRE]" <Benjamin.Chan at inet.polyu.edu.hk>
To: <r-devel at stat.math.ethz.ch>
Sent: Tuesday, April 19, 2005 10:47 AM
Subject: [Rd] chi-square test


>
> a warning message appears when i use the chisq.test ,but it doesnt
> appear everytime, why?
> "Warning message:
> Chi-squared approximation may be incorrect in:
> chisq.test(matrix(c(20.1, 18.5, 2.6, 32.9, 23.5, 5.4), nc = 2)) "
>
> why does the warning message appear, please?
> Thank you very much
> here is the data which I have tried appear and not appear warning
> message
>
> have warning message
> (1.3,4.9,12.6,10.5,5.5,6.5,4.7,9.8,10.3,23.2,7.3,6.6)
> (13.8,8.4,8.7,10.4,25.5,28.7,2.5,5.1)
> (20.1,18.5,2.6,32.9,23.5,5.4)
>
> doesnt have warning message
> (32.7,8.6,2561.5,2726.5)
> (44.4,17.4,2561.5,2726.5)
> (44.4,17.4,32.7,8.6)
> (13.9,22.3,5.1,17.4,32.3,12)
> (8.1,5.2,13.8,11.5,2.6,15.8,15.5,9.6,6.7,14.2)
> (13.9,17.4,22.3,1740,2230,1390)
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list