我正在尝试在R的plm
包中运行具有固定效应和model = 'within'
的回归,同时具有聚类标准误。使用plm
中的Cigar
数据集,我正在运行:
require(plm)
require(lmtest)
data(Cigar)
model <- plm(price ~ sales + factor(state), model = 'within', data = Cigar)
coeftest(model, vcovHC(model, type = 'HC0', cluster = 'group'))
Estimate Std. Error t value Pr(>|t|)
sales -1.21956 0.21136 -5.7701 9.84e-09
这与我使用Stata(将Cigar文件写为.dta)获得的结果略有不同:
use cigar
xtset state year
xtreg price sales, fe vce(cluster state)
price Coef. Std. Err. t P>t [95% Conf. Interval]
sales -1.219563 .2137726 -5.70 0.000 -1.650124 -.7890033
即标准误差和T统计量是不同的。我尝试使用不同的“类型”重新运行R代码,但没有一种方法能够给出与Stata相同的结果。我是否漏掉了什么?