Rで何かをしたり、読書をするブログ

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

OECD Business confidence Index(BCI) data analysis 8 - BCI and GDP Growth are positively correlated.

f:id:cross_hyou:20211031163109j:plain

Photo by J Lee on Unsplash 

www.crosshyou.info

This post is following of above post.
In the previous post, I made panel data dataframe.
Let's analyze this.

Firstly, let's see correlation.

f:id:cross_hyou:20211031163849p:plain

g_gdp and g_capi are highly correlated. bci_sd are negatively correlated to others.

Let's make a linear regression model that explaines bci_avg with bci_sd and g_gdp.

f:id:cross_hyou:20211031164237p:plain

If bci_sd increase by 1, bci_avg decrease by -0.63. If g_gdp increase by 0.01, bci_avg increase by 0.197.

Let's check if there is heteroskedasticity for error terms.

f:id:cross_hyou:20211031165157p:plain

I did manuall checking and using bptest(). The both meshod shows there is heteroskedasticity.

Let's see residuals plot chart.

f:id:cross_hyou:20211031165528p:plain

f:id:cross_hyou:20211031165538p:plain

Since there is heteroskedasticity, we need heteroskedasticity-robust SE.

f:id:cross_hyou:20211031165827p:plain

Let's see how well lm1 model matches actual data for JPN data.

1. I made JPN dataframe

f:id:cross_hyou:20211031170335p:plain

2. I made predicted bci_avg with predict() function.

f:id:cross_hyou:20211031170525p:plain

3. plot actual bci_avg and predicted value.

f:id:cross_hyou:20211031171510p:plain

f:id:cross_hyou:20211031171527p:plain

It seems not good fitting.

That's it.Thank you!

 

To read from the 1st post,

 

www.crosshyou.info