OECD Trust in government data analysis 4 - Simple Linear Regression part II. I am very confident that trust and per capita GDP has positive relationship.

Generated by Bing Image Creator: Photograph of Japanese natural small river and wild fishes in the morning


This post is followong of the above post. In the previous post, I made a data frame which shows country averaged data. In this post, I will make year average data and will do simple linear regression.

First, I make a data frame group by year.

Let's see a scatte plot.

It seems there is positive relationship between l_pc_gdp and trust.

I use lm() function for theoretical-base linear regression and inference.

slope estimate for l_pc_gdp is 9.813. Let's see confidence interval with confint() function.

95% confidence interval for l_pc_gdp slope is from 2.415 to 17.21. It does not include 0.

Next, let's get confidence interval with simulation-based calsulation with 'infer' package workflow.

Let's calculate confidence interval with get_ci() function.

Simulation-based 95% confidence interval if between 2.88 and 17.2, that is narrower than theory-based confidence interval.
Let's visualize resutls.

Theory-base confidence interval and simulation-base one are very similar. I am very confident that l_pc_gdp and trust has positive relationship.

That's it. Thank you!

Next post is,



To read from the first post,