Skip to content
Prev 328827 / 398498 Next

How to apply a function to every element of a dataframe, when the function uses for each colummn and row different values to calculate with?

On Aug 21, 2013, at 00:01 , David Winsemius wrote:

            
A bit of a misquote there; chisq.test has

            STATISTIC <- sum((abs(x - E) - YATES)^2/E)

The abs() ensures that the Yates correction is towards zero.

(a few lines above, we have

                YATES <- min(0.5, abs(x - E))

which avoids the embarrassment of a positive chi-square when x==E).

If YATES==0, he squaring of course makes abs() superfluous.