Hello! Welcome back to our module on analyzing matched data.
In our previous lesson, we established a crucial point: standard, or unconditional, logistic regression is not suitable for matched-pair data. We saw that ignoring the matching structure leads to bias, and trying to control for it with dummy variables triggers the Incidental Parameters Problem (IPP), leading to even more severe bias. This left us with a critical need for a different analytical approach.
Today, we'll explore the solution: Conditional Logistic Regression (CLR). Our main goal is to see how this powerful technique relates to a method you've already learned about—the McNemar test. By the end of this lesson, you will be able to explain how the McNemar test can be viewed as a simple, special case of a conditional logistic regression model.
The Core Idea: Conditioning to Remove Nuisance Parameters
The downfall of the unconditional fixed-effects model was that the number of "nuisance" parameters (the intercepts for each pair) grew with the sample size, corrupting the estimate of our main parameter of interest, .
Conditional Logistic Regression solves this problem with a clever statistical strategy: instead of trying to estimate the parameters, it eliminates them from the calculation entirely. It does this by conditioning the analysis on a sufficient statistic for those nuisance parameters.
While that sounds complicated, the intuition is straightforward. Let's think about a 1-to-1 matched case-control study. We have pairs of individuals, one case () and one control (). We want to see if an exposure () is associated with the outcome. Consider the possible pairs:
- Concordant Unexposed: Both case and control were unexposed.
- Concordant Exposed: Both case and control were exposed.
- Discordant Pair A: The case was exposed, but the control was not.
- Discordant Pair B: The control was exposed, but the case was not.
Which of these pairs actually tells us about the effect of the exposure? The concordant pairs (1 and 2) provide no information. If both individuals in a pair have the same exposure status, we can't learn anything about how that exposure distinguishes a case from a control. The "action" is entirely within the discordant pairs (3 and 4), where the exposure status differs.
Conditional Logistic Regression formalizes this intuition. It focuses the analysis only on the set of pairs where the outcomes are different. Within these informative strata (the discordant pairs), it calculates the probability of observing the actual pattern of exposure, given the set of all possible patterns that could have occurred. This process of "conditioning" on the number of positive outcomes within each pair makes the terms cancel out of the likelihood equation, solving the Incidental Parameters Problem.
The following reading explains this foundational concept.
Section 8.2 Logistic Regression For Matched Pairs
This document introduces the logic behind subject-specific models (another term for conditional models) and explains why a conditional approach is necessary.
Please read slide 13, titled 'Estimate of β in the Subject Specific Model'. Focus on the key takeaway: for pairs where the outcomes differ (Y1i + Y2i = 1), the conditional distribution is free of the problematic αi parameter. Note the resulting estimate for the conditional odds ratio, eβ.
As the reading shows, by conditioning on the discordant pairs, the maximum likelihood estimate for the conditional odds ratio () simplifies to a very familiar expression:
Where:
- is the count of discordant pairs where the case was exposed and the control was not.
- is the count of discordant pairs where the case was not exposed but the control was.
Does this fraction look familiar? It should! It's the ratio of the discordant cells that forms the basis of the McNemar test.
Making the Connection: CLR and McNemar's Test
Let's make this connection explicit. In Module 4, you learned that McNemar's test is used to compare paired proportions. Its test statistic is:
This statistic tests the null hypothesis that the probabilities of the two types of discordance are equal. In other words, it tests .
Now, consider the conditional logistic regression model. It estimates an odds ratio of . A statistical test for this model (like a Wald test) would test the null hypothesis that the true log-odds ratio is zero (). This is equivalent to testing if the odds ratio is one ().
If the odds ratio is 1, then , which implies . This is exactly the same null hypothesis as the McNemar test.
Therefore, for a 1-to-1 matched study with a single binary predictor, performing a conditional logistic regression is equivalent to performing a McNemar test. They are two different paths to the same conclusion.
The following practical example demonstrates this equivalence perfectly.
clogit — Conditional (fixed-effects) logistic regression
The Stata documentation for conditional logistic regression (clogit) provides a fantastic worked example that directly compares its output to the McNemar's test command (mcc).
Please read from the bottom of page 9 through page 10. The example starts with 'Using clogit, we obtain the following results:'. Follow the steps where the author first fits a clogit model, then reshapes the data to run the mcc command. Compare the odds ratio estimates from both methods.
As you saw in the example, both clogit and mcc produce the exact same point estimate for the odds ratio (2.75). The confidence intervals are slightly different due to different calculation methods, but the core finding is identical.
This visual reinforces the strong agreement between the two methods.

CLR as a Generalization of McNemar's Test
If conditional logistic regression just gives the same answer as a McNemar test, why bother with the more complex model?
The answer is that CLR is a far more general and flexible framework. The equivalence we've demonstrated holds only in the simplest possible scenario:
- A 1-to-1 matched design.
- A single predictor variable, which is binary (exposed vs. unexposed).
The McNemar test can't handle anything more complex. Conditional logistic regression, however, can easily be extended to situations where the McNemar test is not applicable:
- Multiple Predictors: What if you want to know the effect of smoking, while also controlling for alcohol consumption and diet? You can add all these variables to a CLR model.
- Continuous Predictors: What if your predictor of interest is a continuous variable like age or blood pressure? CLR handles this naturally.
- Complex Matching: CLR can analyze studies with 1 case matched to multiple controls (1:k matching) or even multiple cases matched to multiple controls (k1:k2 matching).
In this sense, it's best to think of the McNemar test as a special, simplified version of a conditional logistic regression model.
clogit — Conditional (fixed-effects) logistic regression
The same Stata document explicitly makes this point about generalization.
Please read the 'Technical note' at the end of the first column on page 9. It concisely states how clogit extends the McNemar test.
Conclusion
Today we connected a new, powerful technique to a familiar one. We saw how conditional logistic regression elegantly solves the Incidental Parameters Problem by conditioning the analysis on the discordant pairs, thereby eliminating the need to estimate the problematic subject-specific intercepts.
Key Takeaways:
- Conditional Logistic Regression (CLR) avoids the Incidental Parameters Problem by using a conditional likelihood that removes the nuisance parameters () from the estimation.
- For matched pairs, this means the analysis effectively focuses only on the discordant pairs, which contain all the information about the exposure's effect.
- In the simple case of a 1-to-1 matched study with a single binary predictor, the conditional logistic regression model is statistically equivalent to the McNemar test.
- The estimated odds ratio from the CLR model in this simple case is .
- CLR is a generalization of the McNemar test, capable of handling multiple predictors (both categorical and continuous) and more complex matching schemes (e.g., 1:k).
Preview of the Next Lesson:
Now that you understand the "what" and "why" of conditional logistic regression and its relationship to the McNemar test, our next lesson will delve deeper into the "how". We will formally examine how the conditional likelihood is constructed to eliminate the nuisance parameters, which is the theoretical engine that makes this entire method work.