协整理论及其R语言的实现

上传人:cl****1 文档编号:568506249 上传时间:2024-07-25 格式:PPT 页数:26 大小:405KB
返回 下载 相关 举报
协整理论及其R语言的实现_第1页
第1页 / 共26页
协整理论及其R语言的实现_第2页
第2页 / 共26页
协整理论及其R语言的实现_第3页
第3页 / 共26页
协整理论及其R语言的实现_第4页
第4页 / 共26页
协整理论及其R语言的实现_第5页
第5页 / 共26页
点击查看更多>>
资源描述

《协整理论及其R语言的实现》由会员分享,可在线阅读,更多相关《协整理论及其R语言的实现(26页珍藏版)》请在金锄头文库上搜索。

1、协整理论及其R语言的实现Stillwatersrundeep.流流静静水深水深,人人静静心深心深Wherethereislife,thereishope。有生命必有希望。有生命必有希望为什么要协整?提纲提纲1 1什么是协整?2 2如何进行协整检验?3 3R语言中相关函数4 4案例:中国进出口之间关系检验5 5伪回归(虚假回归)伪回归(虚假回归)回归分析:回归分析:一个重要的前提假设:平稳性但是,实际上大部分的宏观经济时间序列和金融时间序列都是非平稳的。 伪回归(虚假回归)伪回归(虚假回归)案例案例结果结果以以1990年至年至2008年年美国美国城镇居民家城镇居民家庭人均可支配收入和庭人均可支配

2、收入和中国中国人均消费人均消费性支出为例:性支出为例: data Usincome Chinacoms reg summary(reg) library(zoo) library(lmtest) dwtest(reg)Call:Call:lm(formula = Chinacoms USincome)lm(formula = Chinacoms USincome)Residuals:Residuals: Min 1Q Median 3Q Max Min 1Q Median 3Q Max -640.11 -350.44 -55.96 346.49 1139.42 -640.11 -350.44

3、-55.96 346.49 1139.42 Coefficients:Coefficients: Estimate Std. Error t value Pr(|t|) Estimate Std. Error t value Pr(|t|) (Intercept) -6.886e+03 4.896e+02 -14.06 8.56e-11 *(Intercept) -6.886e+03 4.896e+02 -14.06 8.56e-11 *USincome 4.788e-01 1.898e-02 25.23 6.54e-15 *USincome 4.788e-01 1.898e-02 25.23

4、 6.54e-15 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 Residual standard error: 477.7 on 17 degrees of freedomResidual standard error: 477.7 on 17 degrees of freedomMultiple R-squared: 0.974, Adjusted R-squared: Multiple R-squared: 0.974, Adjusted R

5、-squared: 0.9724 0.9724 F-statistic: 636.3 on 1 and 17 DF, p-value: 6.544e-15 F-statistic: 636.3 on 1 and 17 DF, p-value: 6.544e-15 Durbin-Watson test Durbin-Watson testdata: reg data: reg DW = 0.4992, p-value = 4.485e-06DW = 0.4992, p-value = 4.485e-06alternative hypothesis: true autocorrelation is

6、 greater than alternative hypothesis: true autocorrelation is greater than 0 0 显著的显著的R R2 2较大的较大的t t值值DWDW统计量很小,存统计量很小,存在严重的自相关在严重的自相关线线性回性回归归模型模型lm()函数:用法: fitted.model reg ts(1:30,start=1980,end=2009, ts(1:30,start=1980,end=2009, frequency=1)frequency=1)季度季度数数据:据:ts(1:30,start=c(2003,3),end= ts(1:

7、30,start=c(2003,3),end= c(2010,4),frequency=4)c(2010,4),frequency=4)时间时间序列序列举举例例月度月度数数据:据:ts(1:30,start=c(2008,5), ts(1:30,start=c(2008,5), frequency=12)frequency=12)每日每日数数据:据: a a print(a,calendar=TRUE) print(a,calendar=TRUE)单位根检验单位根检验urca包中的ur.df()函数:用法:ur.df(y, type = c(none, drift, trend), lags

8、= 1, selectlags = c(Fixed, AIC, BIC) 参数:y 被检验的时间序列type 检验类型: “none”, “drift” 或者 trend.lags 内生变量的滞后阶数selectlags 滞后阶数确定方法:the Akaike “AIC” 或者 the Bayes “BIC” 信息 准则,默认值是fixed,由lags确定滞后阶数。 案例分析:中国进出口贸易之间关系案例分析:中国进出口贸易之间关系数据来源:国家统计数据库( http:/ library(urca) library(urca) urt.ex urt.ex summary(urt.ex) summ

9、ary(urt.ex)# # # Augmented Dickey-Fuller Test Unit Root Test # # Augmented Dickey-Fuller Test Unit Root Test # # # Test regression trend Test regression trend Call:Call:lm(formula = z.diff z.lag.1 + 1 + tt + z.diff.lag)lm(formula = z.diff z.lag.1 + 1 + tt + z.diff.lag)Residuals:Residuals: Min 1Q Med

10、ian 3Q Max Min 1Q Median 3Q Max -0.17362 -0.05933 0.02236 0.05216 0.12439 -0.17362 -0.05933 0.02236 0.05216 0.12439 Coefficients:Coefficients: Estimate Std. Error t value Pr(|t|) Estimate Std. Error t value Pr(|t|)(Intercept) 0.77701 0.53253 1.459 0.158(Intercept) 0.77701 0.53253 1.459 0.158z.lag.1

11、-0.15325 0.11600 -1.321 0.199z.lag.1 -0.15325 0.11600 -1.321 0.199tt 0.02699 0.01723 1.566 0.130tt 0.02699 0.01723 1.566 0.130z.diff.lag 0.20945 0.20765 1.009 0.323z.diff.lag 0.20945 0.20765 1.009 0.323Residual standard error: 0.08564 on 24 degrees of freedomResidual standard error: 0.08564 on 24 de

12、grees of freedomMultiple R-squared: 0.2354, Adjusted R-squared: 0.1398 Multiple R-squared: 0.2354, Adjusted R-squared: 0.1398 F-statistic: 2.462 on 3 and 24 DF, p-value: 0.08697 F-statistic: 2.462 on 3 and 24 DF, p-value: 0.08697 Value of test-statistic is: Value of test-statistic is: -1.3211 -1.321

13、1 7.0028 3.0289 7.0028 3.0289 Critical values for test statistics: Critical values for test statistics: 1pct 5pct 10pct 1pct 5pct 10pcttau3 tau3 -4.15 -3.50 -3.18-4.15 -3.50 -3.18phi2 7.02 5.13 4.31phi2 7.02 5.13 4.31phi3 9.31 6.73 5.61phi3 9.31 6.73 5.61 urt.im urt.im summary(urt.im) summary(urt.im

14、)Value of test-statistic is: Value of test-statistic is: -2.2266 -2.2266 6.0966 6.0966 3.3771 3.3771 Critical values for test statistics: Critical values for test statistics: 1pct 5pct 10pct 1pct 5pct 10pcttau3 tau3 -4.15 -3.50 -3.18-4.15 -3.50 -3.18phi2 7.02 5.13 4.31phi2 7.02 5.13 4.31phi3 9.31 6.

15、73 5.61phi3 9.31 6.73 5.61单单位根位根检验检验对dlnexdlnex单位根检验结果:Value of test-statistic is: -3.2348 5.2379 Critical values for test statistics: 1pct 5pct 10pcttau2 -3.58 -2.93 -2.60phi1 7.06 4.86 3.94对dlnimdlnim单位根检验结果:Value of test-statistic is: -4.8372 11.7049 Critical values for test statistics: 1pct 5pct

16、 10pcttau2 -3.58 -2.93 -2.60phi1 7.06 4.86 3.94结论:中国进口和出口的对数时间序列不平稳,但一阶差分后平稳,结论:中国进口和出口的对数时间序列不平稳,但一阶差分后平稳,说明是一阶单整序列,即说明是一阶单整序列,即lnex,lnim lnex,lnim I(1) I(1),满足协整检验条件。,满足协整检验条件。dlnex - diff(lnex)dlnim exim exim ex ex im im lnim lnim lnex lnex reg reg summary(reg) summary(reg) library(lmtest) librar

17、y(lmtest) dw dw |t|) Estimate Std. Error t value Pr(|t|) (Intercept) (Intercept) -0.48270 -0.48270 0.14717 -3.28 0.14717 -3.28 0.00278 * 0.00278 * lnim lnim 1.07457 1.07457 0.02077 51.74 0.02077 51.74 2e-16 * 2e-16 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 Signif. codes: 0 * 0.001 * 0.01 * 0.05

18、 . 0.1 1 1 Residual standard error: 0.1401 on 28 degrees of Residual standard error: 0.1401 on 28 degrees of freedomfreedomMultiple R-squared: 0.9897, Adjusted R-Multiple R-squared: 0.9897, Adjusted R-squared: squared: 0.9893 0.9893 F-statistic: 2677 on 1 and 28 DF, p-value: F-statistic: 2677 on 1 a

19、nd 28 DF, p-value: error urt.resid summary(urt.resid)Value of test-statistic is: -3.6185 Critical values for test statistics: 1pct 5pct 10pcttau1 -2.62 -1.95 -1.61结论:残差平稳,说明两个时间序列之间存在协整关系。结论:残差平稳,说明两个时间序列之间存在协整关系。意味着我国的进口和出口之间具有长期均衡关系,增长或者减少具有协同效意味着我国的进口和出口之间具有长期均衡关系,增长或者减少具有协同效应。应。EGEG两步协整检验:第二步(误差

20、修正模型的建立)两步协整检验:第二步(误差修正模型的建立) error error error.lagged error.lagged ecm.reg1 ecm.reg1 summary(ecm.reg1) summary(ecm.reg1) dwtest(ecm.reg1) dwtest(ecm.reg1)Call:Call:lm(formula = dlnex error.lagged + dlnim, data = lm(formula = dlnex error.lagged + dlnim, data = diff.dat)diff.dat)Residuals:Residuals:

21、Min 1Q Median 3Q Max Min 1Q Median 3Q Max -0.17214 -0.05198 0.01546 0.05053 0.14514 -0.17214 -0.05198 0.01546 0.05053 0.14514 Coefficients:Coefficients: Estimate Std. Error t value Pr(|t|) Estimate Std. Error t value Pr(|t|) (Intercept) (Intercept) 0.10648 0.10648 0.02358 4.516 0.000131 0.02358 4.51

22、6 0.000131 *error.lagged error.lagged -0.29647 -0.29647 0.11430 -2.594 0.015645 0.11430 -2.594 0.015645 * * dlnim dlnim 0.33929 0.33929 0.12470 2.721 0.011681 * 0.12470 2.721 0.011681 * -Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 1 Residual standard e

23、rror: 0.08024 on 25 degrees of Residual standard error: 0.08024 on 25 degrees of freedomfreedomMultiple R-squared: 0.3008, Adjusted R-squared: Multiple R-squared: 0.3008, Adjusted R-squared: 0.2448 0.2448 F-statistic: 5.377 on 2 and 25 DF, p-value: 0.01142F-statistic: 5.377 on 2 and 25 DF, p-value:

24、0.01142Durbin-Watson testDurbin-Watson testdata: ecm.reg1 data: ecm.reg1 DW = 2.408, p-value = 0.827DW = 2.408, p-value = 0.827alternative hypothesis: true alternative hypothesis: true autocorrelation is greater than 0autocorrelation is greater than 0EGEG两步协整检验:第二步(误差修正模型的建立)两步协整检验:第二步(误差修正模型的建立)误差修正模型:lnexlnext t=0.1065-0.2965ecm=0.1065-0.2965ecmt-1t-1+0.3393+0.3393lnimlnimt t+ +t t结论:误差修正项的系数为负,符合误差修正机制,反映了上一期偏离长期均衡的数量将在下一期得到30%的反向修正,这也符合之前证明的协整关系。总结总结中国进出口之间的长期均衡关系:lnext=-0.4827+1.0745lnimt短期波动关系:lnext=0.1065-0.2965ecmt-1+0.3393lnimt+tLogoLogoAdd Your Company SloganThank you

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号