0

我想知道为什么与' 和' 的 Durbin Watson 测试(分别为和)pdwtest()相比,输出的 p 值非常不同。请在下面找到有关差异的文档。之后,我提供了我从 plm 的源代码中获取的代码,并试图解决这个问题。有人可以看看吗?p 值仍然不匹配,但非常接近。我怀疑,这是由于数字精度?另外,我不完全确定随机效应模型的 p 值,但这是一个统计问题,而不是编程问题(将截距留给测试?)。lmtestcardwtest()dwt()pdwtest()

编辑 2019-01-04:Bhargava 等人的广义 Durbin-Watson 统计量。(1982) 和 Baltagi/Wu 的 LBI 统计现在在 plm 的最新版本 (1.7-0) 中实现为pbnftest().

我认为,我们必须区分这里发生的事情:

1) p 值:p 值似乎是关闭的,因为附加截距被传递给 lmtest::dwtest()。我的猜测是,这反过来会导致对自由度的错误计算,从而导致可疑的 p 值。

请参阅下面提到的论文和http://www.stata.com/manuals14/xtxtregar.pdf

Bhargava, Franzini, Narendranathan,序列相关和固定效应模型,经济研究评论(1982 年),XLIX,第 533-549 页

Baltagi、BH 和 PX Wu。1999. 带有 AR(1) 干扰的不等间距面板数据回归。计量经济学理论 15,第 814-823 页。

版本:R 3.1.3 plm_1.4-0 lmtest_0.9-34

require(plm)
require(lmtest)
require(car)

data("Grunfeld")

# Use lm() for pooled OLS and fixed effects
lm_pool <- lm(inv ~ value + capital, data = Grunfeld)
lm_fe   <- lm(inv ~ value + capital + factor(firm), data = Grunfeld)

# Use plm() for pooled OLS and fixed effects
plm_pool <- plm(inv ~ value + capital, data=Grunfeld, model = "pooling")
plm_fe   <- plm(inv ~ value + capital, data=Grunfeld, model = "within")
plm_re   <- plm(inv ~ value + capital, data=Grunfeld, model = "random")

# Are the estimated residuals for the pooled OLS and fixed effects model by plm() and lm() the same? => yes
all(abs(residuals(plm_pool) - residuals(lm_pool)) < 0.00000000001)
## [1] TRUE
all(abs(residuals(plm_fe)   - residuals(lm_fe))   < 0.00000000001)
## [1] TRUE

# Results match of lmtest's and car's durbin watson test match
lmtest::dwtest(lm_pool)
##  Durbin-Watson test
## 
## data:  lm_pool
## DW = 0.3582, p-value < 2.2e-16
## alternative hypothesis: true autocorrelation is greater than 0

car::dwt(lm_pool)
##  lag Autocorrelation D-W Statistic p-value
##    1       0.8204959     0.3581853       0
##  Alternative hypothesis: rho != 0

lmtest::dwtest(lm_fe)
##  Durbin-Watson test
## 
## data:  lm_fe
## DW = 1.0789, p-value = 1.561e-13
## alternative hypothesis: true autocorrelation is greater than 0

car::dwt(lm_fe)
##  lag Autocorrelation D-W Statistic p-value
##    1       0.4583415      1.078912       0
##  Alternative hypothesis: rho != 0

# plm's dw statistic matches but p-value is very different (plm_pool) and slightly different (plm_fe)
pdwtest(plm_pool)
##  Durbin-Watson test for serial correlation in panel models
## 
## data:  inv ~ value + capital
## DW = 0.3582, p-value = 0.7619
## alternative hypothesis: serial correlation in idiosyncratic errors

pdwtest(plm_fe)
##  Durbin-Watson test for serial correlation in panel models
## 
## data:  inv ~ value + capital
## DW = 1.0789, p-value = 3.184e-11
## alternative hypothesis: serial correlation in idiosyncratic errors
4

1 回答 1

3

'plm' 开发人员在这里。奇怪的 p 值值得研究(注意pdwtest只是dwtestfrom package的包装lmtest),感谢您的报告。

关于这背后的计量经济学:Bharghava 等人。测试基本上是做什么pdwtest()的;一般来说,Durbin-Watson 测试在许多方面都是次优程序,因此大多数现代教科书宁愿建议 Breusch-Godfrey(请参阅pbgtest()“plm”中的面板版本)。RE 很好,因为转换后的残差在 H0 下是“白色的”。由于贬低引起的序列相关性,FE 应小心谨慎,因此 DW 和 BG 测试通常不合适,除非是非常长的面板:请参阅我在 JStatSoft 27/2, 2008, p.26 中的评论。更好的替代方案,特别是对于宽面板,是 Wooldridge 的测试:一阶差分测试(pwfdtest()在“plm”中,也在 Stata 中,参见 Drukker 的论文)和在“plm”中实现的测试pwartest()

于 2015-08-11T10:49:26.477 回答