Sun, Ying [BSD] - HGD
2008-Aug-21 16:45 UTC
[R] how to use chisq.test with 2 row matrix having 0 in it?
Hi, I am working on calculating X^2 for some matrix (most of them have either two rows or 2 columns) by using chisq.test in R. However when there are 0s in the matrix, chisq.test does not work. For example: ===================> elements <- matrix( c( 0, 0, 9, 5, 71, 168), nr = 2 )> elements[,1] [,2] [,3] [1,] 0 9 71 [2,] 0 5 168> chisq.test( elements )Pearson's Chi-squared test data: elements X-squared = NaN, df = 2, p-value = NA Warning message: Chi-squared approximation may be incorrect in: chisq.test(elements) =================== Would anyone help me to figure out how to do it even there are 0s? Thanks a lot!! Becky This email is intended only for the use of the individua...{{dropped:12}}
Apparently Analagous Threads
- Why two chisq.test p values differ when the contingency
- chisq.test using amalgamation automatically (possible ?!?)
- Why two chisq.test p values differ when the contingency table is transposed?
- chisq test and fisher exact test
- chisq.test vs manual calculation - why are different results produced?