楼主: bolt2012
12897 32

[实际应用] 有关于时序协整分析 [推广有奖]

21
bolt2012 发表于 2013-2-22 11:16:32
parazhu 发表于 2013-2-22 08:57
对GDP进行对数转化之后的计算结果,用ur.df()得到结果:
> gdp[1:3,]
      cgdp syear    lngdp
对于取对数变换的GDP,我是这样做的:使用adf.test(),取的是默认的滞后3阶,即k = 3,做出来根据p值判断:lnGDP是非平稳,而lnGDP取一阶差分就平稳了。。这样的话岂不是跟你的ur.df()做法有出入?(因为你选的是drift,且lags = 0,这两点跟我的adf.test()不同,我看图像觉得lnGDP明显有trend特征啊?。。)。。那么那一种做法比较对?。。

22
parazhu 发表于 2013-2-22 11:18:51
通过偏自相关图,就可以知道大体要滞后几阶。
> pacf(nngdp$lngdp)

23
bolt2012 发表于 2013-2-22 11:23:38
parazhu 发表于 2013-2-22 10:17
可能上面的回答没有直接针对你的问题,但上面的回答实际就是最重要的技术细节。
下面针对你的问题做个 ...
恩恩,好的!但是,“value of statistics”有时候有若干个数啊!那么是不是选哪一个来与临界值比较,结果都是一样的?。。

24
parazhu 发表于 2013-2-22 11:23:52
drift是线性趋势
trend是加速增长趋势
你执行昨天我贴的模拟数据画图的程序,就明白了。

25
parazhu 发表于 2013-2-22 11:25:26
x=rnorm(100)
y=cumsum(x+1)
z=seq(1,3,,100)
z=cumsum(x+z)
x=cumsum(x)
par(mfrow=c(2,2))
plot(1:100,x,type="l",main="简单随机游走")
plot(1:100,y,type="l",main="带截距的随机游走")
plot(1:100,z,type="l",main="带趋势的随机游走")
matplot(1:100,cbind(x,y,z),type="l",lty=rep(1,3),col=1:3,main="组合图")


本文来自: 人大经济论坛 S-Plus&R专版 版,详细出处参考: https://bbs.pinggu.org/forum.php? ... &from^^uid=223619

26
parazhu 发表于 2013-2-22 11:28:34
选择第一个,回归方程中滞后一阶的那个t value,我们通常称为tau.
> summary(ur.df(nngdp$d,type="trend",lags=0))

###############################################
# Augmented Dickey-Fuller Test Unit Root Test #
###############################################

Test regression trend


Call:
lm(formula = z.diff ~ z.lag.1 + 1 + tt)

Residuals:
      Min        1Q    Median        3Q       Max
-0.079723 -0.042838  0.001859  0.037072  0.083701

Coefficients:
              Estimate Std. Error t value Pr(>|t|)  
(Intercept)  0.0792738  0.0316573   2.504   0.0189 *
z.lag.1     -0.4201063  0.1519755  -2.764   0.0103 *
tt          -0.0008454  0.0011083  -0.763   0.4525  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.04944 on 26 degrees of freedom
Multiple R-squared: 0.2304,        Adjusted R-squared: 0.1712
F-statistic: 3.892 on 2 and 26 DF,  p-value: 0.03322


Value of test-statistic is: -2.7643 2.6244 3.8921

27
bolt2012 发表于 2013-2-22 13:11:45
parazhu 发表于 2013-2-22 11:18
通过偏自相关图,就可以知道大体要滞后几阶。
> pacf(nngdp$lngdp)
恩恩,好的,但在R中,怎么才能根据赤池信息准则来精确判别要滞后多少阶?其实这样的精确判别是必须的吗?。。。

28
parazhu 发表于 2013-2-22 15:02:49
AIC准则,设置其中的selectlags
ur.df(nngdp$d,type="trend",selectlags="AIC")

29
bolt2012 发表于 2013-2-22 19:50:07
parazhu 发表于 2013-2-22 15:02
AIC准则,设置其中的selectlags
ur.df(nngdp$d,type="trend",selectlags="AIC")
好的,这个之前我试过了。。那么设定了selectlags,是不是再设定lags就不起作用了?即函数自动帮你选一个最优的滞后阶数,不再看你设定的那个lags了?。。。又或者不是这样,那在输出结果中要怎么看AIC准则?。。。我试了一下,貌似在输出结果中看不到AIC。。而且ur.df()函数默认的lags是1,弄得我不知怎么判断。。

30
waterhorse 发表于 2013-2-23 06:52:38
like the discussion. time series is kind of an art and if your true model is arima type, then the best way is to use either aic or sbc to select the lag and examine whether the residulas are white noises

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-27 15:03