crosshyou

主にクロス表(分割表)分析をしようかなと思いはじめましたが、あまりクロス表の分析はできず。R言語の練習ブログになっています。

OECD Business confidence Index(BCI) data analysis 4 - Time-Series Regression using R - static model

f:id:cross_hyou:20211024082911j:plain

Photo by Elena Louca on Unsplash 

www.crosshyou.info

This post is following of above post.

Let's do time-series regression.
Firstly, let's make a static time series model

f:id:cross_hyou:20211024083503p:plain

In time-series regression, we have to care about serial correlation of the error term.

Firstly, I load dynlm package and lmtest package.

f:id:cross_hyou:20211024083838p:plain

Before testing serial correlation, let's plot error term.

f:id:cross_hyou:20211024084050p:plain

f:id:cross_hyou:20211024084100p:plain

Since I don't have good experiences, I cannot tell if there is serial correlation or not by just seeing the plot.

Let's test AR(1) Serial Correlation.

f:id:cross_hyou:20211024084525p:plain

p-value is less than 2e-16, it is alomost 0. So mod_static has serial correlation.

We need orcutt package to do Cochrane-Orcutt estimation and I will use cochrane.orcutt() function.

f:id:cross_hyou:20211024085211p:plain

Let's compare mod_static and mod_orcutt. 
I use stargazer package.

f:id:cross_hyou:20211024085646p:plain

sd_bci coefficient is negative and statistically significant. It means that when there are large variance of bci, bci level is lower than when varicance is small.
That's it. Thank you!

Next post is

 

www.crosshyou.info

 

To see the 1st post,

 

www.crosshyou.info