crosshyou

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

OECD Doctors' consultations data analysis 4 - T-test shows doctors' consultations has been increased from 2007 to 2012.

 

f:id:cross_hyou:20210612090416j:plain

 Photo by Jasper Wilde on Unsplash  

www.crosshyou.info

 This post is following og above post.

This time, let's see boxplot by region for 2021 data

f:id:cross_hyou:20210612091347p:plain

f:id:cross_hyou:20210612091403p:plain

We see Asia region has the highest consultations and Afirica has the lowest.

Then, how about 2007 and 2012. Is there any significant change?

f:id:cross_hyou:20210612092836p:plain

f:id:cross_hyou:20210612092855p:plain

It seems there is not significant difference between 2007 and 2012.
Let's confirm it with t.test().

f:id:cross_hyou:20210612093133p:plain

p-value shows 0.3834, 95% confidence interval is -1.98 ~ 0.77. This means there is not differnece between 2007 and 2012 at 95% confidence level.

Then, let's check it more closely. we know 2007 and 2012 has the same countries. So, let's see differnece of each country.

For example, see

f:id:cross_hyou:20210612093832p:plain

AUS has 6.3 for 2007 and 6.9 for 2012. So, AUS has 0.6(6.9 - 6.3) increase.
Let's calculate this 'increase'.
First, we will convert data frame to wide type.

f:id:cross_hyou:20210612094536p:plain

delete NA rows with na.omit() function and calculate Y2012 - Y2007 with mutate() function.

f:id:cross_hyou:20210612094920p:plain

Then, let's see diff histogram

f:id:cross_hyou:20210612095200p:plain

f:id:cross_hyou:20210612095216p:plain

We see average diff seems greater than 0.

Let's conform it with t.test() function

f:id:cross_hyou:20210612095436p:plain

p-value = 0.01019, 95% confidence interval is 0.077 ~ 0.529.
So, diff is greater than 0 at 95% significance level.

We number of seedoctors' consultations has been inceased from 2007 to 2012.

That's it. Thank you!

Next post is...

 

www.crosshyou.info

 

To read the first post

 

www.crosshyou.info