www.crosshyou.info

政府統計の総合窓口のデータや、OECDやUCIやのデータを使って、Rの練習をしています。ときどき、読書記録も載せています。

OECD Household disposable income data analysis 6 - Time-Series Data Regression using R

f:id:cross_hyou:20210820204755j:plain

 Photo by Jeremy Bishop on Unsplash  

www.crosshyou.info

This post is following of above post.
In this post, I will do time-series data regression using R.

Firstly, I converted avg_gr_us in 10000 value.

f:id:cross_hyou:20210820205208p:plain

Then, I converted df_year2 data frame to ts object.

f:id:cross_hyou:20210820205340p:plain

Then, I load dynlm package.

f:id:cross_hyou:20210820205434p:plain

Let's begin with "static model"

f:id:cross_hyou:20210820205530p:plain

We see avg_gr_us and avg_ne_ag are negative correlation.

f:id:cross_hyou:20210820205754p:plain

Aggregate coefficeitns are -1.3475 + 1.0833 - 0.5435 = -0.8077.

Next, load car package.

f:id:cross_hyou:20210820210021p:plain

Then, I do F test to test H0: all "avg_gr_us" coefficients are = 0

f:id:cross_hyou:20210820210121p:plain

p-value is 0.002097, so I reject H0.

Then, I made trend only model.

f:id:cross_hyou:20210820210810p:plain

We see trend coefficient is statistically significant.

Then, I made trend + avg_gr_us model.

f:id:cross_hyou:20210820211250p:plain

p-value is 0.000141 so this model is statistically significant.

That}s it. Thank you!

Next post is

 

www.crosshyou.info

 

To read the 1st post,

 

www.crosshyou.info