www.crosshyou.info

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

OECD Household savings data analysis 5 - Analyzing savings and per capita GDP using 'infer' package workflow.

Generated by Bing Image Creator: Photographic of real violet flowers on the flower garden, background is fine sky

www.crosshyou.info

This post is following of the above post. In this post I will analyze relationship between household savings and per capita GDP with R 'infer' package workflow. In the previous post, I make a scatter plot for savings and per capita GDP and it shows positive correlation. So I will check wheter there is positive correlation under year and location are controlled.

First, I load 'infer' package with library() function.

I refere Full infer Pipeline Examples • infer web site.

First, I calculate observed fit.

Coefficient of per_capita_gdp is 0.0000693, so it seems positive correlation with savings.
The question is whetere it is statistically significant or not.

Then, I generate bootstrap distribution.

Next, I use boot_dist object to find confidence intervals.

Let's see per_capita_gdp confidence interval.

confidence interval does not include ZERO, so per_capita_gdp is statistically significant under year and location are controlled.

Let's visualize it.

Two red vertical lines are confidence interval and blue vertical line is at 0. The confidence interval does not include 0, and bootstrap distribution also does not include zero.

So, I am very confident that per_capita_gdp is strongly associated with household savings under year and location are controlled.

That's it! Thank you!

Next post is

www.crosshyou.info

 


To read this post from the 1st post,

www.crosshyou.info