www.crosshyou.info

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

OECD Gender wage gap data analysis 4 - Time Series Data Regression with lag and trend using R

f:id:cross_hyou:20210904113749j:plain

Photo by Masako Ishida on Unsplash 

www.crosshyou.info

This post is following of the above post.

Which chountry has many observations?

f:id:cross_hyou:20210904114316p:plain

NZL has 22 observations.

AUT, BEL, DNK, FIN, NOR and SWE have 16 observations.

Let's see NZL data.

f:id:cross_hyou:20210904115322p:plain

f:id:cross_hyou:20210904115045p:plain

We see emplyment gender wage gap is less than selfemploy gender wage gap.

Let's see scatter plot.

f:id:cross_hyou:20210904115659p:plain

f:id:cross_hyou:20210904115708p:plain

There seems positive correlation.

Let's check it.

f:id:cross_hyou:20210904115913p:plain

p-value is 0.02796 and correlation is 0.4682.

I make NZL only time series data object.

f:id:cross_hyou:20210904120428p:plain

Then, let's see linear regression of static model.

f:id:cross_hyou:20210904120839p:plain

p-value is 0.02796. So this model is statistically significant under 5% confidence level.

Then, let's see linear regression of model with lag.

Firstly, load dynlm package.

f:id:cross_hyou:20210904121223p:plain

Then, I ise dynlm() function.

f:id:cross_hyou:20210904121508p:plain

Then, let's test H0: all 'emp' coefficients are = 0.

f:id:cross_hyou:20210904122034p:plain

p-value is 0.8696, so we faile to reject H0.

Next, let's add trend factor.

f:id:cross_hyou:20210904122640p:plain

After adding trend factor to static model, emp is still significant.

Let's make a result table with stargazer package.

f:id:cross_hyou:20210904123055p:plain

That's it. Thank you!

Next post is

 

www.crosshyou.info

 


To see the 1st post..

 

www.crosshyou.info