# 条件逻辑回归

条件逻辑回归是一种针对匹配数据或精细分层数据中二分类结局的回归方法，例如匹配病例对照研究。它通过对每个层进行条件化来估计协变量效应，使层特异的截距从似然中消去。它是个体匹配病例对照研究的主要分析方法，给出的是条件优势比而非边际优势比。<sup>[1](https://pmc.ncbi.nlm.nih.gov/articles/PMC2827892/)</sup> 它应当与两种替代方法区分开。为每个层包含单独截距的非条件逻辑回归，在层较小且冗余截距的数量随样本量增长时是不一致的<sup>[2](https://www.mayo.edu/research/documents/biostat-65pdf/doc-10027676)</sup><sup> • </sup><sup>[3](https://www.sciencedirect.com/science/article/abs/pii/S0378375800002172)</sup>，这正是条件化所避免的附带参数问题。简单忽略匹配的合并模型通常并不等价，且可能产生偏倚；其是否适用取决于匹配设计和协变量。

| 关键事实 | 详情 |
|---|---|
| 估计什么 | 匹配组内协变量的条件优势比；截距和匹配变量的效应不被估计<sup>[1](https://pmc.ncbi.nlm.nih.gov/articles/PMC2827892/)</sup><sup> • </sup><sup>[4](https://people.stat.sc.edu/hoyen/STAT705/Notes/Lecture12.pdf)</sup> |
| 模型形式 | 每个匹配组有自己的截距 \( \alpha_{k} \)，斜率 \( \beta \) 共通；条件化消去 \( \alpha_{k} \)<sup>[5](https://library.virginia.edu/data/articles/matched-case-control-studies-and-conditional-logistic-regression)</sup> |
| 计算等价性 | 与时间恒定的分层Cox模型的精确部分似然具有相同的似然；R的clogit()调用coxph()<sup>[6](https://search.r-project.org/CRAN/refmans/survival/html/clogit.html)</sup> |
| 信息性数据 | 在1:1匹配中，只有不一致对提供信息；以 \( n_{10} \) 计病例暴露而对照未暴露的对数，\( n_{01} \) 计相反情况，优势比为 \( n_{10}/n_{01} \)<sup>[4](https://people.stat.sc.edu/hoyen/STAT705/Notes/Lecture12.pdf)</sup> |
| 为何不用非条件极大似然 | 层数很多时，层虚拟变量造成Neyman-Scott附带参数问题，估计有偏且不一致<sup>[3](https://www.sciencedirect.com/science/article/abs/pii/S0378375800002172)</sup> |
| 软件 | R中的clogit()（survival包）、Stata中的clogit、SAS中带ties=discrete的PROC PHREG<sup>[6](https://search.r-project.org/CRAN/refmans/survival/html/clogit.html)</sup><sup> • </sup><sup>[7](https://www.stata.com/manuals14/rclogit.pdf)</sup><sup> • </sup><sup>[2](https://www.mayo.edu/research/documents/biostat-65pdf/doc-10027676)</sup> |

## 工作原理

层特异模型为 \( \mathrm{logit}[\pi_{k}(X)] = \alpha_{k} + \beta' \cdot X \)：每个匹配组或层 \( k \) 有自己的截距 \( \alpha_{k} \)，但斜率系数 \( \beta \) 在各层间共通。<sup>[4](https://people.stat.sc.edu/hoyen/STAT705/Notes/Lecture12.pdf)</sup> 由于每层通常只有一个病例，\( \alpha_{k} \) 无法通过非条件极大似然良好估计，因此通过对充分统计量（通常是每层观察到的病例数和对照数）进行条件化来将其消去。<sup>[4](https://people.stat.sc.edu/hoyen/STAT705/Notes/Lecture12.pdf)</sup> 第 \( k \) 层的条件似然是观察到的病例分配相对于所有 \( c_{k} = n_{k}!/(n_{1k}!\,(n_{k}-n_{1k})!) \) 种在 \( n_{k} \) 名受试者中分配 \( n_{1k} \) 个病例的可能分配的概率。<sup>[8](https://wnarifin.github.io/lecture/mstat/conditional.pdf)</sup> 在 \( n \) 个层（每层一个病例）上写出，即为<sup>[9](https://link.springer.com/article/10.1186/s12859-024-05850-2)</sup>

\[ L(\beta) = \prod_{i=1}^{n} \frac{\exp\{X_{i1}^{\top} \cdot \beta\}}{\sum_{l=1}^{K}\exp\{X_{il}^{\top} \cdot \beta\}} \]

其中层特异截距作为冗余参数从似然中消去。对单个风险集，贡献为 \( \exp[\beta \cdot x_{\mathrm{case}}]/\sum_{j}\exp[\beta \cdot x_{j}] \)，得分为 \( x_{\mathrm{case}} - x_{\mathrm{weighted}} \)，估计通过Newton-Raphson法进行。<sup>[10](https://www.jhanley.biostat.mcgill.ca/bios602/CondnlLogisticRegrn/ch-notes-29.pdf)</sup> 在1:1匹配中，条件似然与二项似然成比例，对数优势比的条件极大似然估计为 \( \log(n_{10}/n_{01}) \)，对 \( \beta = 0 \) 的条件得分检验即McNemar统计量，\( Z^{2} = (n_{10} - n_{01})^{2}/(n_{10} + n_{01}) \)。<sup>[11](https://people.musc.edu/~bandyopd/bmtry711.11/lecture_26.pdf)</sup> 同一似然在生存分析中还有第二种用途：将每个病例/对照组建为自己的层、时间设为常数、状态对病例编码为1对对照编码为0的分层Cox模型，其精确部分似然与条件逻辑回归具有相同的似然公式。<sup>[6](https://search.r-project.org/CRAN/refmans/survival/html/clogit.html)</sup>

## 操作方法

在标准软件包中工作流程很直接。数据按每名受试者一行排列，包含病例指示变量、协变量，以及每个匹配组或匹配变量唯一组合的层标识符。<sup>[12](https://019b2da8-edfb-a262-61be-7973c056d9ae.share.connect.posit.cloud/blr-conditional.html)</sup>

- **R。** survival包中的clogit()使用形如 case.status ~ exposure + strata(matched.set) 的公式，默认使用精确条件似然；它创建虚拟时间（全为1）并调用coxph()。<sup>[6](https://search.r-project.org/CRAN/refmans/survival/html/clogit.html)</sup>
- **Stata。** clogit拟合1:1、1:k2i或k1i:k2i匹配的匹配病例对照数据，匹配比可在各组间变化；递归算法计算似然，对组大小无限制。<sup>[7](https://www.stata.com/manuals14/rclogit.pdf)</sup>
- **SAS。** 带ties=discrete的PROC PHREG利用Cox似然等价性<sup>[2](https://www.mayo.edu/research/documents/biostat-65pdf/doc-10027676)</sup>；NCSS同样通过Cox回归拟合该模型，对1:1和1:n匹配推荐Breslow结处理方法，对m:n匹配推荐Efron方法。<sup>[13](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/NCSS/Conditional_Logistic_Regression.pdf)</sup>

优势比报告为 \( \mathrm{OR}(x_{i}) = e^{\beta_{i}} \)，显著性通过Wald统计量 \( W = \hat{\beta}/\mathrm{SE}(\hat{\beta}) \) 或似然比检验 \( G = 2(\ell_{1} - \ell_{0}) \) 评估，其中 \( \ell_{0} \) 和 \( \ell_{1} \) 分别为零模型和拟合模型的对数似然；模拟研究通常表明似然比检验表现更好。<sup>[8](https://wnarifin.github.io/lecture/mstat/conditional.pdf)</sup><sup> • </sup><sup>[13](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/NCSS/Conditional_Logistic_Regression.pdf)</sup> 输出中不含截距，模型也不估计匹配变量与结局之间的关联。<sup>[12](https://019b2da8-edfb-a262-61be-7973c056d9ae.share.connect.posit.cloud/blr-conditional.html)</sup> 条件逻辑回归的回归诊断包括用于识别有影响匹配组的似然位移度量。<sup>[2](https://www.mayo.edu/research/documents/biostat-65pdf/doc-10027676)</sup>

## 起源

N. E. Breslow及其同事于1978年在《美国流行病学杂志》上发表《匹配病例对照研究中多重相对风险函数的估计》，对匹配病例对照研究的条件逻辑回归做出了有影响力的发展，尽管该方法更早的使用在数十年间未被认识。<sup>[14](https://doi.org/10.1093/oxfordjournals.aje.a112623)</sup> 一篇历史综述指出，该模型最早的使用在数十年间未被认识。<sup>[15](https://jhanley.biostat.mcgill.ca/Reprints/HanleyFirstCondnlLogisticRegression.pdf)</sup> 在经济学和其他社会科学中，同一模型被称为面板数据的固定效应logit，由Gary Chamberlain在《定性数据的协方差分析》（《经济研究评论》，1980年）中引入。<sup>[16](https://doi.org/10.2307/2297110)</sup><sup> • </sup><sup>[7](https://www.stata.com/manuals14/rclogit.pdf)</sup> 后来的方法学工作塑造了实践：Mitchell Gail、Jay Lubin和Lawrence Rubinstein于1981年（《Biometrika》）引入了条件似然计算的快速递归，后来被纳入R survival包的2.36-11版本<sup>[17](https://doi.org/10.1093/biomet/68.3.703)</sup><sup> • </sup><sup>[6](https://search.r-project.org/CRAN/refmans/survival/html/clogit.html)</sup>，John Connett、Judith Smith和Richard McHugh于1987年给出了配对匹配研究的大样本样本量公式。<sup>[18](https://doi.org/10.1002/sim.4780060107)</sup>

## 变体

**匹配比。** 该方法不限于1:1配对；一个病例可匹配两个或更多对照，Stata的clogit处理匹配比可变的通用k1i:k2i匹配。<sup>[5](https://library.virginia.edu/data/articles/matched-case-control-studies-and-conditional-logistic-regression)</sup><sup> • </sup><sup>[7](https://www.stata.com/manuals14/rclogit.pdf)</sup> 每个匹配组超过五个对照通常没有意义。<sup>[5](https://library.virginia.edu/data/articles/matched-case-control-studies-and-conditional-logistic-regression)</sup>

**频数匹配与复杂抽样。** 有限总体抽样模型产生加权条件逻辑似然，可容纳频数匹配、反向匹配、病例队列、随机招募和配额抽样设计。<sup>[19](https://dornsife.usc.edu/larry-goldstein/wp-content/uploads/sites/221/2023/06/cond.pdf)</sup> 反向匹配使用与暴露相关的信息抽取对照，可提高效率：在一项模拟中，零假设下频数匹配所需的对照数约为1:1反向匹配设计的三倍，才能达到相同的效率。<sup>[19](https://dornsife.usc.edu/larry-goldstein/wp-content/uploads/sites/221/2023/06/cond.pdf)</sup>

**面板数据。** 由clogit拟合的固定效应logit是同一模型，应用于受试者内的重复二分类结局。<sup>[7](https://www.stata.com/manuals14/rclogit.pdf)</sup> 病例交叉设计——每名受试者作为自己的对照——是一种特殊的匹配病例对照设计，用同一工具分析。<sup>[20](https://link.springer.com/article/10.1186/1471-2105-16-S6-S1)</sup>

**惩罚与贝叶斯扩展。** Stephen Reid和Rob Tibshirani的clogitL1包（2014年）通过循环坐标下降为条件模型提供lasso和弹性网正则化路径。<sup>[21](https://doi.org/10.18637/jss.v058.i12)</sup> 2024年的R包penalizedclr实现惩罚条件逻辑回归，对不同协变量块使用不同的lasso或岭惩罚，面向多组学整合，并用稳定性选择进行变量选择<sup>[9](https://link.springer.com/article/10.1186/s12859-024-05850-2)</sup>；块惩罚思想沿用Anne-Laure Boulesteix及其同事的IPF-LASSO（2017年）<sup>[22](https://doi.org/10.1155/2017/7691937)</sup>，稳定性选择沿用Nicolai Meinshausen和Peter Bühlmann（2010年）的方法。<sup>[23](https://doi.org/10.1111/j.1467-9868.2010.00740.x)</sup> Jacob Tennenbaum和Adam Kapelner引入了贝叶斯条件逻辑回归（包bclogit，2026年），通过从一致对预模型为冗余协变量系数构建经验贝叶斯先验，从传统条件似然所丢弃的一致对中挽救信息；处理系数本身从不被该先验收缩。<sup>[24](https://cran.r-project.org/web/packages/bclogit/refman/bclogit.html)</sup> 对数F惩罚条件逻辑回归（2026年）解决1:M设计中的小样本偏倚，可通过添加少量人工暴露不一致匹配组来实现，因此标准软件即可满足。<sup>[25](https://arxiv.org/html/2607.28899)</sup>

## 应用

流行病学中的匹配病例对照研究是主要应用。实例包括一项低出生体重研究，其中clogit给出吸烟的优势比为2.75（95% CI 1.22至6.18）<sup>[5](https://library.virginia.edu/data/articles/matched-case-control-studies-and-conditional-logistic-regression)</sup>，以及一个1:2匹配心肌梗死示例（39名患者，117名受试者），收缩压每mmHg的优势比为1.047。<sup>[26](https://dmrocke.ucdavis.edu/Class/EPI204-Spring-2021/Lecture7ConditionalLikelihood.pdf)</sup> 人口科学中的应用包括一项2018年美国出生数据分析，其中既往早产对NICU入院的优势比为3.07（95% CI 1.65至5.71），病例和对照按母亲教育程度和年龄匹配。<sup>[12](https://019b2da8-edfb-a262-61be-7973c056d9ae.share.connect.posit.cloud/blr-conditional.html)</sup> 在经济学和社会学中，固定效应logit用于面板二分类结局<sup>[7](https://www.stata.com/manuals14/rclogit.pdf)</sup>，惩罚版本应用于匹配多组学数据的预测。<sup>[9](https://link.springer.com/article/10.1186/s12859-024-05850-2)</sup>

在1:1匹配中，一致对（病例和对照均暴露，或均未暴露）不提供关于效应的信息；只有不一致对为 \( \beta \) 提供信息。<sup>[4](https://people.stat.sc.edu/hoyen/STAT705/Notes/Lecture12.pdf)</sup><sup> • </sup><sup>[11](https://people.musc.edu/~bandyopd/bmtry711.11/lecture_26.pdf)</sup> 因此检验效能取决于不一致对的数量，而非总对数。二分类结局配对匹配研究的样本量表格基于精确二项检验，使用Connett大样本公式的修改版以及处理冗余参数（不一致对比例）的实用策略。<sup>[27](https://onlinelibrary.wiley.com/doi/10.1002/sim.4780120709)</sup><sup> • </sup><sup>[18](https://doi.org/10.1002/sim.4780060107)</sup>

## 局限与替代方法

**无截距，无绝对风险。** 由于似然对每个匹配组进行条件化，不估计截距，层内的基线平均结局无法恢复。<sup>[28](https://rawcdn.githack.com/mcarabali1/EPIB-704/49ee454d3028cb175556ba9382dce915d3d9cf6c/slides/L14matchingandconditionallogisticregression.pdf)</sup> 如果感兴趣的参数是边际因果效应，则不能使用条件逻辑回归，因为它只估计条件优势比。<sup>[1](https://pmc.ncbi.nlm.nih.gov/articles/PMC2827892/)</sup>

**匹配变量丢失。** 一旦对因素进行匹配，其效应便无法估计；它们成为冗余参数，其效应从条件似然中消去。<sup>[4](https://people.stat.sc.edu/hoyen/STAT705/Notes/Lecture12.pdf)</sup><sup> • </sup><sup>[11](https://people.musc.edu/~bandyopd/bmtry711.11/lecture_26.pdf)</sup> 在面板应用中，组内不变化的变量与固定效应共线，无法估计。<sup>[7](https://www.stata.com/manuals14/rclogit.pdf)</sup>

**带层虚拟变量的非条件回归。** 当冗余截距的数量随样本量增长时（Neyman-Scott或Andersen附带参数问题），极大似然是不一致的<sup>[3](https://www.sciencedirect.com/science/article/abs/pii/S0378375800002172)</sup>，而在匹配设计中，忽略匹配的分析可能使估计的优势比向任一方向偏倚，取决于设计和数据。<sup>[28](https://rawcdn.githack.com/mcarabali1/EPIB-704/49ee454d3028cb175556ba9382dce915d3d9cf6c/slides/L14matchingandconditionallogisticregression.pdf)</sup> 然而，对于匹配因素为分类变量的频数匹配设计，正确设定的非条件逻辑回归可能比条件逻辑回归的估计效率更高；条件拟合仍然更实用，因为它较少依赖建模选择。<sup>[29](https://www.stat.ubc.ca/~john/papers/WanSIM2022.pdf)</sup>

**稀疏数据。** 条件极大似然在小样本或稀疏分层数据中可能产生无穷优势比估计和单调似然<sup>[30](https://onlinelibrary.wiley.com/doi/10.1002/sim.3794)</sup>；在一个DES示例中，八个病例中有七个暴露且无对照暴露，标准clogit()无法收敛。<sup>[25](https://arxiv.org/html/2607.28899)</sup> Firth型惩罚条件似然在小样本模拟中给出几乎无偏的对数优势比，区间覆盖接近名义水平<sup>[30](https://onlinelibrary.wiley.com/doi/10.1002/sim.3794)</sup>，建立在David Firth 1993年偏倚减少方法的基础上。<sup>[31](https://doi.org/10.1093/biomet/80.1.27)</sup> 条件逻辑回归的拟合优度评估困难，标准软件中不可用。<sup>[8](https://wnarifin.github.io/lecture/mstat/conditional.pdf)</sup>

## References

1. [Why Match? Investigating Matched Case-Control Study Designs with Causal Effect Estimation (Rose & van der Laan)](https://pmc.ncbi.nlm.nih.gov/articles/PMC2827892/)
2. [A SAS macro for conditional logistic regression in matched case-control studies (Mayo Biostatistics report)](https://www.mayo.edu/research/documents/biostat-65pdf/doc-10027676)
3. [The unreasonable effectiveness of a biased logistic regression procedure in the analysis of pair-matched case-control studies](https://www.sciencedirect.com/science/article/abs/pii/S0378375800002172)
4. [Conditional Logistic Regression, Stat 705 lecture notes, University of South Carolina](https://people.stat.sc.edu/hoyen/STAT705/Notes/Lecture12.pdf)
5. [Matched Case-Control Studies and Conditional Logistic Regression | UVA Library](https://library.virginia.edu/data/articles/matched-case-control-studies-and-conditional-logistic-regression)
6. [R: Conditional logistic regression (survival package documentation)](https://search.r-project.org/CRAN/refmans/survival/html/clogit.html)
7. [Stata 14 documentation: clogit, Conditional (fixed-effects) logistic regression](https://www.stata.com/manuals14/rclogit.pdf)
8. [Conditional Logistic Regression (Dr Wan Nor Arifin, Universiti Sains Malaysia, updated Jun 24, 2024)](https://wnarifin.github.io/lecture/mstat/conditional.pdf)
9. [penalizedclr: an R package for penalized conditional logistic regression for integration of multiple omics layers](https://link.springer.com/article/10.1186/s12859-024-05850-2)
10. [Course notes ch. 29: Conditional likelihood for matched sets (Hanley, McGill BIOS 602)](https://www.jhanley.biostat.mcgill.ca/bios602/CondnlLogisticRegrn/ch-notes-29.pdf)
11. [Conditional Logistic Regression (MUSC Biometry 711 lecture notes, Bandyopadhyay)](https://people.musc.edu/~bandyopd/bmtry711.11/lecture_26.pdf)
12. [6.20 Conditional logistic regression for matched case-control data (Introduction to Regression Methods for Public Health Using R)](https://019b2da8-edfb-a262-61be-7973c056d9ae.share.connect.posit.cloud/blr-conditional.html)
13. [Conditional Logistic Regression, NCSS statistical software documentation](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/NCSS/Conditional_Logistic_Regression.pdf)
14. [N. E. BRESLOW and colleagues (1978). ESTIMATION OF MULTIPLE RELATIVE RISK FUNCTIONS IN MATCHED CASE-CONTROL STUDIES. American Journal of Epidemiology.](https://doi.org/10.1093/oxfordjournals.aje.a112623)
15. [Studies in the history of probability and statistics, LI: the first conditional logistic regression (Hanley)](https://jhanley.biostat.mcgill.ca/Reprints/HanleyFirstCondnlLogisticRegression.pdf)
16. [Gary Chamberlain (1980). Analysis of Covariance with Qualitative Data. The Review of Economic Studies.](https://doi.org/10.2307/2297110)
17. [MITCHELL H. GAIL, JAY H. LUBIN, LAWRENCE V. RUBINSTEIN (1981). Likelihood calculations for matched case-control studies and survival studies with tied death times. Biometrika.](https://doi.org/10.1093/biomet/68.3.703)
18. [John E. Connett, Judith A. Smith, Richard B. McHugh (1987). Sample size and power for pair‐matched case‐control studies. Statistics in Medicine.](https://doi.org/10.1002/sim.4780060107)
19. [Conditional logistic analysis of case-control studies with complex sampling (Langholz, Goldstein et al.)](https://dornsife.usc.edu/larry-goldstein/wp-content/uploads/sites/221/2023/06/cond.pdf)
20. [Sparse conditional logistic regression for analyzing large-scale matched data from epidemiological studies: a simple algorithm (BMC Bioinformatics)](https://link.springer.com/article/10.1186/1471-2105-16-S6-S1)
21. [Stephen Reid, Rob Tibshirani (2014). Regularization Paths for Conditional Logistic Regression: TheclogitL1Package. Journal of Statistical Software.](https://doi.org/10.18637/jss.v058.i12)
22. [Anne-Laure Boulesteix and colleagues (2017). IPF-LASSO: Integrative L 1 -Penalized Regression with Penalty Factors for Prediction Based on Multi-Omics Data. Computational and Mathematical Methods in Medicine.](https://doi.org/10.1155/2017/7691937)
23. [Nicolai Meinshausen, Peter Bühlmann (2010). Stability Selection. Journal of the Royal Statistical Society Series B (Statistical Methodology).](https://doi.org/10.1111/j.1467-9868.2010.00740.x)
24. [Help for package bclogit (version 1.1)](https://cran.r-project.org/web/packages/bclogit/refman/bclogit.html)
25. [Log-F-penalized Conditional Logistic Regression for Sparse Data](https://arxiv.org/html/2607.28899)
26. [Matching and Conditional Likelihood (David M. Rocke, UC Davis)](https://dmrocke.ucdavis.edu/Class/EPI204-Spring-2021/Lecture7ConditionalLikelihood.pdf)
27. [Exact conditional and unconditional sample size for pair-matched studies with binary outcome: A practical guide (Royston, Statistics in Medicine, 1993)](https://onlinelibrary.wiley.com/doi/10.1002/sim.4780120709)
28. [Matching and conditional logistic regression, EPIB-704 slides (McGill)](https://rawcdn.githack.com/mcarabali1/EPIB-704/49ee454d3028cb175556ba9382dce915d3d9cf6c/slides/L14matchingandconditionallogisticregression.pdf)
29. [Conditional or unconditional logistic regression for frequency matched case-control design? (Wan et al., Statistics in Medicine 2022)](https://www.stat.ubc.ca/~john/papers/WanSIM2022.pdf)
30. [Bias-reduced and separation-proof conditional logistic regression with small or sparse data sets (Heinze & Schemper, Statistics in Medicine 2010)](https://onlinelibrary.wiley.com/doi/10.1002/sim.3794)
31. [DAVID FIRTH (1993). Bias reduction of maximum likelihood estimates. Biometrika.](https://doi.org/10.1093/biomet/80.1.27)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Regression analysis

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/conditional-logistic-regression

English original: https://www.edgepedia.org/conditional-logistic-regression
