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

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

World Bank's Pregnant women receiving prenatal care (%) data analysis 4 - ANOVA with infer package

Generated by Bing Image Creator: long wide range landscape view, early fall season, nature field, photo

www.crosshyou.info

This post is following of above post.
In this post, I will do ANOVA(Analysis of Variance) with infer package of R.

First, let's check basic statistics by region

average range is from 60.6 to 100.

It seems there is statistically difference by region.

Let's confirm it by ANOVA.

I use "infer" package to do ANOVA.

I refer to Tidy ANOVA (Analysis of Variance) with infer • infer

First, I caluclate observed "F".

Next, I generate null distribution.

Then, I visualize null distibution and observed F statistic.

The red vertical line is the observed F statistic. So, the observed F statistic is far away from null distribution. It means observed F statistic is statistically significant.

Next, let's visualize theoretical distribution.

 

Next, let's visualize the both null distribution and theoretical distribution.

Next, let's calculate p-value.

p-value is 0. So I can say mean care (%) is different by region with 99.9999% confidence.

I also use pf() function to calculate theoretical p-value.

I did same workflow to check mean value by group.

mean value varies from 74.7 to 93.2.

Observed F stat is 62.7.

Then, I generate null distibution and visualize it.

Then, I visualize theoretical null distribution.

Then, I visualize the both null and theoretical distribution.

Then, I calculate p-value.

p-value is 0 too.

So, I can say average care(%) is different by group with almost 100% confident.

That's it. Thank you!

Next post is

www.crosshyou.info

 

To read from the 1st post,

www.crosshyou.info