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

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

OECD Trust in government data analysis 2 - ANOVA analysis shows Trust in government are different by countries. ITA has the lowest, CAN has the highest.

f:id:cross_hyou:20211114164054j:plain

Photo by SGR on Unsplash 

www.crosshyou.info

This post is following of the above post.

In the previous post, I loaded OECD Trust in government data.
Let's see overall histogram of the data. I use hist() function.

f:id:cross_hyou:20211114164536p:plain

f:id:cross_hyou:20211114164602p:plain

It looks like normal distribution.
Next, let's see distribution by TIME. I use boxplot() function.

f:id:cross_hyou:20211114165101p:plain

f:id:cross_hyou:20211114165113p:plain

It seems there is not significant different by year.

Let's check it with aov() function.

f:id:cross_hyou:20211114165445p:plain

p-value is 0.837, so I cannot reject H0: Value is the same for each TIME.

Next, let's see Value by LOCATION.

First, I sorted LOCATION by median value.

f:id:cross_hyou:20211114172044p:plain

ITA has the lowest median value and CAN has the highest.
Then, I change LOCATION to factor class, level order is sorted_order.

f:id:cross_hyou:20211114172604p:plain

Then, I use boxplot().

f:id:cross_hyou:20211114172802p:plain

f:id:cross_hyou:20211114172816p:plain

It seems there is significanr difference value by LOCATION.
Let's confirm it.

f:id:cross_hyou:20211114173105p:plain

p-value is less than 2e-16. So, I reject H0: Value is the same by LOCATION.

That's it. Thank you!

Next post is

 

www.crosshyou.info

 


To read from the 1st post,

 

www.crosshyou.info