df<-read.csv("df.csv")
df3<-df[,c(6,34:38)]
str(df3)
## 'data.frame':    115 obs. of  6 variables:
##  $ Career  : int  5 3 3 3 2 5 3 2 1 4 ...
##  $ comply_1: int  1 2 1 1 1 1 1 3 3 1 ...
##  $ comply_2: int  2 2 1 2 1 2 1 3 3 1 ...
##  $ comply_3: int  1 2 1 1 1 1 1 3 3 1 ...
##  $ comply_4: int  2 2 1 1 1 1 1 3 3 1 ...
##  $ comply_5: int  1 2 1 1 1 1 1 3 3 1 ...
df3$Career<-as.factor(df3$Career)
table(df3$Career)
## 
##  1  2  3  4  5 15 
## 19 46 27 13  9  1
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.2     v dplyr   1.0.6
## v tidyr   1.2.0     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.1
## Warning: 패키지 'ggplot2'는 R 버전 4.1.3에서 작성되었습니다
## Warning: 패키지 'tidyr'는 R 버전 4.1.3에서 작성되었습니다
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
df4<-df3 %>% filter(Career!="15")
names(df4)
## [1] "Career"   "comply_1" "comply_2" "comply_3" "comply_4" "comply_5"
ga.out2<-lm(comply_1~Career,data=df4)
anova(ga.out2)
## Analysis of Variance Table
## 
## Response: comply_1
##            Df Sum Sq Mean Sq F value  Pr(>F)  
## Career      4  4.241 1.06027  2.8364 0.02801 *
## Residuals 105 39.250 0.37381                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(multcomp)
## Warning: 패키지 'multcomp'는 R 버전 4.1.2에서 작성되었습니다
## 필요한 패키지를 로딩중입니다: mvtnorm
## 필요한 패키지를 로딩중입니다: survival
## 필요한 패키지를 로딩중입니다: TH.data
## Warning: 패키지 'TH.data'는 R 버전 4.1.2에서 작성되었습니다
## 필요한 패키지를 로딩중입니다: MASS
## 
## 다음의 패키지를 부착합니다: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
## 
## 다음의 패키지를 부착합니다: 'TH.data'
## The following object is masked from 'package:MASS':
## 
##     geyser
go.out3<-glht(ga.out2,linfct = mcp(Career="Tukey"))
summary(go.out3)
## 
##   Simultaneous Tests for General Linear Hypotheses
## 
## Multiple Comparisons of Means: Tukey Contrasts
## 
## 
## Fit: lm(formula = comply_1 ~ Career, data = df4)
## 
## Linear Hypotheses:
##            Estimate Std. Error t value Pr(>|t|)  
## 2 - 1 == 0 -0.42935    0.17745  -2.420   0.1133  
## 3 - 1 == 0 -0.58654    0.19427  -3.019   0.0246 *
## 4 - 1 == 0 -0.50962    0.22829  -2.232   0.1694  
## 5 - 1 == 0 -0.68056    0.25475  -2.671   0.0622 .
## 3 - 2 == 0 -0.15719    0.15001  -1.048   0.8262  
## 4 - 2 == 0 -0.08027    0.19204  -0.418   0.9932  
## 5 - 2 == 0 -0.25121    0.22285  -1.127   0.7846  
## 4 - 3 == 0  0.07692    0.20768   0.370   0.9957  
## 5 - 3 == 0 -0.09402    0.23646  -0.398   0.9944  
## 5 - 4 == 0 -0.17094    0.26512  -0.645   0.9657  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)
ga.out3<-lm(comply_2~Career,data=df4)
anova(ga.out3)
## Analysis of Variance Table
## 
## Response: comply_2
##            Df Sum Sq Mean Sq F value  Pr(>F)  
## Career      4  3.583 0.89581  2.2537 0.06821 .
## Residuals 105 41.735 0.39748                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(multcomp)

ga.out4<-lm(comply_3~Career,data=df4)
anova(ga.out4)
## Analysis of Variance Table
## 
## Response: comply_3
##            Df Sum Sq Mean Sq F value  Pr(>F)  
## Career      4  4.697 1.17426   2.717 0.03376 *
## Residuals 103 44.516 0.43219                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ga.out5<-lm(comply_4~Career,data=df4)
anova(ga.out5)
## Analysis of Variance Table
## 
## Response: comply_4
##            Df Sum Sq Mean Sq F value Pr(>F)
## Career      4  3.251 0.81274  1.8448  0.126
## Residuals 102 44.936 0.44055
ga.out6<-lm(comply_5~Career,data=df4)
anova(ga.out6)
## Analysis of Variance Table
## 
## Response: comply_5
##            Df Sum Sq Mean Sq F value Pr(>F)
## Career      4   8.28  2.0712  0.5257 0.7171
## Residuals 103 405.82  3.9400