协整理论及其R语言的实现_第1页
协整理论及其R语言的实现_第2页
协整理论及其R语言的实现_第3页
协整理论及其R语言的实现_第4页
协整理论及其R语言的实现_第5页
已阅读5页,还剩22页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、LogoLogoAdd Your Company Slogan协整理论及其协整理论及其R R语言的实现语言的实现邵晨邵晨上海财经大学上海财经大学 统计与管理学院统计与管理学院整理整理ppt为什么要协整?提纲提纲1 1什么是协整?2 2如何进行协整检验?3 3R语言中相关函数4 4案例:中国进出口之间关系检验5 5整理整理ppt伪回归(虚假回归)伪回归(虚假回归)回归分析:回归分析:一个重要的前提假设:平稳性但是,实际上大部分的宏观经济时间序列和金融时间序列都是非平稳的。 整理整理ppt伪回归(虚假回归)伪回归(虚假回归)案例案例结果结果以以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

3、-640.11 -350.44 -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.788

4、e-01 1.898e-02 25.23 6.54e-15 * * * *-Signif. codes: 0 Signif. codes: 0 * * * * 0.001 0.001 * * * 0.01 0.01 * * 0.05 . 0.1 1 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: Multi

5、ple R-squared: 0.974, Adjusted R-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 hyp

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

7、季度数据:ts(1:30,start=c(2003,3),end= ts(1:30,start=c(2003,3),end= c(2010,4),frequency=4)c(2010,4),frequency=4)整理整理ppt时间序列举例时间序列举例月度数据:月度数据: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)整理整理ppt单位根检验单位根检验urca包中的ur.d

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

9、brary(urca) library(urca) urt.ex urt.ex summary(urt.ex) summary(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

10、.lag.1 + 1 + tt + z.diff.lag)Residuals:Residuals: Min 1Q Median 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.5325

11、3 1.459 0.158(Intercept) 0.77701 0.53253 1.459 0.158z.lag.1 -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

12、 degrees of freedomResidual standard error: 0.08564 on 24 degrees 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 t

13、est-statistic is: Value of test-statistic is: -1.3211 -1.3211 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

14、 9.31 6.73 5.61 urt.im urt.im summary(urt.im) summary(urt.im)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 -

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整理整理ppt单位根检验单位根检验对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

16、 is: -4.8372 11.7049 Critical values for test statistics: 1pct 5pct 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

17、 lnex lnex reg reg summary(reg) summary(reg) library(lmtest) library(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. co

18、des: 0 Signif. codes: 0 * * * * 0.001 0.001 * * * 0.01 0.01 * * 0.05 . 0.05 . 0.1 1 0.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.

19、9893 0.9893 F-statistic: 2677 on 1 and 28 DF, p-value: F-statistic: 2677 on 1 and 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结论:残差平稳,说明两个时间序列之间存在协整关系。结论:残差平稳,说明两个时间序列之间存在协整关系。意味着我国的进口

20、和出口之间具有长期均衡关系,增长或者减少具有协同效意味着我国的进口和出口之间具有长期均衡关系,增长或者减少具有协同效应。应。整理整理pptEGEG两步协整检验:第二步(误差修正模型的建立)两步协整检验:第二步(误差修正模型的建立) 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 = l

21、m(formula = dlnex error.lagged + dlnim, data = diff.dat)diff.dat)Residuals:Residuals: 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 val

22、ue Pr(|t|) (Intercept) (Intercept) 0.10648 0.10648 0.02358 4.516 0.000131 0.02358 4.516 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 Signif. codes: 0 * * * * 0.001 0.001 * * * 0.01 0.01 * * 0.05 . 0.1 0.05 . 0.1 1 1 Residual standard error: 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, Adju

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论