Introduction
In our previous lessons, we explored a set of powerful tools for analyzing paired or repeated categorical data. You learned how to use the McNemar test for 2x2 tables, the Stuart-Maxwell test for larger tables, and the Cochran Q test for binary outcomes measured at three or more points in time. These methods are all examples of what we can call test-based approaches. Their primary goal is to conduct a hypothesis test and answer a straightforward question: "Is there a statistically significant change or difference between the related groups?"
Today, we'll pivot to a more flexible and powerful framework. This lesson's goal is to contrast these test-based approaches with a model-based approach, specifically Conditional Logistic Regression (CLR). You will learn why and when a model is more advantageous than a simple test, particularly its ability to handle more complex research questions and provide richer insights. This comparison serves as a crucial bridge from analyzing simple contingency tables to the broader world of Generalized Linear Models (GLMs), which will be the focus of the next major part of our course.
1. The Test-Based Approach: A Recap
Let's quickly revisit the McNemar test, which is the simplest case for paired binary data.

The McNemar test focuses exclusively on the discordant pairs—the subjects who changed their status from Time 1 to Time 2 (e.g., went from "No" to "Yes" or "Yes" to "No"). It tests whether the number of subjects changing in one direction is significantly different from the number changing in the other.
Key Characteristics of the Test-Based Approach:
- Primary Goal: Hypothesis testing. It gives you a p-value to help you decide if an observed change is likely due to chance.
- Output: A single test statistic (like chi-squared) and a corresponding p-value.
- Limitation: It's a blunt instrument. It answers if there's a change, but it doesn't easily allow you to explore why there might be a change or to estimate the magnitude of that change while accounting for other factors. For example, you can't use a standard McNemar test to ask, "Did the new teaching method improve pass rates, after controlling for the students' prior academic performance?"
2. The Model-Based Alternative: Conditional Logistic Regression
This is where model-based approaches, like Conditional Logistic Regression (CLR), come in. Think of CLR as the regression-based equivalent of a McNemar test or a paired t-test.
The core idea of CLR is to analyze stratified data where each pair or matched set (e.g., a patient before and after treatment, or a case-control pair) forms its own stratum. The model then "conditions" the analysis on these strata. In doing so, it effectively removes any baseline differences between the pairs, allowing you to isolate the effect of the predictor you care about (e.g., treatment, time).
To understand this in more detail, let's explore a resource that directly compares these methods.
[PDF] Longitudinal Modeling with Logistic Regression
The following document, 'Longitudinal Modeling with Logistic Regression,' provides a clear, conceptual comparison between the McNemar test and conditional logistic regression for analyzing change over time.
Please read the sections titled 'Modeling Absolute Level Change with Logistic Regression' and the text immediately following it. Focus on how it introduces conditional logistic regression and draws a distinction between the 'aggregate' level (McNemar) and the 'individual' level (CLR).
3. Contrasting the Two Approaches
As the reading highlights, while both methods analyze paired data, they differ fundamentally in their goals, outputs, and flexibility. Let's break down the comparison.
Similarity: The Mathematical Link
For a simple pre-post design with a binary outcome, the McNemar test and a simple Conditional Logistic Regression model are closely related. The resource you just read points out a key connection: the score test from the CLR model is numerically identical to the McNemar's test statistic. This shows that the test-based method is essentially a simplified special case of the more general model-based approach.
Key Differences
The true power of the model-based approach lies in what it can do beyond the simple hypothesis test.
| Feature | Test-Based Approach (McNemar) | Model-Based Approach (CLR) |
|---|---|---|
| Primary Goal | Hypothesis testing ("Is there a significant change?") | Effect estimation and modeling relationships |
| Output | A p-value and a test statistic. | Coefficients (log-odds), which can be converted into Odds Ratios with confidence intervals. |
| Covariates | Cannot incorporate other explanatory variables. | Can easily include covariates. This is the main advantage. |
| Flexibility | Low. Designed for one specific question. | High. Can handle complex designs like 1-to-many matching and multiple predictors. |
The Power of Covariates: The ability to add covariates is a game-changer. With CLR, we can move from asking "Did the drug work?" to "Did the drug work, even after we account for the patient's age, disease severity, and gender?". This allows for a much more nuanced and robust analysis by controlling for potential confounding variables.
4. Marginal vs. Conditional Effects: A Deeper Look
The resource LINK introduced another important, albeit subtle, distinction.
- McNemar's test evaluates a population-averaged (or marginal) effect. It asks: "On average, across the entire population, did the proportion of 'successes' change?"
- Conditional Logistic Regression evaluates a subject-specific (or conditional) effect. It asks: "For a typical individual, what is the change in their odds of success?"
In many simple cases, these two perspectives will lead to the same conclusion. However, understanding this distinction is crucial as you move to more advanced models. The conditional effect estimated by models like CLR is often what we are truly interested in—how a factor affects an individual, given their unique characteristics.
5. A Practical Simulation: Which Approach Performs Better?
Theory is useful, but seeing how these methods perform with data provides the functional understanding you're looking for. The next resource presents a simulation study comparing five different methods for analyzing paired, clustered data, including McNemar's test and CLR.
Analyzing a binary outcome arising out of within-cluster, pair ...
This article, 'Analyzing a binary outcome arising out of within-cluster, pair...', runs a fantastic simulation to compare different analytical methods head-to-head. It's a great example of seeing when certain methods work and when they fail.
First, skim the 'Possible analytic solutions' section to see the methods being compared. Then, briefly look at the sections describing 'McNemar's test' and 'Conditional logistic regression' to see how they are implemented. Finally, read the 'Summary statistics' section carefully. This is where the author compares the performance of the methods in terms of error rates and bias.
Key Insights from the Simulation:
- Limited Output: The author notes that for McNemar's test, all you can assess is the p-value (Type I error rate or power). You don't get an effect estimate like an odds ratio.
- Model Superiority: The simulation shows that both conditional logistic regression and a related method (mixed-effects model) perform very well. They produce unbiased estimates of the treatment effect and have accurate standard errors.
- Model Failure: A standard logistic regression model that ignores the paired structure performed poorly, underestimating the standard errors and showing bias in some scenarios. This reinforces why specialized methods like CLR are necessary for paired data.
- The Verdict: The model-based approaches (like CLR) are superior because they not only provide a valid test but also give a reliable estimate of the effect size (the odds ratio), which is often more scientifically valuable than a p-value alone.
Conclusion
In this lesson, we bridged the gap between simple hypothesis tests and formal statistical modeling for paired data. You've seen that while test-based approaches like the McNemar test are useful for quick checks of statistical significance, they are limited in scope.
Key Takeaways:
- Test-based approaches (e.g., McNemar) are designed for hypothesis testing and provide a p-value as their primary output.
- Model-based approaches (e.g., Conditional Logistic Regression) are more flexible, providing effect estimates (odds ratios) and the ability to control for covariates.
- For simple paired binary data, the McNemar test is equivalent to the score test from a Conditional Logistic Regression model, showing the test is a special case of the model.
- The primary advantage of CLR is its ability to incorporate covariates, allowing for a more nuanced analysis that controls for confounding.
- CLR estimates a conditional (subject-specific) effect, which is often more relevant than the marginal (population-averaged) effect assessed by tests like McNemar's.
Preview of the Next Lesson:
This lesson has demonstrated why we need a more powerful modeling framework for analyzing categorical data. You've had a glimpse of logistic regression in a specific context (CLR). Now, it's time to build the foundation for this entire family of models. In our next lesson, we will begin our deep dive into Generalized Linear Models (GLMs). We will start by asking: why is ordinary linear regression often insufficient for outcomes that aren't continuous and normally distributed (like binary outcomes or counts)? This will lead us to defining the three core components that make GLMs so powerful and versatile.