library(foreign)
data=read.dta('C:/Users/NCC/Dropbox/PhD/Data/Tu/Academic stress/data0.dta', convert.factors = TRUE, missing.type = FALSE, warn.missing.labels = TRUE)
Academic stress
##view data
names(data)
## [1] "lop" "msp" "a1" "a2" "a3"
## [6] "a3x4" "a4" "a5" "a5x5" "a6"
## [11] "a6x5" "a7" "a14" "a151" "a152"
## [16] "a153" "a154" "a155" "a16" "a20"
## [21] "a21" "a21x4" "a22" "a23x1" "a23x2"
## [26] "dl1" "dl2" "dl3" "dl4" "dl5"
## [31] "mt1" "mt2" "mt3" "mt4" "mt5"
## [36] "mt6" "mt7" "mt8" "dk1" "dk2"
## [41] "dk3" "dk4" "dk5" "dk6" "dk7"
## [46] "clgv1" "clgv2" "clgv3" "clgv4" "clgv5"
## [51] "clgv6" "clgv7" "clgv8" "clgv9" "ctdt1"
## [56] "ctdt2" "ctdt3" "ctdt4" "ctdt5" "ctdt6"
## [61] "ctdt7" "clql1" "clql2" "clql3" "clql4"
## [66] "clql5" "clql6" "ctsv1" "ctsv2" "ctsv3"
## [71] "ctsv4" "ctsv5" "hdpt1" "hdpt2" "hdpt3"
## [76] "hdpt4" "hdpt5" "hdpt6" "c1" "c2"
## [81] "c3" "c4" "c5" "c6" "c7"
## [86] "c8" "c9" "c10" "c11" "c12"
## [91] "c13" "c14" "c15" "c16" "year"
## [96] "essa" "dlht" "mtht" "dkht" "clgv"
## [101] "ctdt" "ctql" "ctsv" "hdpt" "presu"
## [106] "worry" "despondency" "seflexpect" "workload"
data$year=as.factor(data$year)
data$a2=as.factor(data$a2)
data$a3=as.factor(data$a3)
data$a4=as.factor(data$a4)
data$a5=as.factor(data$a5)
data$a6=as.factor(data$a6)
data$a7=as.factor(data$a7)
data$a151=as.factor(data$a151)
data$a153=as.factor(data$a153)
data$a155=as.factor(data$a155)
data$a16=as.factor(data$a16)
data$a20=as.factor(data$a20)
data$a21=as.factor(data$a21)
data$a23x1=as.factor(data$a23x1)
data$a23x2=as.factor(data$a23x2)
#dinh nghia cho nhom 16 thang do
data$c1=as.factor(data$c1)
data$c2=as.factor(data$c2)
data$c3=as.factor(data$c3)
data$c4=as.factor(data$c4)
data$c5=as.factor(data$c5)
data$c6=as.factor(data$c6)
data$c7=as.factor(data$c7)
data$c8=as.factor(data$c8)
data$c9=as.factor(data$c9)
data$c10=as.factor(data$c10)
data$c11=as.factor(data$c11)
data$c12=as.factor(data$c12)
data$c13=as.factor(data$c13)
data$c14=as.factor(data$c14)
data$c15=as.factor(data$c15)
data$c16=as.factor(data$c16)
##load packages of table
Tai 2 packages “table1” va “compareGroup” tu chuc nang cua Rstudio hoac R
#install.packages(table1)
#install.packages(compareGroups)
library(table1)
##
## Attaching package: 'table1'
## The following objects are masked from 'package:base':
##
## units, units<-
library(compareGroups)
## Loading required package: SNPassoc
## Loading required package: haplo.stats
## Loading required package: survival
## Loading required package: mvtnorm
## Loading required package: parallel
## Registered S3 method overwritten by 'SNPassoc':
## method from
## summary.haplo.glm haplo.stats
table1(year~a1+a2+a2+a3+a4+a5+a6+a7+a151+a152+a153+a154+a155+a16+a20+a21+a22+a23x1 + a23x2, data=data)
| Overall (N=878) |
|
|---|---|
| year | |
| 1 | 233 (26.5%) |
| 2 | 297 (33.8%) |
| 3 | 348 (39.6%) |
| a1 | |
| Mean (SD) | 21.3 (1.93) |
| Median [Min, Max] | 21.0 [18.0, 28.0] |
| a2 | |
| 1 | 376 (42.8%) |
| 2 | 502 (57.2%) |
| a3 | |
| 1 | 769 (87.6%) |
| 2 | 63 (7.2%) |
| 3 | 44 (5.0%) |
| 4 | 2 (0.2%) |
| a4 | |
| 1 | 254 (28.9%) |
| 2 | 1 (0.1%) |
| 3 | 297 (33.8%) |
| 5 | 326 (37.1%) |
| a5 | |
| 1 | 97 (11.0%) |
| 2 | 568 (64.7%) |
| 3 | 194 (22.1%) |
| 4 | 13 (1.5%) |
| 5 | 6 (0.7%) |
| a6 | |
| 1 | 84 (9.6%) |
| 2 | 306 (34.9%) |
| 3 | 334 (38.0%) |
| 4 | 151 (17.2%) |
| 5 | 3 (0.3%) |
| a7 | |
| 1 | 48 (5.5%) |
| 2 | 271 (30.9%) |
| 3 | 427 (48.6%) |
| 4 | 108 (12.3%) |
| 5 | 22 (2.5%) |
| 6 | 2 (0.2%) |
| a151 | |
| 1 | 21 (2.4%) |
| 2 | 857 (97.6%) |
| a152 | |
| Mean (SD) | 9.65 (9.82) |
| Median [Min, Max] | 5.00 [1.00, 40.0] |
| Missing | 858 (97.7%) |
| a153 | |
| 1 | 193 (22.0%) |
| 2 | 685 (78.0%) |
| a154 | |
| Mean (SD) | 1.10 (1.07) |
| Median [Min, Max] | 1.00 [0.0500, 7.00] |
| Missing | 689 (78.5%) |
| a155 | |
| 0.5 | 2 (0.2%) |
| 1 | 61 (6.9%) |
| 1.5 | 1 (0.1%) |
| 2 | 39 (4.4%) |
| 3 | 32 (3.6%) |
| 4 | 15 (1.7%) |
| 5 | 26 (3.0%) |
| 6 | 2 (0.2%) |
| 7 | 4 (0.5%) |
| 8 | 1 (0.1%) |
| 10 | 1 (0.1%) |
| 12 | 4 (0.5%) |
| 33 | 1 (0.1%) |
| Missing | 689 (78.5%) |
| a16 | |
| 1 | 62 (7.1%) |
| 2 | 220 (25.1%) |
| 3 | 246 (28.0%) |
| 4 | 196 (22.3%) |
| 5 | 154 (17.5%) |
| a20 | |
| 1 | 688 (78.4%) |
| 2 | 190 (21.6%) |
| a21 | |
| 1 | 117 (13.3%) |
| 2 | 274 (31.2%) |
| 3 | 435 (49.5%) |
| 4 | 52 (5.9%) |
| a22 | |
| Mean (SD) | 3.28 (0.662) |
| Median [Min, Max] | 3.00 [1.00, 5.00] |
| a23x1 | |
| 1 | 12 (1.4%) |
| 2 | 49 (5.6%) |
| 3 | 391 (44.5%) |
| 4 | 390 (44.4%) |
| 5 | 36 (4.1%) |
| a23x2 | |
| 1 | 8 (0.9%) |
| 2 | 115 (13.1%) |
| 3 | 420 (47.8%) |
| 4 | 302 (34.4%) |
| 5 | 33 (3.8%) |
t1=compareGroups(year~a2+a2+a3+a4+a5+a6+a7+a151+a152+a153+a154+a155+a16+a21+a22+a23x1 + a23x2, data=data)
## Warning in compareGroups.fit(X = X, y = y, include.label = include.label, :
## Variables 'a155' have been removed since some errors occurred
t1
##
##
## -------- Summary of results by groups of 'year'---------
##
##
## var N p.value method selection
## 1 a2 878 0.246 categorical ALL
## 2 a2 878 0.246 categorical ALL
## 3 a3 878 0.009** categorical ALL
## 4 a4 878 . categorical ALL
## 5 a5 878 . categorical ALL
## 6 a6 878 . categorical ALL
## 7 a7 878 . categorical ALL
## 8 a151 878 0.211 categorical ALL
## 9 a152 20 0.187 continuous normal ALL
## 10 a153 878 0.051* categorical ALL
## 11 a154 189 0.076* continuous normal ALL
## 12 a16 878 <0.001** categorical ALL
## 13 a21 878 0.162 categorical ALL
## 14 a22 878 0.119 continuous normal ALL
## 15 a23x1 878 . categorical ALL
## 16 a23x2 878 . categorical ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t1)
##
## --------Summary descriptives table by 'year'---------
##
## ____________________________________________________
## 1 2 3 p.overall
## N=233 N=297 N=348
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## a2: 0.246
## 1 110 (47.2%) 119 (40.1%) 147 (42.2%)
## 2 123 (52.8%) 178 (59.9%) 201 (57.8%)
## a2: 0.246
## 1 110 (47.2%) 119 (40.1%) 147 (42.2%)
## 2 123 (52.8%) 178 (59.9%) 201 (57.8%)
## a3: 0.009
## 1 195 (83.7%) 265 (89.2%) 309 (88.8%)
## 2 28 (12.0%) 12 (4.04%) 23 (6.61%)
## 3 9 (3.86%) 19 (6.40%) 16 (4.60%)
## 4 1 (0.43%) 1 (0.34%) 0 (0.00%)
## a4: .
## 1 179 (76.8%) 0 (0.00%) 75 (21.6%)
## 2 1 (0.43%) 0 (0.00%) 0 (0.00%)
## 3 0 (0.00%) 297 (100%) 0 (0.00%)
## 5 53 (22.7%) 0 (0.00%) 273 (78.4%)
## a5: .
## 1 28 (12.0%) 31 (10.4%) 38 (10.9%)
## 2 132 (56.7%) 202 (68.0%) 234 (67.2%)
## 3 65 (27.9%) 60 (20.2%) 69 (19.8%)
## 4 8 (3.43%) 3 (1.01%) 2 (0.57%)
## 5 0 (0.00%) 1 (0.34%) 5 (1.44%)
## a6: .
## 1 23 (9.87%) 22 (7.41%) 39 (11.2%)
## 2 87 (37.3%) 102 (34.3%) 117 (33.6%)
## 3 85 (36.5%) 131 (44.1%) 118 (33.9%)
## 4 38 (16.3%) 42 (14.1%) 71 (20.4%)
## 5 0 (0.00%) 0 (0.00%) 3 (0.86%)
## a7: .
## 1 11 (4.72%) 25 (8.42%) 12 (3.45%)
## 2 63 (27.0%) 127 (42.8%) 81 (23.3%)
## 3 117 (50.2%) 120 (40.4%) 190 (54.6%)
## 4 34 (14.6%) 21 (7.07%) 53 (15.2%)
## 5 8 (3.43%) 4 (1.35%) 10 (2.87%)
## 6 0 (0.00%) 0 (0.00%) 2 (0.57%)
## a151: 0.211
## 1 5 (2.15%) 4 (1.35%) 12 (3.45%)
## 2 228 (97.9%) 293 (98.7%) 336 (96.6%)
## a152 16.5 (17.7) 3.75 (2.75) 9.33 (7.04) 0.187
## a153: 0.051
## 1 38 (16.3%) 71 (23.9%) 84 (24.1%)
## 2 195 (83.7%) 226 (76.1%) 264 (75.9%)
## a154 0.97 (0.32) 0.94 (0.43) 1.30 (1.54) 0.076
## a16: <0.001
## 1 12 (5.15%) 31 (10.4%) 19 (5.46%)
## 2 42 (18.0%) 87 (29.3%) 91 (26.1%)
## 3 78 (33.5%) 88 (29.6%) 80 (23.0%)
## 4 57 (24.5%) 59 (19.9%) 80 (23.0%)
## 5 44 (18.9%) 32 (10.8%) 78 (22.4%)
## a21: 0.162
## 1 35 (15.0%) 40 (13.5%) 42 (12.1%)
## 2 62 (26.6%) 103 (34.7%) 109 (31.3%)
## 3 127 (54.5%) 132 (44.4%) 176 (50.6%)
## 4 9 (3.86%) 22 (7.41%) 21 (6.03%)
## a22 3.35 (0.68) 3.23 (0.68) 3.28 (0.63) 0.119
## a23x1: .
## 1 2 (0.86%) 3 (1.01%) 7 (2.01%)
## 2 16 (6.87%) 18 (6.06%) 15 (4.31%)
## 3 104 (44.6%) 153 (51.5%) 134 (38.5%)
## 4 104 (44.6%) 109 (36.7%) 177 (50.9%)
## 5 7 (3.00%) 14 (4.71%) 15 (4.31%)
## a23x2: .
## 1 4 (1.72%) 2 (0.67%) 2 (0.57%)
## 2 30 (12.9%) 51 (17.2%) 34 (9.77%)
## 3 101 (43.3%) 160 (53.9%) 159 (45.7%)
## 4 90 (38.6%) 74 (24.9%) 138 (39.7%)
## 5 8 (3.43%) 10 (3.37%) 15 (4.31%)
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t2=compareGroups(year~c1+c2+c3+c4+c5+c6+c7+c8+c9+c10+c11+c12+c13+c14+c15+c16+essa+presu + worry + despondency + seflexpect + workload+a23x1 + a23x2, data=data)
t2
##
##
## -------- Summary of results by groups of 'year'---------
##
##
## var N p.value method selection
## 1 c1 878 0.178 categorical ALL
## 2 c2 878 . categorical ALL
## 3 c3 878 <0.001** categorical ALL
## 4 c4 878 . categorical ALL
## 5 c5 878 0.378 categorical ALL
## 6 c6 878 . categorical ALL
## 7 c7 878 . categorical ALL
## 8 c8 878 0.002** categorical ALL
## 9 c9 878 0.004** categorical ALL
## 10 c10 878 0.391 categorical ALL
## 11 c11 878 0.004** categorical ALL
## 12 c12 878 0.692 categorical ALL
## 13 c13 878 0.449 categorical ALL
## 14 c14 878 0.041** categorical ALL
## 15 c15 878 . categorical ALL
## 16 c16 878 <0.001** categorical ALL
## 17 essa 878 0.001** continuous normal ALL
## 18 presu 878 <0.001** continuous normal ALL
## 19 worry 878 0.041** continuous normal ALL
## 20 despondency 878 0.109 continuous normal ALL
## 21 seflexpect 878 0.161 continuous normal ALL
## 22 workload 878 <0.001** continuous normal ALL
## 23 a23x1 878 . categorical ALL
## 24 a23x2 878 . categorical ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t2)
##
## --------Summary descriptives table by 'year'---------
##
## _________________________________________________________
## 1 2 3 p.overall
## N=233 N=297 N=348
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## c1: 0.178
## 1 5 (2.15%) 10 (3.37%) 17 (4.89%)
## 2 36 (15.5%) 43 (14.5%) 70 (20.1%)
## 3 106 (45.5%) 152 (51.2%) 153 (44.0%)
## 4 70 (30.0%) 69 (23.2%) 82 (23.6%)
## 5 16 (6.87%) 23 (7.74%) 26 (7.47%)
## c2: .
## 1 0 (0.00%) 5 (1.68%) 7 (2.01%)
## 2 24 (10.3%) 17 (5.72%) 38 (10.9%)
## 3 115 (49.4%) 112 (37.7%) 162 (46.6%)
## 4 85 (36.5%) 127 (42.8%) 111 (31.9%)
## 5 9 (3.86%) 36 (12.1%) 30 (8.62%)
## c3: <0.001
## 1 0 (0.00%) 7 (2.36%) 14 (4.02%)
## 2 31 (13.3%) 24 (8.08%) 70 (20.1%)
## 3 141 (60.5%) 168 (56.6%) 187 (53.7%)
## 4 50 (21.5%) 75 (25.3%) 58 (16.7%)
## 5 11 (4.72%) 23 (7.74%) 19 (5.46%)
## c4: .
## 1 0 (0.00%) 3 (1.01%) 3 (0.86%)
## 2 17 (7.30%) 18 (6.06%) 32 (9.20%)
## 3 93 (39.9%) 76 (25.6%) 117 (33.6%)
## 4 106 (45.5%) 136 (45.8%) 142 (40.8%)
## 5 17 (7.30%) 64 (21.5%) 54 (15.5%)
## c5: 0.378
## 1 14 (6.01%) 27 (9.09%) 36 (10.3%)
## 2 46 (19.7%) 75 (25.3%) 83 (23.9%)
## 3 127 (54.5%) 133 (44.8%) 168 (48.3%)
## 4 40 (17.2%) 52 (17.5%) 52 (14.9%)
## 5 6 (2.58%) 10 (3.37%) 9 (2.59%)
## c6: .
## 1 3 (1.29%) 5 (1.68%) 10 (2.87%)
## 2 17 (7.30%) 22 (7.41%) 54 (15.5%)
## 3 122 (52.4%) 117 (39.4%) 156 (44.8%)
## 4 83 (35.6%) 112 (37.7%) 104 (29.9%)
## 5 8 (3.43%) 41 (13.8%) 24 (6.90%)
## c7: .
## 1 1 (0.43%) 4 (1.35%) 7 (2.01%)
## 2 16 (6.87%) 20 (6.73%) 42 (12.1%)
## 3 122 (52.4%) 142 (47.8%) 163 (46.8%)
## 4 82 (35.2%) 101 (34.0%) 114 (32.8%)
## 5 12 (5.15%) 30 (10.1%) 22 (6.32%)
## c8: 0.002
## 1 0 (0.00%) 9 (3.03%) 13 (3.74%)
## 2 27 (11.6%) 29 (9.76%) 43 (12.4%)
## 3 78 (33.5%) 115 (38.7%) 148 (42.5%)
## 4 107 (45.9%) 103 (34.7%) 108 (31.0%)
## 5 21 (9.01%) 41 (13.8%) 36 (10.3%)
## c9: 0.004
## 1 4 (1.72%) 18 (6.06%) 18 (5.17%)
## 2 35 (15.0%) 29 (9.76%) 64 (18.4%)
## 3 87 (37.3%) 88 (29.6%) 114 (32.8%)
## 4 89 (38.2%) 132 (44.4%) 117 (33.6%)
## 5 18 (7.73%) 30 (10.1%) 35 (10.1%)
## c10: 0.391
## 1 6 (2.58%) 18 (6.06%) 25 (7.18%)
## 2 37 (15.9%) 42 (14.1%) 62 (17.8%)
## 3 108 (46.4%) 138 (46.5%) 147 (42.2%)
## 4 70 (30.0%) 83 (27.9%) 93 (26.7%)
## 5 12 (5.15%) 16 (5.39%) 21 (6.03%)
## c11: 0.004
## 1 4 (1.72%) 12 (4.04%) 19 (5.46%)
## 2 29 (12.4%) 37 (12.5%) 60 (17.2%)
## 3 121 (51.9%) 137 (46.1%) 175 (50.3%)
## 4 74 (31.8%) 89 (30.0%) 80 (23.0%)
## 5 5 (2.15%) 22 (7.41%) 14 (4.02%)
## c12: 0.692
## 1 5 (2.15%) 11 (3.70%) 14 (4.02%)
## 2 35 (15.0%) 36 (12.1%) 52 (14.9%)
## 3 98 (42.1%) 118 (39.7%) 142 (40.8%)
## 4 78 (33.5%) 98 (33.0%) 108 (31.0%)
## 5 17 (7.30%) 34 (11.4%) 32 (9.20%)
## c13: 0.449
## 1 4 (1.72%) 7 (2.36%) 15 (4.31%)
## 2 24 (10.3%) 41 (13.8%) 52 (14.9%)
## 3 98 (42.1%) 116 (39.1%) 140 (40.2%)
## 4 87 (37.3%) 105 (35.4%) 115 (33.0%)
## 5 20 (8.58%) 28 (9.43%) 26 (7.47%)
## c14: 0.041
## 1 1 (0.43%) 12 (4.04%) 17 (4.89%)
## 2 25 (10.7%) 39 (13.1%) 42 (12.1%)
## 3 113 (48.5%) 113 (38.0%) 140 (40.2%)
## 4 73 (31.3%) 92 (31.0%) 113 (32.5%)
## 5 21 (9.01%) 41 (13.8%) 36 (10.3%)
## c15: .
## 1 0 (0.00%) 6 (2.02%) 12 (3.45%)
## 2 15 (6.44%) 27 (9.09%) 35 (10.1%)
## 3 77 (33.0%) 79 (26.6%) 106 (30.5%)
## 4 121 (51.9%) 138 (46.5%) 150 (43.1%)
## 5 20 (8.58%) 47 (15.8%) 45 (12.9%)
## c16: <0.001
## 1 4 (1.72%) 21 (7.07%) 27 (7.76%)
## 2 35 (15.0%) 57 (19.2%) 67 (19.3%)
## 3 99 (42.5%) 96 (32.3%) 134 (38.5%)
## 4 79 (33.9%) 82 (27.6%) 75 (21.6%)
## 5 16 (6.87%) 41 (13.8%) 45 (12.9%)
## essa 53.2 (7.21) 53.9 (8.33) 51.4 (9.74) 0.001
## presu 13.0 (2.03) 13.4 (2.51) 12.6 (2.64) <0.001
## worry 10.1 (1.99) 10.0 (2.30) 9.64 (2.54) 0.041
## despondency 9.94 (2.11) 9.90 (2.19) 9.59 (2.26) 0.109
## seflexpect 10.3 (1.92) 10.2 (2.44) 9.96 (2.50) 0.161
## workload 9.89 (1.68) 10.3 (1.98) 9.63 (2.10) <0.001
## a23x1: .
## 1 2 (0.86%) 3 (1.01%) 7 (2.01%)
## 2 16 (6.87%) 18 (6.06%) 15 (4.31%)
## 3 104 (44.6%) 153 (51.5%) 134 (38.5%)
## 4 104 (44.6%) 109 (36.7%) 177 (50.9%)
## 5 7 (3.00%) 14 (4.71%) 15 (4.31%)
## a23x2: .
## 1 4 (1.72%) 2 (0.67%) 2 (0.57%)
## 2 30 (12.9%) 51 (17.2%) 34 (9.77%)
## 3 101 (43.3%) 160 (53.9%) 159 (45.7%)
## 4 90 (38.6%) 74 (24.9%) 138 (39.7%)
## 5 8 (3.43%) 10 (3.37%) 15 (4.31%)
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
##table ve cac gia tri trung binh
t3=compareGroups(year~dlht+ mtht+ dkht+ clgv+ ctdt+ ctql+ ctsv+ hdpt+essa, data=data)
t3
##
##
## -------- Summary of results by groups of 'year'---------
##
##
## var N p.value method selection
## 1 dlht 878 0.885 continuous normal ALL
## 2 mtht 878 <0.001** continuous normal ALL
## 3 dkht 878 <0.001** continuous normal ALL
## 4 clgv 878 0.012** continuous normal ALL
## 5 ctdt 878 <0.001** continuous normal ALL
## 6 ctql 878 0.066* continuous normal ALL
## 7 ctsv 878 0.907 continuous normal ALL
## 8 hdpt 878 0.002** continuous normal ALL
## 9 essa 878 0.001** continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t3)
##
## --------Summary descriptives table by 'year'---------
##
## __________________________________________________
## 1 2 3 p.overall
## N=233 N=297 N=348
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## dlht 18.6 (3.14) 18.5 (3.01) 18.6 (3.09) 0.885
## mtht 25.4 (4.55) 23.7 (4.27) 24.3 (4.93) <0.001
## dkht 22.9 (3.95) 20.8 (4.30) 21.8 (4.70) <0.001
## clgv 31.0 (4.32) 31.2 (4.80) 32.1 (5.27) 0.012
## ctdt 23.4 (3.94) 21.9 (4.27) 23.0 (4.85) <0.001
## ctql 19.4 (3.22) 18.6 (3.75) 19.1 (4.26) 0.066
## ctsv 16.9 (2.55) 17.0 (3.04) 17.0 (3.31) 0.907
## hdpt 19.1 (3.52) 17.9 (3.84) 18.1 (4.26) 0.002
## essa 53.2 (7.21) 53.9 (8.33) 51.4 (9.74) 0.001
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t4=compareGroups(a23x1~essa, data=data)
t4
##
##
## -------- Summary of results by groups of 'a23x1'---------
##
##
## var N p.value method selection
## 1 essa 878 <0.001** continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t4)
##
## --------Summary descriptives table by 'a23x1'---------
##
## __________________________________________________________________________
## 1 2 3 4 5 p.overall
## N=12 N=49 N=391 N=390 N=36
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## essa 60.3 (16.0) 57.2 (9.50) 54.5 (7.46) 50.4 (8.62) 49.7 (9.75) <0.001
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t5=compareGroups(a23x2~essa, data=data)
t5
##
##
## -------- Summary of results by groups of 'a23x2'---------
##
##
## var N p.value method selection
## 1 essa 878 <0.001** continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t5)
##
## --------Summary descriptives table by 'a23x2'---------
##
## __________________________________________________________________________
## 1 2 3 4 5 p.overall
## N=8 N=115 N=420 N=302 N=33
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## essa 60.6 (10.4) 56.9 (7.92) 53.6 (8.12) 50.1 (8.55) 48.3 (10.2) <0.001
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
data("data")
## Warning in data("data"): data set 'data' not found
my_data <- data[, c('essa','dlht', 'mtht', 'dkht', 'clgv', 'ctdt', 'ctql', 'ctsv', 'hdpt' )]
# print the first 6 rows
head(my_data, 4)
## essa dlht mtht dkht clgv ctdt ctql ctsv hdpt
## 1 50 20 26 18 30 19 18 15 19
## 2 58 14 22 15 22 35 19 15 18
## 3 38 15 17 16 20 17 10 13 10
## 4 55 20 25 23 31 26 23 20 20
library("Hmisc")
## Loading required package: lattice
## Loading required package: Formula
## Loading required package: ggplot2
##
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:table1':
##
## label, label<-, units
## The following objects are masked from 'package:base':
##
## format.pval, units
res2 <- rcorr(as.matrix(my_data))
res2
## essa dlht mtht dkht clgv ctdt ctql ctsv hdpt
## essa 1.00 -0.10 -0.05 0.02 -0.02 -0.09 0.04 -0.02 0.02
## dlht -0.10 1.00 0.29 0.25 0.30 0.34 0.20 0.24 0.28
## mtht -0.05 0.29 1.00 0.58 0.48 0.53 0.48 0.44 0.44
## dkht 0.02 0.25 0.58 1.00 0.53 0.61 0.58 0.51 0.36
## clgv -0.02 0.30 0.48 0.53 1.00 0.59 0.60 0.55 0.37
## ctdt -0.09 0.34 0.53 0.61 0.59 1.00 0.58 0.49 0.40
## ctql 0.04 0.20 0.48 0.58 0.60 0.58 1.00 0.61 0.39
## ctsv -0.02 0.24 0.44 0.51 0.55 0.49 0.61 1.00 0.41
## hdpt 0.02 0.28 0.44 0.36 0.37 0.40 0.39 0.41 1.00
##
## n= 878
##
##
## P
## essa dlht mtht dkht clgv ctdt ctql ctsv hdpt
## essa 0.0028 0.1654 0.5164 0.4642 0.0082 0.2503 0.5669 0.5444
## dlht 0.0028 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## mtht 0.1654 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## dkht 0.5164 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## clgv 0.4642 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## ctdt 0.0082 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## ctql 0.2503 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## ctsv 0.5669 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## hdpt 0.5444 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
library('PerformanceAnalytics')
## Warning: package 'PerformanceAnalytics' was built under R version 4.0.2
## Loading required package: xts
## Warning: package 'xts' was built under R version 4.0.2
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
##
## legend
chart.Correlation(my_data, histogram=TRUE, pch=19)