自相关实例与习题

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

使用PW方法进行估计:
Prais-Winsten AR(1) regression -- iterated estimates
Source
Model Residual
Total
SS
.04494596 .027154354
.072100315
df
MS
3 .014981987 26 .001044398
.0044129
.7353747 .0020689 .0009542
-1.27 -0.53
4.62
0.219 0.600 0.000
.2239369 .2517345
0.89 0.384
.6409404 .7758574
0.83 0.418
.0038767 .0019773
1.96 0.063
-.0021416 .0007266 .0113797 .2543701
Root MSE
=
29 15.40 0.0000 0.6489 0.6068 .03191
consumption
Coef. Std. Err.
t P>|t|
price income
temp _cons
-.8923963 .0032027 .0035584 .1571479
.8108501 .0015461 .0005547 .2896292
0 15
5
10
Lag
95% Confidence bands [se = 1/sqrt(n)]
自相关图不明显,偏相关图显示了1阶与10阶之后 的高阶自相关。进行BG检验与Q检验,先设定10阶滞 后。
. estat bgodfrey,lags(10)
Breusch-Godfrey LM test for autocorrelation
Source
Model Residual
Total
SS
.047040596 .025451894
.072492491
df
MS
3 .015680199 25 .001018076
28 .002589018
Number of obs =
F( 3, 25) =
Prob > F
=
R-squared
=
Adj R-squared =
[95% Conf. Interval]
price income
temp _cons
-1.044413 .0033078 .0034584 .1973149
.8874727 .0012065 .0004647 .2964394
-1.18 2.74 7.44 0.67
0.250 0.011 0.000 0.512
Portmanteau (Q) statistic =
Prob > chi2(1)
=
3.6000 0.0578
Prob > chi2 0.0396
存在1阶自相关。如果用Newey-West方法进行估计, 则指定滞后阶数1阶
. newey consumption price income temp,lag(1)
lags(p)
chi2
df
Prob > chi2
1
0.777
1
0.3779
可以看出加入滞后变量很好地排除了自相关。所以 我们可以相信t检验的结果,把那些不显著的滞后值 都剔除重新进行估计
-.3581223
.6706322 .0057156 .0043743
.752752
估计结果显示,气温与收入均显著,而价格和常数 不显著。由于这是时间序列数据,我们怀疑其扰动 项存在自相关。先画残差与滞后值的散点图
.05 .1
0
-.05 -.1
Baidu Nhomakorabea-.1
-.05
0
.05
.1
Residuals
lre
进行OLS回归得到:
. reg consumption price income temp
Source
SS
df
MS
Model Residual
.090250523 .035272835
3 .030083508 26 .001356647
Total .125523358 29 .004328392
=
16.3718 0.0895
10阶自相关不存在,因为要检验1阶自相关,所以 先设定2阶滞后检验。
. estat bgodfrey,lags(2)
Breusch-Godfrey LM test for autocorrelation
lags(p)
chi2
df
Prob > chi2
2
4.487
2
lags(p)
chi2
df
Prob > chi2
10
14.977
10
0.1329
H0: no serial correlation
. wntestq re,lags(10)
Portmanteau test for white noise
Portmanteau (Q) statistic =
Prob > chi2(10)
0.1061
H0: no serial correlation
. wntestq re,lags(2)
Portmanteau test for white noise
Portmanteau (Q) statistic =
Prob > chi2(2)
=
3.6450 0.1616
不存在2阶自相关,最后检验1阶自相关
Regression with Newey-West standard errors maximum lag: 1
Number of obs =
F( 3, 26) =
Prob > F
=
30 18.76 0.0000
consumption
Newey-West Coef. Std. Err.
t P>|t|
-1.10 2.07 6.42 0.54
0.282 0.049 0.000 0.592
rho
.4009256
Durbin-Watson statistic (original) 1.021169 Durbin-Watson statistic (transformed) 1.548837
[95% Conf. Interval]
首先画折线图,观察各变量与因变量之间的大致关 系:
graph twoway connected consumption time||connected temp100 time||connected price time||connected income time ,yaxis(2)
建立回归模型;
. estat bgodfrey ,lags(1)
Breusch-Godfrey LM test for autocorrelation
lags(p)
chi2
df
1
4.237
1
H0: no serial correlation
. wntestq re,lags(1)
Portmanteau test for white noise
29 .002486218
Number of obs =
F( 3, 26) =
Prob > F
=
R-squared
=
Adj R-squared =
Root MSE
=
30 14.35 0.0000 0.6234 0.5799 .03232
consumption
Coef. Std. Err.
t P>|t|
Number of obs =
F( 3, 26) =
Prob > F
=
R-squared
=
Adj R-squared =
Root MSE
=
30 22.17 0.0000 0.7190 0.6866 .03683
consumption
price income
temp _cons
Coef. Std. Err.
费、温度、收入、价格均很有可能是自相关的变量,
如果这些自相关变量的滞后值会影响消费,而我们
遗漏了,那么必然会导致自相关,所以我们加入所 有这些变量的一阶滞后进行回归。
. reg consumption price income temp L. consumption L. price L. income L. temp
Root MSE
=
29 18.80 0.0000 0.8624 0.8165 .0286
consumption
price income
temp
consumption L1.
price L1.
income L1.
temp L1.
_cons
Coef. Std. Err.
t P>|t|
-.9320616 -.0011027
有一些滞后项显著有一些不显著,但是我们还不能
马上根据t检验判断哪些滞后项需要删除,因为可能 存在自相关导致t检验不可信。所以我们要首先进行 自相关检验。以下是BG检验的结果
. estat bgodfrey ,lags(1)
Breusch-Godfrey LM test for autocorrelation
Source
Model Residual
Total
SS
.107616085 .017177147
.124793232
df
MS
7 .015373726 21 .000817959
28 .004456901
Number of obs =
F( 7, 21) =
Prob > F
=
R-squared
=
Adj R-squared =
-2.868639 .0008278 .0025033
-.4120249
.7798132 .0057877 .0044136 .8066547
与原估计相比,估计系数相等,系数以及模型整体 显著性几乎没变。如果只是追求系数的一致性且在
大样本下,可以到此为止。但此例为一阶自相关, 可以用FGLS进行估计。
以Hildreth and Lu(1960)对冰淇淋需求函数的研究为 例,数据集为icecream.dta 包含下列变量的30个月度 时间序列数据:consumption(人均冰淇淋消费量), income(平均家庭收入),price(冰淇淋价格), temp(平均华氏气温),time(时间)。 目的:研究冰淇淋消费数量的影响因素。
[95% Conf. Interval]
-2.610545 -.0050074
.0014929 -.0199311
.5128361 .0034029 .0044152 1.193941
使用CO方法估计:
Cochrane-Orcutt AR(1) regression -- iterated estimates
t P>|t|
-1.044413 .0033078 .0034584 .1973149
.834357 .0011714 .0004455 .2702161
-1.25 2.82 7.76 0.73
0.222 0.009 0.000 0.472
[95% Conf. Interval]
-2.759458 .0008999 .0025426
Fitted values
从散点图看可能存在正相关。画自相关与偏相关图
0.50
0.50
0.00
Partial autocorrelations of re
0.00
-0.50
-1.00
-0.50
0
5
10
Lag
Bartlett's formula for MA(q) 95% confidence bands
-2.95 0.008 0.04 0.965
[95% Conf. Interval]
-2.461357 -.0054053
.0024286
.5972339 .0031999 .0063973
-.2995735 .7474474
-.9725433 2.254424
-.0002354 .0079887
-.0036525 -.0006306 -.5176119 .5403713
-2.562373 .0000186 .002416
-.4393546
.7775807 .0063869 .0047008 .7536504
从估计系数来看,PW法估计原先显著的income变 为不显著,CO法估计的显著性与Newey-West方法一 致,且从e’e/(n-k)来看CO法要比PW法略好一些。 自相关可能是遗漏变量造成的,因此可以加入变量 的滞后值做自变量进行回归。考虑到这个模型,消
price income
temp _cons
-1.048854 -.0008022
.0029541 .5870049
.759751 .0020458 .0007109 .2952699
-1.38 -0.39
4.16 1.99
0.179 0.698 0.000 0.057
rho
.8002264
Durbin-Watson statistic (original) 1.021169 Durbin-Watson statistic (transformed) 1.846795
相关文档
最新文档