对于面板模型和混合OLS(Durbin Watson自相关测试),来自plm的pdwtest错误的p值(和统计数据?)?

时间:2015-08-08 14:24:15

标签: r plm panel-data

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

EDIT 2019-01-04 :Bhargava等人的广义Durbin-Watson统计量。 (1982)和Baltagi / Wu的LBI统计数据现在以pbnftest()的最新版本(1.7-0)实现。

我认为,我们必须在这里发生不同的事情:

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

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

Bhargava,Franzini,Narendranathan,Serial Correlation and the Fixed Effects Model,Review of Economic Studies(1982),XLIX,pp.533-549

Baltagi,B。H.和P. X. Wu。具有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

1 个答案:

答案 0 :(得分:3)

&#39; PLM&#39;开发者在这里奇怪的p值值得研究(注意pdwtest只是dwtest的包装),感谢报道。 关于这背后的计量经济学:Bharghava等。测试基本上是pdwtest()的作用;一般来说,Durbin-Watson测试在许多方面都是一个次优的程序,因此大多数现代教科书都建议使用Breusch-Godfrey(参见pbgtest()以及面板版本)。 RE是好的,因为转换后的残差是&#34;白色&#34;在H0下。由于贬值引起的序列相关性,因此需要谨慎使用FE,因此除了非常长的面板外,DW和BG测试通常不合适:参见我在JStatSoft 27 / 2,2008中的评论,第26页。更好的替代方案,特别是对于宽面板,是Wooldridge的测试:第一次差异测试(pwfdtest()在&#39; plm&#39;,也在Stata,参见Drukker的论文)和测试在&#39; PLM&#39;作为pwartest()。再见JStatSoft 27 / 2,6.4。