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}}
______________________________________________
[email protected] 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.