www.crosshyou.info

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

OECD Meat Consumption Data Analysis 7 - Time Series Regression using R dynlm() function.

f:id:cross_hyou:20210919153643j:plain

Photo by Ashutosh Saraswat on Unsplash 

www.crosshyou.info

This post is following of aabove post.
In this post, I will do some time-series regression with R.

First, I made JPN only dataframe.

f:id:cross_hyou:20210919154056p:plain

Let's see df_jpn.

f:id:cross_hyou:20210919154413p:plain

Then, I make ts object form df_jpn.

f:id:cross_hyou:20210919154507p:plain

f:id:cross_hyou:20210919154638p:plain

Let's see pokg and capi.

f:id:cross_hyou:20210919155529p:plain

f:id:cross_hyou:20210919155539p:plain

The both, pokg: POULTRY KG_CAP and capi: per capita GDP have uptrend.

I will make 4 time-series regression models.

1. Static Model

2. Finite Distributed Lag Model

3. Static Model with Trend

4. Finite Distrubuted Lag Model with Trend.

Before make regression models, I load dynlm package.

f:id:cross_hyou:20210919155958p:plain

All right, let's make those models.

f:id:cross_hyou:20210919160614p:plain

I use stargazer package to make results table.

f:id:cross_hyou:20210919160752p:plain

f:id:cross_hyou:20210919161001p:plain

We see capi has positive coefficients.

That's it. Thank you!

Next post is

 

www.crosshyou.info

 

To read the 1st post,

 

www.crosshyou.info