Ale*_*lex 5 regression r standard-error panel-data
有谁知道是否有一个包在R中运行Fama-MacBeth回归并计算标准错误?我知道该sandwich软件包及其评估Newey-West标准错误以及提供聚类功能的能力.但是,我没有看到有关Fama-MacBeth的任何事情.
lan*_*oni 11
该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
Run Code Online (Sandbox Code Playgroud)
但请注意,此方法仅在您的数据可以强制转换为a时才有效pdata.frame.(如果你有,那就失败了"duplicate couples (time-id)".)
详情请见: