Mantel-Haenszel chi-squared test with continuity correction
data: data
Mantel-Haenszel X-squared = 6.0702, df = 1, p-value = 0.01375
alternative hypothesis: true common odds ratio is not equal to 1
95 percent confidence interval:
1.061250 1.608976
sample estimates:
common odds ratio
1.306723
The p-value is 0.01375, showing that the two variables(hand and hair) are not independent.
The Chi-square statistic is 6.07.
Remember that for CMH test, the degree of freedom is always ONE.
If the p-value is significant, we can reject the null hypothesis (the two variables are independent). But if the p-value is nonsignificant, we can't say that the null is true. What we need to do is to analyze strata by strata to look at each 2 by 2 table.
There is a output named ''common odds ratio", which is meaningful only when the assumption-- odds ratio across strata is the same -- is true. How can we tell the trend is the same in each table? The answer is Breslow-Day test.
The import thing is to input the data in the right form. The form should be an array with 2 X 2 X q dimension, q is the number of strata. The following code is an example in Cochran–Mantel–Haenszel test for repeated tests of independence.
The result is as follows.
The p-value is 0.01375, showing that the two variables(
hand
andhair
) are not independent. The Chi-square statistic is 6.07.