Manoj Aravind
2010-Dec-29 14:59 UTC
[R] Problem applying Chi-square in R and Cochran's Recommendations
Sir,
I have a problem here while applying chisquare test to the following Data (
below the subject of this mail) ...when I wanted to test the significance
using three different free statistical packages, here R, EpiInfo and
OpenEpi.
*Only OpenEpi accepts the test based on Cochran's Recommendations. *
R says " chi squared approximation may be incorrect."
Does it mean the same as what EpInfo saying " Chi square is not valid"
Regards,
Dr. B. Manoj Aravind.
*Table for analysis*
Number of STDs Identified
Type of Health worker <2 2 or >
ASHA 39 5
AWW 22 1
ANM 1 12
......................................
*In R the ouput was like this....*
> std<- cbind(c(39,22,1),c(5,1,12))
> std
[,1] [,2]
[1,] 39 5
[2,] 22 1
[3,] 1 12> chisq.test(std)
Pearson's Chi-squared test
data: std
X-squared = 43.8055, df = 2, p-value = 3.074e-10
Warning message:
In chisq.test(std) : *Chi-squared approximation may be incorrect*
In EpInfo the output was this
Analysis of Single Table
An expected cell is <5. *Chi square is not valid.*
Chi square = 43.81
2 degrees of freedom
P<0.00000000 <--
.....................................
In OpenEpi the output was like this
Single Table AnalysisVar 2 39 544Var 1221 2311213 621880 Chi Square for R
by C Table
------------------------------
Chi Square=43.81Degrees of Freedom=2p-value= <0.0000001 Cochran recommends
accepting the chi square if: 1. No more than 20% of cells have expected <
5.2.
No cell has an expected value < 1. In this table: 17% of 6 cells have
expected values < 5.No cells have expected values < 1. *Using these
criteria, this chi square can be accepted.* Expected value = row
total*column total/grand total Rosner, B. Fundamentals of Biostatistics. 5th
ed. Duxbury Thompson Learning. 2000; p. 395
[[alternative HTML version deleted]]
Johannes Huesing
2010-Dec-29 15:22 UTC
[R] Problem applying Chi-square in R and Cochran's Recommendations
Manoj Aravind <aravindbm at gmail.com> [Wed, Dec 29, 2010 at 03:59:16PM CET]:> Sir, > > I have a problem here while applying chisquare test to the following Data ( > below the subject of this mail) ...when I wanted to test the significance > using three different free statistical packages, here R, EpiInfo and > OpenEpi. > > *Only OpenEpi accepts the test based on Cochran's Recommendations. * > R says " chi squared approximation may be incorrect." > Does it mean the same as what EpInfo saying " Chi square is not valid"Yes. Take confidence from the fact that arithmetically all three programs arrive at the same result (anything but surprising). The recommendations when to trust Chi-Square are similar. R lets you look at the source though, so if you type> chisq.testyou get a result containing the following lines: sr <- rowSums(x) sc <- colSums(x) E <- outer(sr, sc, "*")/n (so E contains the expected values for the cell entries) and names(PARAMETER) <- "df" if (any(E < 5) && is.finite(PARAMETER)) warning("Chi-squared approximation may be incorrect") so it seems that R is fussier about the quality of the approximation than EpiInfo: [...]> ------------------------------ > Chi Square=43.81Degrees of Freedom=2p-value= <0.0000001 Cochran recommends > accepting the chi square if: 1. No more than 20% of cells have expected < 5.2. > No cell has an expected value < 1. In this table: 17% of 6 cells have > expected values < 5.No cells have expected values < 1. *Using these > criteria, this chi square can be accepted.* Expected value = row > total*column total/grand total Rosner, B. Fundamentals of Biostatistics. 5th > ed. Duxbury Thompson Learning. 2000; p. 395 >Note that these are recommendations which you are free to heed or ignore. -- Johannes H?sing There is something fascinating about science. One gets such wholesale returns of conjecture mailto:johannes at huesing.name from such a trifling investment of fact. http://derwisch.wikidot.com (Mark Twain, "Life on the Mississippi")