On Aug 21, 2013, at 00:01 , David Winsemius wrote: > > fmat <- (abs(x - E) )^2/E > > (I'm not sure why that abs is in the `chisq.test` code.)
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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.