Skip to content

Problem applying Chi-square in R and Cochran's Recommendations

2 messages · Manoj Aravind, Johannes Hüsing

#
Manoj Aravind <aravindbm at gmail.com> [Wed, Dec 29, 2010 at 03:59:16PM CET]:
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
you 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: 

[...]
Note that these are recommendations which you are free to heed or ignore.