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

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

OECD Business confidence Index(BCI) data analysis 6 - There is no monthly/quarterly seasonality for BCI.

f:id:cross_hyou:20211030163608j:plain

Photo by Juliane Liebermann on Unsplash 

www.crosshyou.info

This post is following of above post.

Now, let's see df dataframe object again.

f:id:cross_hyou:20211030170405p:plain

df have "time" variable as Date class. I will make year and month from time.
I need lubridate package.

f:id:cross_hyou:20211030170617p:plain

Then, I use year() function and month(function).

f:id:cross_hyou:20211030170748p:plain

Let's calculate bci summary statistics by year.

f:id:cross_hyou:20211030171516p:plain

Let's plot those data.

f:id:cross_hyou:20211030172345p:plain

f:id:cross_hyou:20211030172417p:plain

Let's calculate summary statistics by month.

f:id:cross_hyou:20211030172829p:plain

I would like to mode decimal places for mean and median.

f:id:cross_hyou:20211030173129p:plain

For mean, June, July, August and September are above 100.

Let's do ANOVA analysis to check if there is significant differnece by month.

f:id:cross_hyou:20211030173653p:plain

p-value is 0.9875. So we cannot reject null hypothese. null is "there is significant differnece by month.".

How about quarter?

January, February and March is the 1st Quarter,

April, May and June is the 2nd Quarter,

July, August and  September is the 3rd Quarter,

October, November and December is 4th Quarter.

I use case_when() function to make quarter variable.

f:id:cross_hyou:20211030174855p:plain

Let's do ANOVA by quarter.

f:id:cross_hyou:20211030175234p:plain

p-value is 0.4112. So there is no quarterly seasonality for BCI.

That's all. Thank you!

Next post is

 

www.crosshyou.info

 


To read from the 1st post,

www.crosshyou.info