# 多层回归

多层回归是一种统计方法，用于对嵌套数据或聚类数据拟合回归模型，同时估计多个分组层次上的效应。它将普通线性回归推广到学生嵌套于学校、患者嵌套于医院、或重复测量嵌套于个体等情境；在这些情境中，由于情境影响，普通回归的独立性假设不再成立。<sup>[1](https://arxiv.org/pdf/1907.05941)</sup><sup> • </sup><sup>[2](https://www.ncbi.nlm.nih.gov/books/NBK565708/)</sup> 面对聚类数据，传统回归得到的标准误通常过小，从而产生虚假精确的估计并抬高第一类错误率。<sup>[1](https://arxiv.org/pdf/1907.05941)</sup>

| 关键事实 | 详情 |
|---|---|
| 其他名称 | 层次线性模型、混合效应模型、随机系数模型、方差成分模型<sup>[3](https://tqmp.org/RegularArticles/vol08-1/p052/p052.pdf)</sup><sup> • </sup><sup>[4](http://www.joophox.net/mlbook2/Chapter2.pdf)</sup> |
| 组内相关系数 | 由仅含截距的模型可得 \( \rho = \sigma_{u0}^{2} / (\sigma_{u0}^{2} + \sigma_{e}^{2}) \)，即组间方差所占比例；可解释为同一组内两个单位之间的期望相关<sup>[4](http://www.joophox.net/mlbook2/Chapter2.pdf)</sup> |
| 随机效应预测 | 经验贝叶斯（收缩）估计，是总体均值与组别均值的优化加权组合；小样本组会向总体均值收缩<sup>[5](https://www.stat.cmu.edu/~brian/463-663/week06/some%20nice%20papers/sullivan_hiermodel.pdf)</sup> |
| 设计效应 | \( \mathrm{DEFF} = 1 + (\bar{n} - 1) \times \mathrm{ICC} \)，即抽样方差相对于简单随机抽样方差的倍数<sup>[6](https://rips-irsp.com/articles/10.5334/irsp.555)</sup> |
| 方差估计 | 在小样本中应以限制性最大似然（REML）替代最大似然（ML），以校正方差参数的低估<sup>[7](https://www.bristol.ac.uk/media-library/sites/cmm/migrated/documents/tutorial-multilevel-modelling-of-medical-data.pdf)</sup> |
| 软件默认设置 | HLM 与 SAS Proc Mixed 默认使用 REML；Stata 与 Mplus 默认使用 ML<sup>[5](https://www.stat.cmu.edu/~brian/463-663/week06/some%20nice%20papers/sullivan_hiermodel.pdf)</sup><sup> • </sup><sup>[8](https://kops.uni-konstanz.de/server/api/core/bitstreams/e99b92f4-4b33-4c2e-a790-92a7b2eb56da/content)</sup> |

## 工作原理

两水平随机截距模型将第 \( j \) 组中个体 \( i \) 的结果变量写作 \( Y_{ij} = \beta_{0j} + \beta_{1} \cdot x_{ij} + R_{ij} \)，并将组截距分解为 \( \beta_{0j} = \gamma_{00} + U_{0j} \)。假定 \( U_{0j} \) 相互独立且服从均值为 0、方差为 \( \sigma_{u0}^{2} \) 的正态分布；只有该方差是统计参数，各个 \( U_{0j} \) 本身不是。<sup>[9](https://www.stats.ox.ac.uk/~snijders/MLB_new_S.pdf)</sup> 在仅含截距的模型中，\( \mathrm{var}(Y_{ij}) = \sigma_{u0}^{2} + \sigma_{e}^{2} \) 且 \( \mathrm{cov}(Y_{ij}, Y_{i'j}) = \sigma_{u0}^{2} \)，由此定义了组内相关系数；在社会科学研究中，该系数常介于 .05 与 .25 之间。<sup>[9](https://www.stats.ox.ac.uk/~snijders/MLB_new_S.pdf)</sup>

随机斜率则允许系数也发生变化，\( \beta_{1j} = \gamma_{10} + \gamma_{11} z_{j} + U_{1j} \)；代入后产生跨层交互项 \( \gamma_{11} \cdot z_{j} \cdot x_{ij} \)。<sup>[9](https://www.stats.ox.ac.uk/~snijders/MLB_new_S.pdf)</sup> 斜率残差 \( U_{1j} \) 与 \( X_{ij} \) 相乘会引入异方差性，这是普通多元回归在多层数据上表现不佳的原因之一。<sup>[10](https://multilevel-analysis.sites.uu.nl/wp-content/uploads/sites/27/2018/02/02Ch2-Basic3449.pdf)</sup> 区分组内系数与组间系数对于避免生态谬误至关重要。<sup>[9](https://www.stats.ox.ac.uk/~snijders/MLB_new_S.pdf)</sup>

## 操作流程

常见的工作流程为：第 0 步，对预测变量进行中心化（总均值中心化与聚类均值中心化）；第 1 步，拟合空模型并计算 ICC，以判断是否需要进行多层建模；第 2 步，构建中间模型以估计方差与协方差项；随后拟合最终模型并解释 95% 置信区间。<sup>[6](https://rips-irsp.com/articles/10.5334/irsp.555)</sup> 中心化之所以重要，是因为截距与斜率的含义会随选择而发生显著变化；布赖克与劳登布什指出，“没有单一规则能涵盖所有情形”。<sup>[11](https://jbnezl.people.wm.edu/Reprints/2012-APA-Handbook-MLM.pdf)</sup>

随机斜率的检验方法是：将不含斜率残差的约束模型与含斜率残差的增广模型进行比较，使用似然比（偏差）检验；对于嵌套模型，偏差之差服从卡方分布，自由度等于所估计参数数目之差。<sup>[4](http://www.joophox.net/mlbook2/Chapter2.pdf)</sup><sup> • </sup><sup>[6](https://rips-irsp.com/articles/10.5334/irsp.555)</sup> 检验 \( \sigma_{u0}^{2} = 0 \) 时，零假设下的分布是 0 处点质量与 \( \chi^{2}_{1} \) 的 50:50 混合分布，因此 \( \chi^{2}_{1} \) 的 p 值需除以 2。<sup>[9](https://www.stats.ox.ac.uk/~snijders/MLB_new_S.pdf)</sup>

## 起源

D. V. 林德利与 A. F. M. 史密斯 1972 年发表于《皇家统计学会杂志 B 辑》的论文《线性模型的贝叶斯估计》提出了层次贝叶斯框架，其中在一个层次上估计的参数成为下一层次的结果变量，并给出了“层次线性模型”这一术语。<sup>[12](https://doi.org/10.1111/j.2517-6161.1972.tb00885.x)</sup><sup> • </sup><sup>[13](https://faculty.ucmerced.edu/jvevea/classes/290_21/readings/week%203/Raudenbush%20and%20Bryk%201986.pdf)</sup> 巴尔·罗森伯格 1973 年发表于《生物计量学》的论文在计量经济学中发展了随机系数回归。<sup>[14](https://doi.org/10.1093/biomet/60.1.65)</sup> 威廉·M. 梅森、乔治·Y. 黄与芭芭拉·恩特威斯尔于 1983 年将一般多层线性模型应用于情境分析。<sup>[15](https://doi.org/10.2307/270903)</sup>

1986 年，H. 戈尔茨坦在《生物计量学》上发表了用于多层混合线性模型的迭代广义最小二乘（IGLS）估计程序，并证明其在正态情形下等价于最大似然。<sup>[16](https://doi.org/10.1093/biomet/73.1.43)</sup> 同年，斯蒂芬·劳登布什与安东尼·S. 布赖克在《教育社会学》上提出了研究学校效应的层次模型，重新分析了“高中与超越”数据，<sup>[17](https://doi.org/10.2307/2112482)</sup><sup> • </sup><sup>[13](https://faculty.ucmerced.edu/jvevea/classes/290_21/readings/week%203/Raudenbush%20and%20Bryk%201986.pdf)</sup> 扬·德·莱乌与伊塔·克雷夫特在《教育统计学杂志》上发表了用于多层分析的随机系数模型。<sup>[18](https://doi.org/10.3102/10769986011001057)</sup> 哈维·戈尔茨坦与罗德里克·P. 麦克唐纳于 1988 年在《心理计量学》上给出了多层数据的一般模型。<sup>[19](https://doi.org/10.1007/bf02294400)</sup>

## 变体

已命名的变体包括两水平方差成分模型、随机截距模型、随机斜率模型、三水平模型、交叉分类模型、多重成员模型与多变量响应模型。<sup>[1](https://arxiv.org/pdf/1907.05941)</sup> 随机截距模型加入一个对所有成员产生同等影响的组水平残差；随机斜率模型则加入一个斜率残差，其自身具有方差，并与截距残差存在协方差。<sup>[2](https://www.ncbi.nlm.nih.gov/books/NBK565708/)</sup> 当第 1 层单位同时属于两种互不嵌套的分类（如社区与学校）时，便出现交叉分类结构。<sup>[20](https://www.bristol.ac.uk/media-library/sites/cmm/migrated/documents/cross-classified-review.pdf)</sup>

针对心理语言学中的重复测量数据，R. H. 巴延、D. J. 戴维森与 D. M. 贝茨（2008）在《记忆与语言杂志》上确立了以被试与项目作为交叉随机效应的混合效应建模方法，取代了准 F 分析；模拟显示其在检验力与缺失数据处理方面具有优势。<sup>[21](https://doi.org/10.1016/j.jml.2007.12.005)</sup><sup> • </sup><sup>[22](https://pages.stat.wisc.edu/~larget/Stat998/Fall2015/BaayenDavidsonBates-2008.pdf)</sup> 对于验证性假设检验，戴尔·J. 巴尔及其同事（2013）建议保持随机效应结构最大化。<sup>[23](https://doi.org/10.1016/j.jml.2012.11.001)</sup> 在潜变量建模中，瓦列里·达舒克及其同事（2024）提出了一种用于组间斜率的优化正则化贝叶斯估计量，可自动选择先验参数以最小化均方误差，并将 ML 作为特例包含在内。<sup>[24](https://doi.org/10.13140/rg.2.2.18148.39048)</sup><sup> • </sup><sup>[25](https://www.cambridge.org/core/journals/psychometrika/article/an-optimally-regularized-estimator-of-multilevel-latent-variable-models-with-improved-mse-performance/C6A2F3350955055D9E7AADC79426DD42)</sup>

## 应用

多层模型是社会科学、行为科学与医学科学中处理聚类数据与纵向数据的标准方法。<sup>[1](https://arxiv.org/pdf/1907.05941)</sup> 在卫生服务研究中，层次模型可处理嵌套于医生、医生又嵌套于医院的患者；在 II 型糖尿病 PORT 研究中，患者为第 1 层单位，医生为第 2 层单位，并允许组规模不平衡。<sup>[5](https://www.stat.cmu.edu/~brian/463-663/week06/some%20nice%20papers/sullivan_hiermodel.pdf)</sup> 在心理学中，带交叉随机效应的混合效应模型现已成为重复测量实验的标准方法。<sup>[22](https://pages.stat.wisc.edu/~larget/Stat998/Fall2015/BaayenDavidsonBates-2008.pdf)</sup>

## 局限与替代方案

模拟研究的结果一致表明分组数目众多十分重要：要获得准确的组水平方差估计，需要超过 100 个组；而当组数为 24 至 30 时，方差成分检验所报告的实际 α 水平可达约 9%。<sup>[26](https://communities.sas.com/kntur85557/attachments/kntur85557/statistical_procedures/23310/1/Maas%20and%20Hox%20%282005%29.pdf)</sup> 克雷夫特的“30/30”经验法则规定，以 30 个组、每组 30 人作为偏安全的最低标准，<sup>[26](https://communities.sas.com/kntur85557/attachments/kntur85557/statistical_procedures/23310/1/Maas%20and%20Hox%20%282005%29.pdf)</sup><sup> • </sup><sup>[27](https://api.taylorfrancis.com/content/chapters/oa-edit/download?identifierName=doi&identifierValue=10.4324%2F9780429273872-18&type=chapterpdf)</sup> 而一项医学模拟研究则建议每组至少 50 人且至少 50 个组；<sup>[28](https://bmcmedresmethodol.biomedcentral.com/counter/pdf/10.1186/1471-2288-7-34.pdf)</sup> 这些指南彼此冲突，而一般性规则只能推广到有限的数据条件与模型结构。<sup>[29](https://econtent.hogrefe.com/doi/10.1027/1614-2241/a000062)</sup>

当上层单位数目较少时，方差参数的最大似然估计存在小样本偏倚，而且即使下层样本非常大，该偏倚也不会消失；REML 估计量可大幅减少乃至消除该偏倚，并可在 MLwiN、R 包 nlme 与 lme4、Mplus 以及 Stata 中使用。<sup>[8](https://kops.uni-konstanz.de/server/api/core/bitstreams/e99b92f4-4b33-4c2e-a790-92a7b2eb56da/content)</sup> 默认标准误依赖于较窄的假设，即使在简单情形下也可能覆盖不足；一项对政治学、教育学与社会学中 100 多篇实证论文的综述发现，这些已知问题在实践中被广泛忽视。<sup>[30](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8101D49CFD3B129F5753FC878F416980/S1047198720000418a.pdf/div-class-title-understanding-choosing-and-unifying-multilevel-and-fixed-effect-approaches-div.pdf)</sup>

随机效应是正则化的固定效应，这使得未经修正的多层模型在存在组水平混杂时产生偏倚。<sup>[30](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8101D49CFD3B129F5753FC878F416980/S1047198720000418a.pdf/div-class-title-understanding-choosing-and-unifying-multilevel-and-fixed-effect-approaches-div.pdf)</sup> 补救办法是蒙德拉克调整：将所有纳入变量的组水平均值作为回归项加入，即可消除偏倚；一旦应用该调整并结合聚类稳健标准误，多层模型的点估计与标准误便与相应的固定效应模型完全相等。<sup>[30](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8101D49CFD3B129F5753FC878F416980/S1047198720000418a.pdf/div-class-title-understanding-choosing-and-unifying-multilevel-and-fixed-effect-approaches-div.pdf)</sup><sup> • </sup><sup>[31](https://doi.org/10.2307/1913646)</sup> 多层模型在样本外预测以及估计固定效应会剔除的组水平协变量系数方面仍具优势，而固定效应模型无法在一个模型中容纳三个或更多聚类层次。<sup>[30](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8101D49CFD3B129F5753FC878F416980/S1047198720000418a.pdf/div-class-title-understanding-choosing-and-unifying-multilevel-and-fixed-effect-approaches-div.pdf)</sup><sup> • </sup><sup>[32](https://academicweb.nd.edu/~kkelley/publications/articles/McNeish_Kelley_PsychMethods_2019.pdf)</sup>

相对于广义估计方程（GEE）：边际模型只估计固定参数，将随机效应视为干扰参数，对协方差设定错误更为稳健，但不估计方差成分。<sup>[7](https://www.bristol.ac.uk/media-library/sites/cmm/migrated/documents/tutorial-multilevel-modelling-of-medical-data.pdf)</sup> 当聚类数目很少时，GEE 会严重低估标准误，除非应用曼克尔与德鲁昂校正；而边际化多层模型仅轻微低估簇内标准误，却可能严重低估簇间标准误。<sup>[33](https://onlinelibrary.wiley.com/doi/10.1002/sim.9126)</sup><sup> • </sup><sup>[34](https://doi.org/10.1111/j.0006-341x.2001.00126.x)</sup> 忽视异方差性可能导致错误地检出随机斜率，而随机误差结构设定不当则可能使固定效应产生偏倚，因为所有系数是同时估计的。<sup>[2](https://www.ncbi.nlm.nih.gov/books/NBK565708/)</sup><sup> • </sup><sup>[11](https://jbnezl.people.wm.edu/Reprints/2012-APA-Handbook-MLM.pdf)</sup>

## References

1. [Multilevel linear regression models (Leckie & Terrin, review article)](https://arxiv.org/pdf/1907.05941)
2. [Chapter 5 Graphs and Equations (Multilevel Analysis, NCBI Bookshelf)](https://www.ncbi.nlm.nih.gov/books/NBK565708/)
3. [An introduction to hierarchical linear modeling (TQMP, 2012)](https://tqmp.org/RegularArticles/vol08-1/p052/p052.pdf)
4. [The Basic Two-Level Regression Model (Hox, Multilevel Analysis, 2nd ed., Chapter 2)](http://www.joophox.net/mlbook2/Chapter2.pdf)
5. [An introduction to hierarchical linear modelling (Sullivan et al., Statistics in Medicine, 1999)](https://www.stat.cmu.edu/~brian/463-663/week06/some%20nice%20papers/sullivan_hiermodel.pdf)
6. [Keep Calm and Learn Multilevel Linear Modeling: A Three-Step Procedure Using SPSS, Stata, R, and Mplus (International Review of Social Psychology)](https://rips-irsp.com/articles/10.5334/irsp.555)
7. [Multilevel modelling of medical data (Goldstein et al., tutorial, Statistics in Medicine 2002)](https://www.bristol.ac.uk/media-library/sites/cmm/migrated/documents/tutorial-multilevel-modelling-of-medical-data.pdf)
8. [Multilevel Analysis with Few Clusters: Improving Likelihood-Based Methods to Provide Unbiased Estimates and Accurate Inference (Elff et al.)](https://kops.uni-konstanz.de/server/api/core/bitstreams/e99b92f4-4b33-4c2e-a790-92a7b2eb56da/content)
9. [Multilevel Analysis (Snijders & Bosker), lecture chapter on the hierarchical linear model](https://www.stats.ox.ac.uk/~snijders/MLB_new_S.pdf)
10. [The Basic Two-Level Regression Model (Hox, Multilevel Analysis, 3rd ed., Chapter 2)](https://multilevel-analysis.sites.uu.nl/wp-content/uploads/sites/27/2018/02/02Ch2-Basic3449.pdf)
11. [Multilevel modeling for psychologists (APA Handbook chapter)](https://jbnezl.people.wm.edu/Reprints/2012-APA-Handbook-MLM.pdf)
12. [D. V. Lindley, A. F. M. Smith (1972). Bayes Estimates for the Linear Model. Journal of the Royal Statistical Society Series B (Statistical Methodology).](https://doi.org/10.1111/j.2517-6161.1972.tb00885.x)
13. [A Hierarchical Model for Studying School Effects (Raudenbush & Bryk, Sociology of Education, 1986)](https://faculty.ucmerced.edu/jvevea/classes/290_21/readings/week%203/Raudenbush%20and%20Bryk%201986.pdf)
14. [Barr Rosenberg (1973). Linear regression with randomly dispersed parameters. Biometrika.](https://doi.org/10.1093/biomet/60.1.65)
15. [William M. Mason, George Y. Wong, Barbara Entwisle (1983). Contextual Analysis through the Multilevel Linear Model. Sociological Methodology.](https://doi.org/10.2307/270903)
16. [H. GOLDSTEIN (1986). Multilevel mixed linear model analysis using iterative generalized least squares. Biometrika.](https://doi.org/10.1093/biomet/73.1.43)
17. [Stephen Raudenbush, Anthony S. Bryk (1986). A Hierarchical Model for Studying School Effects. Sociology of Education.](https://doi.org/10.2307/2112482)
18. [Jan De Leeuw, Ita Kreft (1986). Random Coefficient Models for Multilevel Analysis. Journal of Educational Statistics.](https://doi.org/10.3102/10769986011001057)
19. [Harvey Goldstein, Roderick P. McDonald (1988). A General Model for the Analysis of Multilevel Data. Psychometrika.](https://doi.org/10.1007/bf02294400)
20. [Cross-classified and Multiple Membership Structures in Multilevel Models: An Introduction and Review (Rasbash & Goldstein)](https://www.bristol.ac.uk/media-library/sites/cmm/migrated/documents/cross-classified-review.pdf)
21. [R.H. Baayen, D.J. Davidson, D.M. Bates (2008). Mixed-effects modeling with crossed random effects for subjects and items. Journal of Memory and Language.](https://doi.org/10.1016/j.jml.2007.12.005)
22. [Mixed-effects modeling with crossed random effects for subjects and items (Baayen, Davidson & Bates, Journal of Memory and Language 2008)](https://pages.stat.wisc.edu/~larget/Stat998/Fall2015/BaayenDavidsonBates-2008.pdf)
23. [Dale J. Barr and colleagues (2013). Random effects structure for confirmatory hypothesis testing: Keep it maximal. Journal of Memory and Language.](https://doi.org/10.1016/j.jml.2012.11.001)
24. [Dashuk, Valerii and colleagues (2024). An Optimally Regularized Estimator of Multilevel Latent Variable Models, with Improved MSE Performance. .](https://doi.org/10.13140/rg.2.2.18148.39048)
25. [An Optimally Regularized Estimator of Multilevel Latent Variable Models with Improved MSE Performance, Psychometrika (Dashuk et al., 2024)](https://www.cambridge.org/core/journals/psychometrika/article/an-optimally-regularized-estimator-of-multilevel-latent-variable-models-with-improved-mse-performance/C6A2F3350955055D9E7AADC79426DD42)
26. [Maas and Hox (2005) (communities.sas.com)](https://communities.sas.com/kntur85557/attachments/kntur85557/statistical_procedures/23310/1/Maas%20and%20Hox%20%282005%29.pdf)
27. [Handbook chapter on multilevel modeling sample-size guidelines (Taylor & Francis, DOI 10.4324/9780429273872-18)](https://api.taylorfrancis.com/content/chapters/oa-edit/download?identifierName=doi&identifierValue=10.4324%2F9780429273872-18&type=chapterpdf)
28. [Sample size for multilevel models in medical research (BMC Medical Research Methodology 2007)](https://bmcmedresmethodol.biomedcentral.com/counter/pdf/10.1186/1471-2288-7-34.pdf)
29. [How Low Can You Go? (Methodology, Hogrefe)](https://econtent.hogrefe.com/doi/10.1027/1614-2241/a000062)
30. [Understanding, Choosing, and Unifying Multilevel and Fixed Effect Approaches (Hazlett & Wainstein)](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8101D49CFD3B129F5753FC878F416980/S1047198720000418a.pdf/div-class-title-understanding-choosing-and-unifying-multilevel-and-fixed-effect-approaches-div.pdf)
31. [Yair Mundlak (1978). On the Pooling of Time Series and Cross Section Data. Econometrica.](https://doi.org/10.2307/1913646)
32. [Fixed Effects Models Versus Mixed Effects Models for Clustered Data (McNeish & Kelley, Psychological Methods 2019)](https://academicweb.nd.edu/~kkelley/publications/articles/McNeish_Kelley_PsychMethods_2019.pdf)
33. [Fitting marginal models in small samples: A simulation study of marginalized multilevel models and generalized estimating equations (Statistics in Medicine)](https://onlinelibrary.wiley.com/doi/10.1002/sim.9126)
34. [Lloyd A. Mancl, Timothy A. DeRouen (2001). A Covariance Estimator for GEE with Improved Small‐Sample Properties. Biometrics.](https://doi.org/10.1111/j.0006-341x.2001.00126.x)

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

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

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/multilevel-regression

English original: https://www.edgepedia.org/multilevel-regression
