관리자 글쓰기

 

  • 남녀 경제 활동 참가율 분석 (해외)



1. 데이터 불러오기 및 데이터 정리

par <- read.csv('women_work.csv')
str(par)
## 'data.frame':    2000 obs. of  13 variables:
##  $ c1           : num  -0.436 0.352 1.077 1.021 -0.443 ...
##  $ c2           : num  -0.0969 0.3005 -1.596 -1.7105 0.3083 ...
##  $ u            : num  -0.218 0.176 0.539 0.511 -0.221 ...
##  $ v            : num  -0.3757 0.4612 -0.3762 -0.497 -0.0925 ...
##  $ county       : int  1 2 3 4 5 6 7 8 9 0 ...
##  $ age          : int  22 36 28 37 39 33 57 45 39 25 ...
##  $ education    : int  10 10 10 10 10 10 10 16 12 10 ...
##  $ married      : int  1 1 1 1 1 1 1 1 1 0 ...
##  $ children     : int  0 0 0 0 1 2 1 0 0 3 ...
##  $ select       : num  16.8 32.4 19.2 21.3 32 ...
##  $ wagefull     : num  12.8 20.3 23.1 24.5 16.1 ...
##  $ wage         : num  NA 20.3 NA NA 16.1 ...
##  $ participation: int  0 1 0 0 1 1 1 1 0 1 ...
par$married <- factor(par$married,
                      labels = c('single',
                                 'married'))
table(par$married)
## 
##  single married 
##     659    1341



* 참가율(%) 산출

## # A tibble: 2 x 3
##   participation     n percent
##           <int> <int>   <dbl>
## 1             0   657    32.8
## 2             1  1343    67.2




2. linear probaility model (linear regression), 선형회귀모델. age, education, married, children이 한 단위 늘었을 때, 경제활동 참가를 할 ’확률’이 얼마나 증가하는가?

## 
## Call:
## lm(formula = participation ~ age + education + married + children, 
##     data = par)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.0703 -0.4142  0.1372  0.3437  0.8060 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    -0.207323   0.054111  -3.831 0.000131 ***
## age             0.010255   0.001227   8.358  < 2e-16 ***
## education       0.018601   0.003250   5.724 1.20e-08 ***
## marriedmarried  0.111112   0.021948   5.063 4.52e-07 ***
## children        0.115308   0.006772  17.028  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4199 on 1995 degrees of freedom
## Multiple R-squared:  0.2026, Adjusted R-squared:  0.201 
## F-statistic: 126.7 on 4 and 1995 DF,  p-value: < 2.2e-16


* 선형회귀분석한 값을 이용한 예측모형과 그래프 (결혼 여부에 따른 차이)


-> 예측에 사용하려 했으나 그래프의 범위가 0과 1 사이를 벗어나 예측이 불가능하다.

3. generalized linear model (apply logistic function)
* age, education, married, children이 한 단위 늘었을 때, ’single index’가 얼마나 증가하는가? 즉, 확률이 늘어나는가? 혹은 줄어드는가? 여부만 알 수 있다.

## 
## Call:
## glm(formula = participation ~ age + education + married + children, 
##     family = "binomial", data = par)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.6212  -0.9292   0.4614   0.8340   2.0455  
## 
## Coefficients:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)    -4.159247   0.332040 -12.526  < 2e-16 ***
## age             0.057930   0.007221   8.022 1.04e-15 ***
## education       0.098251   0.018652   5.268 1.38e-07 ***
## marriedmarried  0.741777   0.126471   5.865 4.49e-09 ***
## children        0.764488   0.051529  14.836  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 2532.4  on 1999  degrees of freedom
## Residual deviance: 2055.8  on 1995  degrees of freedom
## AIC: 2065.8
## 
## Number of Fisher Scoring iterations: 5


-> age, education, married, children 이 한 단위 증가할 때, 경제활동참가율이 (어느 정도인지는 모르나) 증가한다.

* glm의 그래프


-> 모든 값이 0과 1 사이에 들어와 예측모형에 활용 할 수 있다.
* 일반적으로 경제학자들은 이 그래프의 추세선의 기울기, 머신러닝 분야에서는 이 모델을 활용한 예측에 관심이 있다.