www.crosshyou.info

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

OECD Trust in government data analysis 7 - In Japan, Trust in government and log(per capita GDP) has some relationship.

f:id:cross_hyou:20211123182100j:plain

Photo by Zoltan Tasi on Unsplash 

www.crosshyou.info

This post is following above post.

I will add interst rate data

f:id:cross_hyou:20211123182240p:plain

and long term unpenployment data. 

f:id:cross_hyou:20211123182341p:plain

longterm unenployment is "number of unenployee more than 12 months / number of all unenpolyee".

I use read_csv() function to read data into R.

f:id:cross_hyou:20211123182746p:plain

f:id:cross_hyou:20211123182934p:plain

Next, I used inner_join() function to merge df dataframe and the two data frames.

f:id:cross_hyou:20211123183245p:plain

Then, I will use iso = JPN only because I am a Japanese and I have special interest to Japan's Trust in gorvenment.

I make df_jpn with filter() function.

f:id:cross_hyou:20211123183550p:plain

Let's see scatter plot for trust, l_capi, cpi, int and long_unem.

f:id:cross_hyou:20211123183851p:plain

f:id:cross_hyou:20211123183901p:plain

Let's see correlations with cor() function.

f:id:cross_hyou:20211123184102p:plain

I see l_capi and int has very strong negative correlation. So I will not use int for regression analysis.

Let's make a liner regression object with lm() function.

f:id:cross_hyou:20211123193854p:plain

coefficients of l_capi is 64.8440 and it is statistically significant.

Let's see residual plot.

f:id:cross_hyou:20211123194455p:plain

f:id:cross_hyou:20211123194503p:plain

Let's check if there is heteroskedasticity.

f:id:cross_hyou:20211123194708p:plain

There is no p-value less than 0.05. So, lm_jpn model has not heteroskedasticity.

That's it. Thank you!

Next post is

 

www.crosshyou.info

 

To read the 1st post,

 

www.crosshyou.info