Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 27

CMH Test: Conditional Independence

Recommended resources

Introduction

In our last lesson, we learned how to use stratification to identify the presence of confounding. By comparing the crude measure of association from the overall data with an adjusted measure derived from stratum-specific tables, we could see when a third variable was distorting our results. This was a diagnostic process.

Today, we move from diagnosis to formal inference. This lesson focuses on the Cochran-Mantel-Haenszel (CMH) test, a powerful tool that allows us to test for an association between two variables while controlling for a confounder. By the end of this lesson, you will be able to describe the purpose of the CMH test for testing conditional independence. We'll explore why this test is necessary and how it provides a more powerful and less biased conclusion than simpler alternatives.


1. The Problem: Why Not Just Pool Data or Test Separately?

Imagine you've conducted a study on a new treatment and have data from several different clinics. You have a series of 2x2 tables, one for each clinic, showing treatment vs. outcome.

Stratified 2x2 Contingency Tables for CMH Test
This image illustrates a typical setup for a stratified analysis. We have a 2x2 table showing the relationship between an exposure/treatment (X) and an outcome (Y) for each level of a third variable, Z (here, 'Country' or 'Clinic').

You want to know if the treatment is effective overall. You have two intuitive but flawed options:

  1. Pool all the data: You could collapse all the tables into one large 2x2 table and run a single chi-square test.
    • The Flaw: As we saw in the last lesson, if the baseline risk or the mix of patients differs by clinic (i.e., the clinic is a confounder), this can lead to Simpson's Paradox, giving you a completely wrong answer.
  2. Test each table separately: You could run a chi-square or Fisher's exact test on each clinic's table.
    • The Flaw: Each individual clinic may have a small sample size. This results in low statistical power, meaning you might fail to detect a real, consistent treatment effect because the evidence in any single clinic is too weak.

The Cochran-Mantel-Haenszel test was designed to solve exactly this dilemma.


2. The Purpose of the CMH Test: Testing Conditional Independence

The CMH test allows us to test for an association between two variables (e.g., Treatment and Outcome) while controlling for a third variable (e.g., Clinic). It does this by asking a specific question: Are the exposure and outcome variables conditionally independent, given the third variable?

To understand this, let's read a brief but important definition.

STAT226 Winter 2017 Chapter 2D

This section from a set of lecture notes from the University of Chicago defines the key concept of conditional independence.

Please read the short section titled 'Conditional Independence' (page 6). Focus on the definition: X and Y are conditionally independent given Z if they are independent in each partial table.

As the reading states, "conditional independence" means there is no association within any of the strata. In the context of a 2x2 table, this is equivalent to the odds ratio being 1 in every stratum.

This leads us to the formal hypotheses for the CMH test:

  • Null Hypothesis (): The exposure and outcome are conditionally independent. This means that after controlling for the confounding variable, there is no association between exposure and outcome. In terms of odds ratios, this is equivalent to the common odds ratio across all strata being equal to 1.
  • Alternative Hypothesis (): The exposure and outcome are not conditionally independent. There is an overall association, meaning the common odds ratio is not equal to 1.

The purpose of the CMH test is therefore to evaluate this null hypothesis by pooling evidence across all strata without incorrectly collapsing them.


3. How the CMH Test Works

The CMH test achieves its goal by combining information from each partial table in a way that increases statistical power while avoiding bias. Let's look at a powerful example that demonstrates this.

STAT226 Winter 2017 Chapter 2D

The same lecture notes provide a classic example involving passive smoking and lung cancer, studied across three different countries. This example perfectly illustrates the purpose and power of the CMH test.

Please read the sections titled 'Cochran-Mantel-Haenszel (CMH) Test of Conditional Independence' and the two following 'Example: Lung Cancer and Passive Smoking' sections (pages 13-16). \nFocus on these key points: Notice that for each country (Japan, UK, US), the individual tests of association are not statistically significant (P-values are 0.14, 0.42, 0.09, etc.). Observe that the odds ratios in all three countries are greater than 1, suggesting a consistent direction of association. See how the CMH test combines these small, non-significant pieces of evidence to produce a single, statistically significant result (P-value ≈ 2%). Pay attention to the conceptual formula: the numerator is based on the sum of (Observed - Expected) counts, and the denominator is based on the sum of the variances.

The passive smoking example highlights the core utility of the CMH test:

  • It increases power: By combining the evidence from Japan, the UK, and the US, the test was able to detect an association that was too weak to be found in any single country's data.
  • It controls for confounding: The analysis correctly keeps the countries separate in the calculation, acknowledging that the baseline rates of lung cancer and the prevalence of smoking might differ across countries. A simple pooled analysis would have been inappropriate.

The logic of the test statistic, as shown in the reading, is to sum the deviations of the observed counts from what would be expected under the null hypothesis within each stratum. A large, consistent deviation across strata provides strong evidence against the null hypothesis of no association.


4. An Important Assumption: Homogeneity of Association

The CMH test is most appropriate and its results are most easily interpreted when the strength of the association is similar across the different strata. This is called the assumption of homogeneous association.

  • Homogeneous Association: The odds ratio is approximately the same in all strata ().
  • Heterogeneous Association (or Effect Modification): The odds ratio is substantially different across strata. For example, a treatment might have a strong positive effect in young patients () but a weak or even negative effect in old patients ().

If significant effect modification is present, the CMH test is still valid for testing the null hypothesis of conditional independence (). However, reporting a single "common odds ratio" can be misleading because it averages out important differences. In such cases, it's better to describe the association separately for each stratum.

Most statistical software that performs a CMH test also provides a companion test, often the Breslow-Day test, to check the assumption of homogeneity.

Let's look at a sample output to see how all these pieces fit together.

SAS Output for Cochran-Mantel-Haenszel (CMH) Test
This is a sample output from a statistical program (SAS) performing a stratified analysis. It shows:\n1. The stratified 2x2 tables ('Table 1' and 'Table 2').\n2. The 'Cochran-Mantel-Haenszel Statistics' table, which gives the p-value for testing conditional independence.\n3. An estimate of the 'Common Odds Ratio'.\n4. The 'Breslow-Day Test for Homogeneity of Odds Ratios', which tests the assumption that the odds ratios are consistent across strata.

In this example output, the CMH "General Association" test (p-value < 0.001) tells us to reject the null hypothesis of conditional independence. The Breslow-Day test (p-value = 0.536) tells us we have no reason to doubt the assumption of homogeneous odds ratios, making it appropriate to report the estimated common odds ratio.


Conclusion

In this lesson, we established the critical role of the Cochran-Mantel-Haenszel test in categorical data analysis. It provides a formal method for hypothesis testing in the presence of a potential confounder.

Key Takeaways:

  • The purpose of the CMH test is to test for conditional independence between two categorical variables, while controlling for a third stratifying variable.
  • It solves the problems of both pooling data (risk of Simpson's Paradox) and analyzing strata separately (low statistical power).
  • The null hypothesis () is that there is no association within any stratum, meaning the common odds ratio across all strata is 1.
  • The test works by combining evidence of association across all strata to produce a single test statistic and p-value.
  • The test is most meaningful when the association is homogeneous (similar) across strata, an assumption that can be checked with tests like the Breslow-Day test.

Preview of the Next Lesson:

The CMH test answers the question: "Is there an association, after controlling for confounding?" The next logical question is: "How strong is that association?" In the next lesson, we will focus on the Mantel-Haenszel estimate of the common odds ratio and how to formally test for the homogeneity of odds ratios, allowing us to decide whether it's appropriate to report this single summary measure.