我想知道为什么pdwtest()输出的p值与lmtest和car的杜宾沃森测试(dwtest()和dwt() )非常不同。请查阅下文所述差异的文件。在此之后,我提供了从plm的pdwtest()源代码中获取的代码,并试图修复这个问题。有人能看看那个吗?仍然p-值不匹配,但非常接近.我怀疑,这是因为数字的精确性?另外,我不完全确定随机效应模型的p值,但这是一个统计问题,而不是一个编程问题(将截距留给测试?)
编辑2019-01-04:Bhargava等人的广义Durbin统计量。(1982年)和Baltagi/Wu的LBI统计现在已在最新版本(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,B.H.和P.X.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发布于 2015-08-11 10:49:26
‘'plm’开发者在这里。奇怪的p值值得研究(请注意,pdwtest只是包lmtest中dwtest的包装器),谢谢您的报告。
关于这背后的计量经济学: Bharghava等人。测试基本上是pdwtest()所做的;杜宾-沃森测试在很多方面都是次优程序,因此大多数现代教科书更倾向于建议布卢什-戈弗雷(面板版本见“plm”中的pbgtest() )。RE很好,因为转换后的残差在H0下是“白色”的。由于贬低导致的连续相关性,FE需要小心对待,因此,除了非常长的面板外,DW和BG测试通常都是不合适的:参见我在JStatSoft 27/2,2008年,第26页中的评论。更好的替代方案,特别是宽面板的测试是Wooldridge的测试:第一次差异测试(pwfdtest() in 'plm',也在Stata,见Drukker的论文)和在“plm”中实现的pwartest()测试,请参见JStatSoft 27/2,6.4。
https://stackoverflow.com/questions/31894055
复制相似问题