1. 기본형

reg1 <- lm(SEXATT3_n ~ SEX_n + AGE_n + YEAR_n2
           + MARITAL_n + party_n1 + party_n2
           + PARTYLR_n + EDUC_n + RELIG_n 
           ,data = KG5)

summary(reg1)
## 
## Call:
## lm(formula = SEXATT3_n ~ SEX_n + AGE_n + YEAR_n2 + MARITAL_n + 
##     party_n1 + party_n2 + PARTYLR_n + EDUC_n + RELIG_n, data = KG5)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.4621 -0.5598  0.2859  0.7000  1.8625 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      2.602501   0.108679  23.947  < 2e-16 ***
## SEX_nFemale                     -0.256927   0.034455  -7.457 1.10e-13 ***
## AGE_n                            0.011964   0.001524   7.850 5.43e-15 ***
## YEAR_n2                         -0.234225   0.022416 -10.449  < 2e-16 ***
## MARITAL_n기혼                    0.220848   0.049624   4.450 8.83e-06 ***
## MARITAL_n사별, 이혼, 별거, 동거  0.137548   0.073404   1.874 0.061031 .  
## party_n1                         0.184762   0.040539   4.558 5.34e-06 ***
## party_n2                         0.048796   0.042468   1.149 0.250631    
## PARTYLR_n                        0.079817   0.017406   4.586 4.68e-06 ***
## EDUC_n                          -0.046585   0.013648  -3.413 0.000649 ***
## RELIG_n불교                      0.156038   0.043628   3.577 0.000353 ***
## RELIG_n개신교                    0.380645   0.042706   8.913  < 2e-16 ***
## RELIG_n천주교                    0.159804   0.058846   2.716 0.006646 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9801 on 3621 degrees of freedom
##   (199 observations deleted due to missingness)
## Multiple R-squared:  0.1738, Adjusted R-squared:  0.171 
## F-statistic: 63.47 on 12 and 3621 DF,  p-value: < 2.2e-16

2. 기본형 x 년도

reg2 <- lm(SEXATT3_n ~ SEX_n + AGE_n
           + MARITAL_n + party_n1 + party_n2 
           + PARTYLR_n + EDUC_n + RELIG_n*YEAR_n2
           ,data = KG5)

summary(reg2)
## 
## Call:
## lm(formula = SEXATT3_n ~ SEX_n + AGE_n + MARITAL_n + party_n1 + 
##     party_n2 + PARTYLR_n + EDUC_n + RELIG_n * YEAR_n2, data = KG5)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.4006 -0.5594  0.2918  0.6933  1.9244 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      2.671178   0.111607  23.934  < 2e-16 ***
## SEX_nFemale                     -0.257346   0.034449  -7.470 9.97e-14 ***
## AGE_n                            0.011778   0.001524   7.727 1.42e-14 ***
## MARITAL_n기혼                    0.216351   0.049613   4.361 1.33e-05 ***
## MARITAL_n사별, 이혼, 별거, 동거  0.133857   0.073356   1.825 0.068119 .  
## party_n1                         0.188875   0.040530   4.660 3.27e-06 ***
## party_n2                         0.052812   0.042458   1.244 0.213638    
## PARTYLR_n                        0.079718   0.017400   4.581 4.77e-06 ***
## EDUC_n                          -0.047602   0.013648  -3.488 0.000493 ***
## RELIG_n불교                      0.053472   0.063079   0.848 0.396660    
## RELIG_n개신교                    0.267584   0.060795   4.401 1.11e-05 ***
## RELIG_n천주교                    0.136187   0.088794   1.534 0.125179    
## YEAR_n2                         -0.294943   0.032107  -9.186  < 2e-16 ***
## RELIG_n불교:YEAR_n2              0.117032   0.052664   2.222 0.026330 *  
## RELIG_n개신교:YEAR_n2            0.135211   0.052497   2.576 0.010047 *  
## RELIG_n천주교:YEAR_n2            0.027287   0.071618   0.381 0.703220    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9793 on 3618 degrees of freedom
##   (199 observations deleted due to missingness)
## Multiple R-squared:  0.1758, Adjusted R-squared:  0.1724 
## F-statistic: 51.45 on 15 and 3618 DF,  p-value: < 2.2e-16
model1 <- ggpredict(reg2, terms = c("YEAR_n2", "RELIG_n" ))
ggplot(model1) +
    aes(x = as.numeric(x), y = predicted, colour = group) +
    geom_smooth(method = lm, se = F) +
    scale_color_brewer(palette = "Set1") +
    scale_x_continuous(breaks = c(0, 1, 2), labels=c("2008년", "2013년", "2018년")) +
    theme_bw()+ 
    labs(title = ""
         , subtitle = ""
         , x = ""
         , y = ""
         , col = "")
## `geom_smooth()` using formula 'y ~ x'

3. 개신교 기본형

reg4 <- lm(SEXATT3_n ~ SEX_n + AGE_n 
           + MARITAL_n + party_n1 + party_n2 
           + PARTYLR_n + EDUC_n + YEAR_n2
           + RELITEN_n1 #종교성
           + KRPROUD_n1 #한국인자긍심
           + NORTHWHO_n2 #북한인식
           ,data = KG5
           ,subset = KG5$RELIG_n == "개신교")

summary(reg4)
## 
## Call:
## lm(formula = SEXATT3_n ~ SEX_n + AGE_n + MARITAL_n + party_n1 + 
##     party_n2 + PARTYLR_n + EDUC_n + YEAR_n2 + RELITEN_n1 + KRPROUD_n1 + 
##     NORTHWHO_n2, data = KG5, subset = KG5$RELIG_n == "개신교")
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.0054 -0.2013  0.2985  0.5368  1.2895 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      3.047160   0.207147  14.710  < 2e-16 ***
## SEX_nFemale                     -0.036512   0.065726  -0.556 0.578701    
## AGE_n                            0.006258   0.002832   2.210 0.027394 *  
## MARITAL_n기혼                    0.230954   0.098858   2.336 0.019725 *  
## MARITAL_n사별, 이혼, 별거, 동거  0.112338   0.141416   0.794 0.427206    
## party_n1                         0.066562   0.077202   0.862 0.388841    
## party_n2                        -0.084647   0.079750  -1.061 0.288824    
## PARTYLR_n                        0.060106   0.032877   1.828 0.067886 .  
## EDUC_n                          -0.023432   0.024988  -0.938 0.348661    
## YEAR_n2                         -0.150405   0.042884  -3.507 0.000478 ***
## RELITEN_n1                       0.150553   0.040118   3.753 0.000187 ***
## KRPROUD_n1                       0.040610   0.050056   0.811 0.417435    
## NORTHWHO_n2경계,적대             0.072190   0.063344   1.140 0.254772    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.873 on 804 degrees of freedom
##   (109 observations deleted due to missingness)
## Multiple R-squared:  0.1043, Adjusted R-squared:  0.09096 
## F-statistic: 7.804 on 12 and 804 DF,  p-value: 7.277e-14

4. 개신교: 년도x종교성

reg5 <- lm(SEXATT3_n ~ SEX_n + AGE_n
           + MARITAL_n + party_n1 + party_n2 
           + PARTYLR_n + EDUC_n 
           + RELITEN_n1 *YEAR_n2
           + KRPROUD_n1 #한국인자긍심
           + NORTHWHO_n2 #북한인식
           ,data = KG5
           ,subset = KG5$RELIG_n == "개신교")

summary(reg5)
## 
## Call:
## lm(formula = SEXATT3_n ~ SEX_n + AGE_n + MARITAL_n + party_n1 + 
##     party_n2 + PARTYLR_n + EDUC_n + RELITEN_n1 * YEAR_n2 + KRPROUD_n1 + 
##     NORTHWHO_n2, data = KG5, subset = KG5$RELIG_n == "개신교")
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.0233 -0.1808  0.2720  0.5374  1.3988 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      3.035593   0.206842  14.676  < 2e-16 ***
## SEX_nFemale                     -0.034545   0.065611  -0.527 0.598676    
## AGE_n                            0.006378   0.002827   2.256 0.024349 *  
## MARITAL_n기혼                    0.232969   0.098679   2.361 0.018470 *  
## MARITAL_n사별, 이혼, 별거, 동거  0.112495   0.141153   0.797 0.425702    
## party_n1                         0.069370   0.077071   0.900 0.368345    
## party_n2                        -0.075914   0.079722  -0.952 0.341265    
## PARTYLR_n                        0.059666   0.032816   1.818 0.069408 .  
## EDUC_n                          -0.019710   0.025011  -0.788 0.430886    
## RELITEN_n1                       0.076407   0.054570   1.400 0.161851    
## YEAR_n2                         -0.166682   0.043571  -3.826 0.000141 ***
## KRPROUD_n1                       0.037211   0.049992   0.744 0.456888    
## NORTHWHO_n2경계,적대             0.069598   0.063239   1.101 0.271422    
## RELITEN_n1:YEAR_n2               0.097960   0.048980   2.000 0.045835 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8714 on 803 degrees of freedom
##   (109 observations deleted due to missingness)
## Multiple R-squared:  0.1088, Adjusted R-squared:  0.09434 
## F-statistic: 7.538 on 13 and 803 DF,  p-value: 3.573e-14
model3 <- ggpredict(reg5, terms = c( "YEAR_n2", "RELITEN_n1"))
ggplot(model3) +
    aes(x = as.numeric(x), y = predicted, colour = factor(group, labels = c("강하지 않다","다소 강하다","강하다"))) +
    geom_smooth(method = lm, se = F) +
    scale_color_brewer(palette = "Set1") +
    theme_bw()+     
    scale_x_continuous(breaks = c(0, 1, 2)
                                       , labels=c("2008", "2013", "2018"))+
    labs(title = ""
         , subtitle = ""
         , x = ""
         , y = ""
         , col = "")
## `geom_smooth()` using formula 'y ~ x'

5. 개신교: 년도x한국인 자긍심

reg6 <- lm(SEXATT3_n ~ SEX_n + AGE_n
           + MARITAL_n + party_n1 + party_n2 
           + PARTYLR_n + EDUC_n 
           + RELITEN_n1 #종교성
           + KRPROUD_n1 *YEAR_n2 #한국인자긍심
           + NORTHWHO_n2 #북한인식
           ,data = KG5
           ,subset = KG5$RELIG_n == "개신교")

summary(reg6)
## 
## Call:
## lm(formula = SEXATT3_n ~ SEX_n + AGE_n + MARITAL_n + party_n1 + 
##     party_n2 + PARTYLR_n + EDUC_n + RELITEN_n1 + KRPROUD_n1 * 
##     YEAR_n2 + NORTHWHO_n2, data = KG5, subset = KG5$RELIG_n == 
##     "개신교")
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.9682 -0.1464  0.2730  0.5228  1.3442 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      3.076627   0.205529  14.969  < 2e-16 ***
## SEX_nFemale                     -0.036958   0.065168  -0.567 0.570797    
## AGE_n                            0.005852   0.002810   2.083 0.037589 *  
## MARITAL_n기혼                    0.239786   0.098045   2.446 0.014672 *  
## MARITAL_n사별, 이혼, 별거, 동거  0.124074   0.140247   0.885 0.376594    
## party_n1                         0.075344   0.076580   0.984 0.325481    
## party_n2                        -0.087733   0.079077  -1.109 0.267560    
## PARTYLR_n                        0.054863   0.032626   1.682 0.093040 .  
## EDUC_n                          -0.021955   0.024779  -0.886 0.375861    
## RELITEN_n1                       0.140487   0.039863   3.524 0.000449 ***
## KRPROUD_n1                      -0.116297   0.064206  -1.811 0.070467 .  
## YEAR_n2                         -0.165152   0.042691  -3.869 0.000118 ***
## NORTHWHO_n2경계,적대             0.045281   0.063193   0.717 0.473860    
## KRPROUD_n1:YEAR_n2               0.226823   0.058883   3.852 0.000126 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8656 on 803 degrees of freedom
##   (109 observations deleted due to missingness)
## Multiple R-squared:  0.1206, Adjusted R-squared:  0.1063 
## F-statistic: 8.469 on 13 and 803 DF,  p-value: 2.933e-16
model4 <- ggpredict(reg6, terms = c("YEAR_n2","KRPROUD_n1"))
model4 %>% 
    filter(group %in% c("-2.15323645970938", "0.846763540290621")) %>%
    ggplot(aes(x = as.numeric(x), y = predicted, col = factor(group, labels = c("낮음","높음")))) +
    geom_smooth(method = lm, se = F) +
    scale_color_brewer(palette = "Set1") +
    theme_bw()+ 
    scale_x_continuous(breaks = c(0, 1, 2)
                       , labels=c("2008", "2013", "2018"))+
    labs(title = ""
         , subtitle = ""
         , x = ""
         , y = ""
         , col = "")
## `geom_smooth()` using formula 'y ~ x'

6. 개신교: 년도x북한태도

reg7 <- lm(SEXATT3_n ~ SEX_n + AGE_n
           + MARITAL_n + party_n1 + party_n2 
           + PARTYLR_n + EDUC_n 
           + RELITEN_n1 #종교성
           + KRPROUD_n1 #한국인자긍심
           + NORTHWHO_n2 *YEAR_n2 #북한인식
           ,data = KG5
           ,subset = KG5$RELIG_n == "개신교")

summary(reg7)
## 
## Call:
## lm(formula = SEXATT3_n ~ SEX_n + AGE_n + MARITAL_n + party_n1 + 
##     party_n2 + PARTYLR_n + EDUC_n + RELITEN_n1 + KRPROUD_n1 + 
##     NORTHWHO_n2 * YEAR_n2, data = KG5, subset = KG5$RELIG_n == 
##     "개신교")
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.0370 -0.1878  0.2816  0.5258  1.3534 
## 
## Coefficients:
##                                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      3.086076   0.208007  14.836  < 2e-16 ***
## SEX_nFemale                     -0.043244   0.065745  -0.658 0.510887    
## AGE_n                            0.006274   0.002828   2.218 0.026800 *  
## MARITAL_n기혼                    0.242405   0.098931   2.450 0.014489 *  
## MARITAL_n사별, 이혼, 별거, 동거  0.132256   0.141662   0.934 0.350790    
## party_n1                         0.061508   0.077148   0.797 0.425529    
## party_n2                        -0.081226   0.079665  -1.020 0.308225    
## PARTYLR_n                        0.062445   0.032858   1.900 0.057732 .  
## EDUC_n                          -0.025131   0.024972  -1.006 0.314550    
## RELITEN_n1                       0.149958   0.040065   3.743 0.000195 ***
## KRPROUD_n1                       0.025947   0.050657   0.512 0.608648    
## NORTHWHO_n2경계,적대            -0.039328   0.088849  -0.443 0.658149    
## YEAR_n2                         -0.204814   0.052542  -3.898 0.000105 ***
## NORTHWHO_n2경계,적대:YEAR_n2     0.144932   0.081086   1.787 0.074252 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8718 on 803 degrees of freedom
##   (109 observations deleted due to missingness)
## Multiple R-squared:  0.1079, Adjusted R-squared:  0.09343 
## F-statistic: 7.469 on 13 and 803 DF,  p-value: 5.105e-14
model5 <- ggpredict(reg7, terms = c( "YEAR_n2","NORTHWHO_n2" ))
ggplot(model5) +
    aes(x = as.numeric(x), y = predicted, colour = factor(group, labels = c("지원,협력","경계,적대"))) +
    geom_smooth(method = lm, se = F) +
    scale_color_brewer(palette = "Set1") +
    theme_bw()+ 
    scale_x_continuous(breaks = c(0, 1, 2)
                       , labels=c("2008", "2013", "2018"))+
    labs(title = ""
         , subtitle = ""
         , x = ""
         , y = ""
         , col = "")
## `geom_smooth()` using formula 'y ~ x'