本文介绍了R中的Fama MacBeth标准错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Does anyone know if there is a package that would run Fama-MacBeth regressions in R and calculate the standard errors? I am aware of the sandwich package and its ability to estimate Newey-West standard errors, as well as providing functions for clustering. However, I have not seen anything with respect to Fama-MacBeth.

推荐答案

plm包可以估计Fama-MacBeth回归和SE.

The plm package can estimate Fama-MacBeth regressions and SEs.

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)",它将失败.)

However note that this method works only if your data can be coerced to a pdata.frame. (It will fail if you have "duplicate couples (time-id)".)

有关更多详细信息,请参见:

For further details see:

这篇关于R中的Fama MacBeth标准错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 10:59