Skip to content
Prev 361024 / 398503 Next

how to perform multiple comparison?

thanks for your help.


?? ??????
On 2016-05-20 09:48 , David Winsemius Wrote:
It appears your question is which row(s) are contributing most greatly to the overall test of independence. The result of a `chisq.test(.)` (which is not what you see from its print method) has a component named residuals. (Read the help page : ?chisq.test)

x2 <- chisq.test(dat)
x2$residuals
          [,1]       [,2]
[1,] -2.3580463  2.4731398
[2,]  1.4481733 -1.5188569
[3,]  0.9323855 -0.9778942



Those row sums should be distributed as chi-squared statistics with one degree of freedom each, but since you have admittedly inflated the possibility of the type I error, it would be sensible to adjust the "p-statistics" using the function that Jim Lemon misspelled:
[1] 11.676803  4.404132  1.825620
[1] 0.001898526 0.071703921 0.176645786

So row 1 represents the only group that is "significantly different at the conventional level" from the expectations based on the overall sample collection. I also seem to remember that there is a function named CrossTable (in a package whose name I'm forgetting) that will deliver a SAS-style tabulation of row and column chi-squared statistics.

--
David.
David Winsemius
Alameda, CA, USA