5

有谁知道是否有一个包可以在 R 中运行 Fama-MacBeth 回归并计算标准误差?我知道该sandwich程序包及其估计 Newey-West 标准误差以及提供聚类功能的能力。但是,我没有看到任何关于 Fama-MacBeth 的信息。

4

1 回答 1

13

plm软件包可以估计 Fama-MacBeth 回归和 SE。

require(foreign)
require(plm)
require(lmtest)
test <- read.dta("http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/test_data.dta")
fpmg <- pmg(y~x, test, index=c("year","firmid")) ##Fama-MacBeth

> ##Fama-MacBeth
> coeftest(fpmg)

t test of coefficients:

            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 0.031278   0.023356  1.3392   0.1806    
x           1.035586   0.033342 31.0599   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

但是请注意,此方法仅在您的数据可以强制转换为pdata.frame. (如果你有它会失败"duplicate couples (time-id)"。)

有关详细信息,请参阅:

于 2012-06-12T14:21:56.953 回答