Newey-West 標準エラーをパッケージpmg()
からの (Mean Groups/Fama-MacBeth estimator)の出力で動作させようとしています。plm
hereの例に従ってください:
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
または、パッケージを完全にバイパスする必要がありますか?