My Coyne
2008-Jan-15 05:51 UTC
[R] In chisq.test(x) : Chi-squared approximation may be incorrect
Hello, I received the following warning when running chi-square; n Is there a way to catch the 'error' code of 'warning' after run chisq.test(x)? n What does this error mean? Thank you for your help. [[alternative HTML version deleted]]
anna freni sterrantino
2008-Jan-16 01:52 UTC
[R] In chisq.test(x) : Chi-squared approximation may be incorrect
Hi! the warning you got "Chi-squared approximation may be incorrect" is because probably there are less than 5 observations in the cell. Maybe will help to try fisher.test() Cheers Anna ----- Messaggio originale ----- Da: My Coyne <mcoyne@boninc.com> A: r-help@stat.math.ethz.ch Inviato: Lunedì 14 gennaio 2008, 21:51:30 Oggetto: [R] In chisq.test(x) : Chi-squared approximation may be incorrect Hello, I received the following warning when running chi-square; n Is there a way to catch the 'error' code of 'warning' after run chisq.test(x)? n What does this error mean? Thank you for your help. [[alternative HTML version deleted]] ______________________________________________ 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. ___________________________________ ttp://it.docs.yahoo.com/nowyoucan.html [[alternative HTML version deleted]]
David Winsemius
2008-Jan-16 04:33 UTC
[R] In chisq.test(x) : Chi-squared approximation may be incorrect
"My Coyne" <mcoyne at boninc.com> wrote in news:000e01c8573a$ad60c8a0$082259e0$@com:> I received the following warning when running chi-square; > > n Is there a way to catch the 'error' code of 'warning' after run > chisq.test(x)?It is not an error message. It is a warning message. When I assign the result of chisq.test(.) to an object and then look at its structure with str(), I do not see the warning message "in there". Instead the message appears on the console. When you look at the chisq.test function itself you see that any "E" less than 5 will trigger the warning: if (any(E < 5) && is.finite(PARAMETER)) warning("Chi-squared approximation may be incorrect") You should be able to check the <object>$expected matrix in a similar manner if you goal is to process a large number of tables programatically.> > n What does this error mean?See above. Consider invoking chisq.test with the simulate.p.value option. -- David Winsemius