# 随机效应模型

随机效应（RE）模型是一种面板数据估计量，它把每个横截面单位中未被观测到、不随时间变化的异质性，视为复合误差项中的一个随机成分，并假定该成分在每一期都与回归元不相关。在这一假定下，随机效应广义最小二乘（GLS）估计量是一致且比固定效应更有效的；一旦该假定不成立，RE就不一致，而固定效应（FE）仍然一致。因此，这两个估计量的区别并不在于个体效应是否为随机，而在于它们是否与解释变量相关。<sup>[1](https://pages.stern.nyu.edu/~wgreene/DiscreteChoice/Readings/Greene-Chapter-9.pdf)</sup><sup> • </sup><sup>[2](https://www.stata.com/manuals/xtxtreg.pdf)</sup><sup> • </sup><sup>[3](https://www.schmidheiny.name/teaching/panelmf2up.pdf)</sup>

| 要点 | 详情 |
|---|---|
| 定义性假设（RE1） | 个体效应与所有过去、现在和未来各期的解释变量都不相关；这正是RE区别于FE的关键，而不是效应是否随机<sup>[3](https://www.schmidheiny.name/teaching/panelmf2up.pdf)</sup><sup> • </sup><sup>[1](https://pages.stern.nyu.edu/~wgreene/DiscreteChoice/Readings/Greene-Chapter-9.pdf)</sup> |
| 估计量形式 | 在准去均值数据 \( y_{it} - \theta \bar{y}_i \) 上做OLS所得到的GLS，其中 \( \theta = 1 - \sqrt{\sigma_e^2/(\sigma_e^2 + T\sigma_u^2)} \)；它是组间估计量与组内估计量的矩阵加权平均<sup>[4](https://cran.r-project.org/web/packages/plm/vignettes/A_plmPackage.html)</sup><sup> • </sup><sup>[2](https://www.stata.com/manuals/xtxtreg.pdf)</sup> |
| 嵌套关系 | \( \theta = 0 \) 时即为混合OLS（当 \( \sigma_\eta^2 = 0 \) 时）；当 \( T \to \infty \) 时 \( \theta \to 1 \)，即得到FE估计量<sup>[5](https://joanllull.github.io/Microeconometrics/Panel_data.pdf)</sup> |
| 组内相关 | 对同一单位的不同时期，\( \mathrm{Corr}(u_{it}, u_{is}) = \sigma_\mu^2/(\sigma_\mu^2 + \sigma_\nu^2) \)；不同单位之间为零<sup>[6](https://www.k-state.edu/economics/about/staff/websites/li/ppt/890/panel.pdf)</sup> |
| 豪斯曼（Hausman）检验 | 比较FE与RE的系数；统计量为 \( \hat{q}'[\mathrm{Var}(\hat{q})]^{-1}\hat{q} \)，其中 \( \mathrm{Var}(\hat{q}) = \mathrm{Var}(\hat\beta_{FE}) - \mathrm{Var}(\hat\beta_{RE}) \)，渐近服从 \( \chi^2 \) 分布，自由度等于该方差差的秩；只适用于同方差、无序列相关的误差，且在有限样本中可能为负<sup>[7](https://arxiv.org/html/2412.20555v2)</sup><sup> • </sup><sup>[6](https://www.k-state.edu/economics/about/staff/websites/li/ppt/890/panel.pdf)</sup><sup> • </sup><sup>[3](https://www.schmidheiny.name/teaching/panelmf2up.pdf)</sup> |
| 软件 | Stata：`xtreg, re`（加`sa`则使用小样本的斯瓦米–阿罗拉（Swamy–Arora）方差成分）；R：`plm(..., model = "random")`，`random.method` 可选 swar（默认）、walhus、amemiya、nerlove<sup>[2](https://www.stata.com/manuals/xtxtreg.pdf)</sup><sup> • </sup><sup>[4](https://cran.r-project.org/web/packages/plm/vignettes/A_plmPackage.html)</sup> |

## 模型与假设

单向RE模型把结果变量写作 \( y_{it} = \alpha + x_{it}'\beta + \eta_i + v_{it} \)，其中 \( \eta_i \) 是个体效应，\( v_{it} \) 是特质误差。复合误差 \( u_{it} = \eta_i + v_{it} \) 在每个单位内部具有等相关性：同一个体在不同时期的观测无论相隔多久，其相关性都是 \( \sigma_\mu^2/(\sigma_\mu^2 + \sigma_\nu^2) \)，而不同个体之间的观测互不相关。这种组内相关正是GLS所利用的方差成分结构。<sup>[6](https://www.k-state.edu/economics/about/staff/websites/li/ppt/890/panel.pdf)</sup>

有两条假设至关重要。回归元的严格外生性与FE相同。而额外的RE1假设要求 \( \eta_i \) 与各期的回归元都不相关。实务指南称RE1极强，并指出：未能拒绝它并不等于接受它；仅仅对不随时间变化的变量感兴趣，并不足以成为使用RE的理由。<sup>[3](https://www.schmidheiny.name/teaching/panelmf2up.pdf)</sup> 如果异质性实际上与回归元相关却被忽略，混合最小二乘就会不一致，有时偏差极大。<sup>[1](https://pages.stern.nyu.edu/~wgreene/DiscreteChoice/Readings/Greene-Chapter-9.pdf)</sup>

## 估计与推断

**可行GLS。** 由于方差成分未知，RE估计量分两步实现：先估计 \( \sigma_\mu^2 \) 与 \( \sigma_\nu^2 \)，构造 \( \hat\theta \)，再对经准去均值处理的数据做OLS。R的plm包通过`random.method`提供四种方差成分估计方法：斯瓦米与阿罗拉（1972，默认）、华莱士（Wallace）与侯赛因（Hussain，1969）、雨宫（Amemiya，1971）和纳洛夫（Nerlove，1971），另有豪斯曼–泰勒（Hausman–Taylor）工具变量选项。<sup>[4](https://cran.r-project.org/web/packages/plm/vignettes/A_plmPackage.html)</sup> Stata的`xtreg, re`计算的是同一类估计量，被描述为组间估计量与组内估计量的矩阵加权平均，加`sa`则调用小样本的斯瓦米–阿罗拉方差成分估计量。<sup>[2](https://www.stata.com/manuals/xtxtreg.pdf)</sup>

**标准误。** 复合误差具有等相关性，意味着在面板聚类下普通标准误是错误的。聚类稳健协方差在聚类数 \( N \to \infty \) 时是一致的，实践中建议至少要有50个聚类；在Stata中，`xtreg, re`之后加`vce(robust)`等价于`vce(cluster panelvar)`。<sup>[3](https://www.schmidheiny.name/teaching/panelmf2up.pdf)</sup><sup> • </sup><sup>[2](https://www.stata.com/manuals/xtxtreg.pdf)</sup> 序列相关会带来实实在在的后果：贝特朗（Bertrand）、迪弗洛（Duflo）与穆莱纳坦（Mullainathan，2004）表明，存在序列相关时常用的FE标准误会被严重低估；而在RE情境下的模拟显示，未建模的随机斜率会让标准误过于乐观。<sup>[3](https://www.schmidheiny.name/teaching/panelmf2up.pdf)</sup><sup> • </sup><sup>[8](https://link.springer.com/article/10.1007/s11135-018-0802-x)</sup> 一项针对管理学研究实践的2023年模拟研究发现，不聚类标准误与RE估计各自都会大幅抬高假阳性率，而豪斯曼检验并不总能阻止这些假阳性；在一次复现中，许多在RE配经典标准误下显著的系数，在改用FE加聚类标准误后变得不显著了。<sup>[9](https://ideas.repec.org/a/inm/orstsc/v8y2023i1p103-116.html)</sup>

## 与固定效应和混合OLS的比较

这三种估计量构成一个谱系。混合OLS完全忽略个体效应；FE通过去均值将其消除；RE则以介于0与1之间的权重 \( \theta \) 做准去均值，将其部分消除。当 \( \sigma_\eta^2 = 0 \) 时，\( \theta = 0 \)，RE与混合OLS重合；当 \( T \to \infty \) 时，\( \theta \to 1 \)，RE与FE重合，因此对于时间序列面板，二者性质相近。<sup>[5](https://joanllull.github.io/Microeconometrics/Panel_data.pdf)</sup><sup> • </sup><sup>[10](https://homepage.univie.ac.at/robert.kunst/panpres.pdf)</sup>

**有效性与一致性。** 当组内效应与组间效应相等时，RE比FE更有效，因为它同时利用了这两个层面上的变异；当二者不等时，RE估计就变成一个加权平均，实质性含义不大。<sup>[8](https://link.springer.com/article/10.1007/s11135-018-0802-x)</sup> RE还能估计不随时间变化的变量的系数，这是FE（LSDV）估计量做不到的，例如性别、种族、宗教、受教育年限或工会参与等变量。<sup>[11](https://panelbox.readthedocs.io/en/latest/theory/panel-fundamentals/)</sup><sup> • </sup><sup>[6](https://www.k-state.edu/economics/about/staff/websites/li/ppt/890/panel.pdf)</sup>

**豪斯曼检验。** 该统计量比较FE与RE的系数向量，\( H = (\hat\beta_{FE} - \hat\beta_{RE})'[\mathrm{Var}(\hat\beta_{FE}) - \mathrm{Var}(\hat\beta_{RE})]^{-1}(\hat\beta_{FE} - \hat\beta_{RE}) \)，渐近服从 \( \chi^2(m) \) 分布，其中 \( m \) 是方差差的秩，其推导前提是同方差、无序列相关的误差。<sup>[7](https://arxiv.org/html/2412.20555v2)</sup> 它已知的弱点相当严重：经典检验依赖同方差和无序列相关的误差；<sup>[3](https://www.schmidheiny.name/teaching/panelmf2up.pdf)</sup> 在异方差、序列相关或误差存在聚类依赖时并不可靠；<sup>[11](https://panelbox.readthedocs.io/en/latest/theory/panel-fundamentals/)</sup> 它建立在组内与组间参数相等这一假设之上，而这一假设往往缺乏依据，因为二者可能反映不同的机制；<sup>[12](https://onlinelibrary.wiley.com/doi/10.1111/poms.13347)</sup> 并且在有限样本中它可能为负。<sup>[6](https://www.k-state.edu/economics/about/staff/websites/li/ppt/890/panel.pdf)</sup> 方法论学者对其解读也有争议：贝尔（Bell）与琼斯（Jones）认为，它实际上检验的是组间效应与组内效应是否有别，而不是该选用哪个估计量；巴尔塔吉（Baltagi）2024年的章节强调，拒绝原假设通常只表明模型设定有误，并不等于认可FE——而实践中却常被如此理解。<sup>[8](https://link.springer.com/article/10.1007/s11135-018-0802-x)</sup><sup> • </sup><sup>[13](https://www.cambridge.org/core/journals/political-science-research-and-methods/article/explaining-fixed-effects-random-effects-modeling-of-timeseries-crosssectional-and-panel-data/0334A27557D15848549120FE8ECD8D63)</sup><sup> • </sup><sup>[14](https://ideas.repec.org/h/eme/aecozz/s0731-905320240000046002.html)</sup>

## 相关随机效应与扩展

**蒙德拉克（Mundlak）方法。** 蒙德拉克（1978）表明，如果把回归元与效应之间的依赖关系显式建模，即在RE回归中加入时变协变量的单位均值，那么RE方法与FE方法会得到相同的斜率估计，即组内估计；而组内估计与组间估计的任何矩阵组合一般都有偏。<sup>[15](https://pages.stern.nyu.edu/~wgreene/Econometrics/Mundlak-1978.pdf)</sup> 伍尔德里奇（Wooldridge，2019）将这一等价性推广到非平衡面板：加入按非平衡面板平均的协变量时间均值，再做混合OLS或RE，仍可得到FE估计量。<sup>[16](https://www.sciencedirect.com/science/article/abs/pii/S0304407618302392)</sup><sup> • </sup><sup>[2](https://www.stata.com/manuals/xtxtreg.pdf)</sup> 这种相关随机效应（CRE）方法是一种实用的折中：它在一致地估计时变系数时不要求“不相关”假设，能估计不随时间变化的回归元的系数，Stata还直接以`xtreg, cre`实现。<sup>[2](https://www.stata.com/manuals/xtxtreg.pdf)</sup> 当特质误差同方差且无序列相关时，蒙德拉克–伍尔德里奇CRE检验与经典豪斯曼检验渐近等价，但与在其标准假设下的经典豪斯曼检验不同，它可以做成聚类稳健的形式。<sup>[7](https://arxiv.org/html/2412.20555v2)</sup><sup> • </sup><sup>[17](https://www.stata.com/manuals/xtxtregpostestimation.pdf)</sup>

**非线性模型。** 在 \( T \) 固定的固定效应logit、probit和泊松模型中，最大似然估计不一致，因为干扰参数的数目随 \( N \) 增长，这就是附带参数问题；补救办法包括条件似然（logit可用）、偏差校正，或带分布假设的RE。<sup>[11](https://panelbox.readthedocs.io/en/latest/theory/panel-fundamentals/)</sup> RE的probit和logit把效应当作服从某个参数分布的单一随机变量，而不是 \( N \) 个自由参数，从而避开了这个问题。在一个Stata随机效应logistic示例中，1,151组共5,755个观测，对 \( \rho = 0 \) 的LR检验给出chibar2(01) = 327.62（p = 0.000），\( \rho = 0.2927 \)；相应的FE logit剔除了324组，因为这些组的结果全为正或全为负。<sup>[18](https://academicweb.nd.edu/~rwilliam/stats3/Panel04-FixedVsRandom.pdf)</sup> 对于大 \( T \) 的非线性FE模型，附带参数偏差的阶为 \( p/n \)，其中 \( p \) 是估计参数的个数，\( n \) 是总样本量。<sup>[19](https://www.annualreviews.org/content/journals/10.1146/annurev-economics-080217-053542)</sup>

**非平衡面板。** 伍尔德里奇针对非平衡面板的CRE框架假设样本选择与未观测到的冲击没有系统关联，同时允许选择与未观测异质性任意相关，并顺带给出非平衡面板的完全稳健豪斯曼检验。<sup>[16](https://www.sciencedirect.com/science/article/abs/pii/S0304407618302392)</sup> [蒙特卡洛](https://www.edgepedia.org/zh/monte-carlo)证据表明，在平衡数据下组内–组间RE估计量的表现至少不逊于FE和FEVD；而在非平衡数据下，FEVD的标准误变差，RE、FE和REWB的结果则基本不变。<sup>[13](https://www.cambridge.org/core/journals/political-science-research-and-methods/article/explaining-fixed-effects-random-effects-modeling-of-timeseries-crosssectional-and-panel-data/0334A27557D15848549120FE8ECD8D63)</sup>

## 数据实例

Stata的国家纵向调查（National Longitudinal Survey, NLS）“年轻女性”示例展示了一次完整的RE拟合：\( \sigma_\nu = 0.2579 \)，\( \sigma_\epsilon = 0.2907 \)，组内相关为 \( 0.2579^2/(0.2579^2 + 0.2907^2) \approx 0.44 \)，也就是说复合误差方差中约有44%是持续存在的个体成分。拟合报告组内 \( R^2 \) = 0.1715、组间 \( R^2 \) = 0.4784、整体 \( R^2 \) = 0.3708，样本为4,697组共28,091个观测；FE对RE的[豪斯曼检验](https://www.edgepedia.org/zh/hausman-test)给出chi2(8) = 149.43，p = 0.0000，拒绝了RE设定。<sup>[2](https://www.stata.com/manuals/xtxtreg.pdf)</sup> 同一数据上的聚类稳健蒙德拉克检验给出chi2(8) = 123.10，p = 0.0000。<sup>[17](https://www.stata.com/manuals/xtxtregpostestimation.pdf)</sup> 布罗施–帕甘（Breusch–Pagan）LM检验（`xttest0`，由巴尔塔吉与李（Li）为非平衡数据做了修正）检验 \( \mathrm{Var}(\nu) = 0 \)，其原假设下的分布为在零处的一个点质量与chi2(1)各占一半的混合分布。<sup>[17](https://www.stata.com/manuals/xtxtregpostestimation.pdf)</sup>

## 近期进展

若干进展完善了RE的实践。巴尔塔吉2024年的章节把豪斯曼检验重新表述为一般性的设定检验，并建议在拒绝原假设时，检查是否存在内生回归元和动态设定错误、采用非参数豪斯曼检验，并在采用FE之前先检验固定效应约束。<sup>[14](https://ideas.repec.org/h/eme/aecozz/s0731-905320240000046002.html)</sup> 一篇2024–2025年的工作论文提出一种针对具体参数的有限样本偏差诊断工具，只需一个拟合好的RE模型即可计算，并给出基于置换的p值，从而在豪斯曼检验拒绝原假设之后，可以进一步识别哪些系数真正受到影响。<sup>[7](https://arxiv.org/html/2412.20555v2)</sup> 2025年的一章发展了半参数CRE估计，放宽了把效应与协变量联系起来的参数假设，并附有设定检验；无论 \( E(v_i \mid x_{it}) = 0 \) 是否成立，其估计量都一致，这一点不同于纳达拉亚（Nadaraya）–沃森（Watson）局部常数估计量。<sup>[20](https://bpb-us-e2.wpmucdn.com/sites.ua.edu/dist/b/420/files/2025/03/henderson_henry_soberon_2025.pdf)</sup> 《[计量经济学杂志](https://www.edgepedia.org/zh/journal-of-econometrics)》2026年的一篇论文指出，标准双向固定效应估计量在数值上等价于以回归元的横截面均值与时间序列均值所做的双向蒙德拉克回归，并把二者都嵌套在一个广义CCE估计量之中。<sup>[21](https://www.sciencedirect.com/science/article/abs/pii/S0304407626000047)</sup> 一篇2026年的工作论文给出了在短面板中识别相关随机系数分布的充分条件，且不对误差的时间序列结构作任何限制。<sup>[22](https://arxiv.org/abs/2605.21367)</sup> 与这些方法论进展相对的，是2023年那篇假阳性批评，它建议在典型的管理学研究情境中聚类标准误，并使用固定效应而非随机效应。<sup>[9](https://ideas.repec.org/a/inm/orstsc/v8y2023i1p103-116.html)</sup>

## References

1. [Greene, W. Econometric Analysis, chapter on Models for Panel Data.](https://pages.stern.nyu.edu/~wgreene/DiscreteChoice/Readings/Greene-Chapter-9.pdf)
2. [Stata [XT] xtreg manual.](https://www.stata.com/manuals/xtxtreg.pdf)
3. [Schmidheiny, K. Panel Data: Fixed and Random Effects (teaching handout).](https://www.schmidheiny.name/teaching/panelmf2up.pdf)
4. [Panel data econometrics in R: the plm package (vignette).](https://cran.r-project.org/web/packages/plm/vignettes/A_plmPackage.html)
5. [Llull, J. Microeconometrics lecture notes: Panel Data.](https://joanllull.github.io/Microeconometrics/Panel_data.pdf)
6. [Panel Data Econometrics (Baltagi-based lecture slides, Kansas State).](https://www.k-state.edu/economics/about/staff/websites/li/ppt/890/panel.pdf)
7. [Parameter-Specific Bias Diagnostics in Random-Effects Panel Data Models (arXiv, 2024–2025).](https://arxiv.org/html/2412.20555v2)
8. [Bell, A. & Jones, K. Fixed and random effects models: making an informed choice. Quality & Quantity.](https://link.springer.com/article/10.1007/s11135-018-0802-x)
9. [Broken Effects? How to Reduce False Positives in Panel Regressions (2023).](https://ideas.repec.org/a/inm/orstsc/v8y2023i1p103-116.html)
10. [Kunst, R. Econometric Methods for Panel Data (University of Vienna lecture slides).](https://homepage.univie.ac.at/robert.kunst/panpres.pdf)
11. [Panel Data Fundamentals, PanelBox documentation.](https://panelbox.readthedocs.io/en/latest/theory/panel-fundamentals/)
12. [Making Theoretically Informed Choices in Specifying Panel-Data Models. Production and Operations Management (2021).](https://onlinelibrary.wiley.com/doi/10.1111/poms.13347)
13. [Bell, Fairbrother & Jones. Explaining Fixed Effects: Random Effects Modeling of Time-Series Cross-Sectional and Panel Data. Political Science Research and Methods.](https://www.cambridge.org/core/journals/political-science-research-and-methods/article/explaining-fixed-effects-random-effects-modeling-of-timeseries-crosssectional-and-panel-data/0334A27557D15848549120FE8ECD8D63)
14. [Baltagi, B. (2024). Hausman's Specification Test for Panel Data: Practical Tips. Advances in Econometrics.](https://ideas.repec.org/h/eme/aecozz/s0731-905320240000046002.html)
15. [Mundlak, Y. (1978). On the Pooling of Time Series and Cross Section Data. Econometrica 46(1): 69–85.](https://pages.stern.nyu.edu/~wgreene/Econometrics/Mundlak-1978.pdf)
16. [Wooldridge, J.M. Correlated random effects models with unbalanced panels. Journal of Econometrics.](https://www.sciencedirect.com/science/article/abs/pii/S0304407618302392)
17. [Stata [XT] xtreg postestimation manual.](https://www.stata.com/manuals/xtxtregpostestimation.pdf)
18. [Williams, R. Panel Data 4: Fixed Effects vs Random Effects Models (Notre Dame).](https://academicweb.nd.edu/~rwilliam/stats3/Panel04-FixedVsRandom.pdf)
19. [Fixed Effects Estimation of Large-T Panel Data Models. Annual Review of Economics.](https://www.annualreviews.org/content/journals/10.1146/annurev-economics-080217-053542)
20. [Henderson, Henry & Soberón (2025). Semiparametric correlated random-effects panel models.](https://bpb-us-e2.wpmucdn.com/sites.ua.edu/dist/b/420/files/2025/03/henderson_henry_soberon_2025.pdf)
21. [On generalized CCE estimation. Journal of Econometrics (2026).](https://www.sciencedirect.com/science/article/abs/pii/S0304407626000047)
22. [Botosaru & Powell (2026). Correlated Random Coefficient Distributions in Linear Panel Models. arXiv.](https://arxiv.org/abs/2605.21367)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 10, 2026 · Edited: Oct 10, 2026; Oct 11, 2026; Oct 15, 2026 · Last review: Oct 10, 2026*

Topic: 社会与历史 › 经济与商业 › 经济学 › Economic theory and methods › Econometrics and quantitative methods › Panel data methods

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/random-effects-model

English original: https://www.edgepedia.org/random-effects-model
