我试图让 Newey-West 标准错误与包中的pmg()
(Mean Groups/Fama-MacBeth estimator)的输出一起使用plm
。
按照此处的示例:
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("firmid", "year")) # Time index in second position, unlike the example
我可以coeftest
直接使用就可以得到 Fama-MacBeth 标准错误:
# Regular “Fama-MacBeth” standard errors
coeftest(fpmg)
# t test of coefficients:
#
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) 0.032470 0.071671 0.453 0.6505
# x 0.969212 0.034782 27.866 <2e-16 ***
# ---
# Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
但是,尝试使用 Newey-West 估计器失败:
# Newey-West standard-errors
coeftest(fpmg, vcov = NeweyWest(fpmg, lag=3))
# Error in UseMethod("estfun") :
# no applicable method for 'estfun' applied to an object of class "c('pmg', 'panelmodel')"
这似乎是plm
包装中的一个缺点。你知道一种方法来完成这项工作吗?estfun
我应该为pmg
对象编写自己的代码吗?从头开始编写 Newey-West 估计器?或者我应该完全绕过这个plm
包?