crosshyou

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

OECD Trust in government data analysis 4 - Simple linear regression using R - Trust in government ~ GDP, log(GDP).

f:id:cross_hyou:20211120181845j:plain

Photo by Dulana Kodithuwakku on Unsplash 

www.crosshyou.info

This post is following of the above post.

Let's make log(capi) as l_capi.

f:id:cross_hyou:20211120182044p:plain

Let's make a scatter plot for trust and l_capi.

f:id:cross_hyou:20211120182234p:plain

f:id:cross_hyou:20211120182247p:plain

It seems there is not clear relationship.

Then, I load broom package because I would like to use tidy() function with lm object.

f:id:cross_hyou:20211120182352p:plain

All right, I will make some linear regression analysis, dependent variable is trust and independent variable is gdp, l_gdp, capi and l_capi. I will do it by year and by iso.
So, I will make 4 * 2 = 8 set of linear regression anaysis.

1. Independent variable = gdp by year.

f:id:cross_hyou:20211120182912p:plain

For all year, from 2006 to 2020, p.value is greater than 0.05. So, by year regression, gpd is not significant variable fot trust.

 

2. Independent variable = gdp by iso

f:id:cross_hyou:20211120184224p:plain

Since there are 21 iso-s, I display the result p.value ascending order. CHL and COL hasve negative coefficient and others have positive coefficient. There are only 8 iso-s which have less than 0.05 p.value. 

3. independent variable  = l_gdp by year.

f:id:cross_hyou:20211120184621p:plain

We also see there is no year which have less than 0.05 p.value.

4. independent variable = l_gdp by iso.

f:id:cross_hyou:20211120184919p:plain

Again, CHL and COL have negative coefficient with less than 0.05 p.value.

There are 8 iso-s which have less than 0.05 p.value.

I assume it is possible for GDP to affect Trust in government, but there must be other factors to affect it.

That's it in this post, next post I will see capi and l_capi.

Next post is

 

www.crosshyou.info

 

 

To see the 1st post

 

www.crosshyou.info