library("foreign")
library("survival")
require("moonBook")
## Loading required package: moonBook
## Warning: package 'moonBook' was built under R version 4.0.3
require("ztable")
## Loading required package: ztable
## Warning: package 'ztable' was built under R version 4.0.3
## Welcome to package ztable ver 0.2.2
require("magrittr")
## Loading required package: magrittr
options(ztable.type="html")
library(ranger)
## Warning: package 'ranger' was built under R version 4.0.3
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.0.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggfortify)
## Warning: package 'ggfortify' was built under R version 4.0.3
##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)
## Warning: package 'table1' was built under R version 4.0.3
##
## Attaching package: 'table1'
## The following objects are masked from 'package:base':
##
## units, units<-
library(compareGroups)
## Warning: package 'compareGroups' was built under R version 4.0.3
library(foreign)
data=read.dta('C:/Users/binht/Dropbox/Hue/data/Thanh/data_2R.dta', convert.factors = TRUE, missing.type = FALSE, warn.missing.labels = TRUE)
##view data
names(data)
## [1] "group" "stt" "hoten" "gioi" "tuoi"
## [6] "svv" "ngayvv" "ngayra" "ythuc" "gcs"
## [11] "tgsocuu" "tgsocuu2" "iss" "iss2" "tgct"
## [16] "nmc" "dmc" "trongnao" "xhdn" "xhnt"
## [21] "xoabeday" "dayduonggiua" "phunao" "lech" "tutha"
## [26] "vanmach" "nor" "adre" "dobu" "dopa"
## [31] "maumat1l" "maumattren1l" "m" "t" "hatt"
## [36] "hatr" "hieuap" "hatb" "dtup" "dtup2"
## [41] "dtut" "dtut2" "pxap" "pxat" "hc"
## [46] "hb" "hct" "bc" "tc" "pt"
## [51] "na" "k" "cl" "gmm" "bc0"
## [56] "mono0" "lym0" "neu0" "hc0" "hb0"
## [61] "hct0" "tc0" "na0" "k0" "cl0"
## [66] "ph0" "po20" "hco30" "pco20" "gmm0"
## [71] "gcs0" "icp0" "iss0" "bc1" "mono1"
## [76] "lym1" "neu1" "hc1" "hb1" "hct1"
## [81] "tc1" "na1" "k1" "cl1" "ph1"
## [86] "po21" "hco31" "pco21" "gmm1" "gcs1"
## [91] "icp1" "iss1" "bc2" "mono2" "lym2"
## [96] "neu2" "hc2" "hb2" "hct2" "tc2"
## [101] "na2" "k2" "cl2" "ph2" "po22"
## [106] "hco32" "pco22" "gmm2" "gcs2" "icp2"
## [111] "iss2a" "bc3" "mono3" "lym3" "neu3"
## [116] "hc3" "hb3" "hct3" "tc3" "na3"
## [121] "k3" "cl3" "ph3" "po23" "hco33"
## [126] "pco23" "gmm3" "gcs3" "icp3" "iss3"
## [131] "bc4" "mono4" "lym4" "neu4" "hc4"
## [136] "hb4" "hct4" "tc4" "na4" "k4"
## [141] "cl4" "ph4" "po24" "hco34" "pco24"
## [146] "gmm4" "gcs4" "icp4" "iss4" "bc5"
## [151] "mono5" "lym5" "neu5" "hc5" "hb5"
## [156] "hct5" "tc5" "na5" "k5" "cl5"
## [161] "ph5" "po25" "hco35" "pco25" "gmm5"
## [166] "gcs5" "icp5" "iss5" "scvo21" "scvo22"
## [171] "scvo23" "cortisol1" "cortisol2" "cortisol3" "crp1"
## [176] "crp2" "crp3" "lactate1" "lactate2" "lactate3"
## [181] "il61" "il62" "il63" "sgot1" "sgot2"
## [186] "sgot3" "sgpt1" "sgpt2" "sgpt3" "alb1"
## [191] "alb2" "alb3" "probnp1" "probnp2" "probnp3"
## [196] "hstnt1" "hstnt2" "hstnt3" "ure1" "ure2"
## [201] "ure3" "cre1" "cre2" "cre3" "bil1"
## [206] "bil2" "bil3" "bi1" "bi2" "bi3"
## [211] "mri1" "mri2" "mri3" "grv" "Ngayđtri"
## [216] "thomay" "song" "tv" "ngaydtr" "song1"
data$group=as.factor(data$group)
data$gioi=as.factor(data$gioi)
data$iss2=as.factor(data$iss2)
data$nmc=as.factor(data$nmc)
data$dmc=as.factor(data$dmc)
data$trongnao=as.factor(data$trongnao)
data$xhdn=as.factor(data$xhdn)
data$xhnt=as.factor(data$xhnt)
data$xoabeday=as.factor(data$xoabeday)
data$dayduonggiua=as.factor(data$dayduonggiua)
data$phunao=as.factor(data$phunao)
data$tutha=as.factor(data$tutha)
data$vanmach=as.factor(data$vanmach)
data$nor=as.factor(data$nor)
data$adre=as.factor(data$adre)
data$dobu=as.factor(data$dobu)
data$dopa=as.factor(data$dopa)
data$maumattren1l=as.factor(data$maumattren1l)
data$dtup2=as.factor(data$dtup2)
data$pxap=as.factor(data$pxap)
data$pxat=as.factor(data$pxat)
data$song=as.factor(data$song)
data$tv=as.factor(data$tv)
data$age_gr=cut(data$tuoi, breaks=c(0,35,55, Inf), label=c("<35", "36-55", "tren 55"))
data$age_gr=as.factor(data$age_gr)
data$icp1_code=cut(data$icp1, breaks=c(0,20,Inf), label=c("<=20", ">20"))
data$icp1_code=as.factor(data$icp1_code)
data$icp2_code=cut(data$icp2, breaks=c(0,20,Inf), label=c("<=20", ">20"))
data$icp2_code=as.factor(data$icp2_code)
data$icp3_code=cut(data$icp3, breaks=c(0,20,Inf), label=c("<=20", ">20"))
data$icp3_code=as.factor(data$icp3_code)
data$icp4_code=cut(data$icp4, breaks=c(0,20,Inf), label=c("<=20", ">20"))
data$icp4_code=as.factor(data$icp4_code)
library(table1)
library(compareGroups)
table1(group~gioi+age_gr+iss0+iss1+iss2+nmc+dmc+trongnao+xhdn+xhnt+xoabeday+dayduonggiua+phunao+tutha+vanmach+nor+adre+dobu+dopa+maumattren1l+dtup2+pxap+pxat+song+tv, data=data)
| Overall (N=60) |
|
|---|---|
| group | |
| 0 | 30 (50.0%) |
| 1 | 30 (50.0%) |
| gioi | |
| 0 | 4 (6.7%) |
| 1 | 54 (90.0%) |
| 2 | 2 (3.3%) |
| age_gr | |
| <35 | 24 (40.0%) |
| 36-55 | 25 (41.7%) |
| tren 55 | 10 (16.7%) |
| Missing | 1 (1.7%) |
| iss0 | |
| Mean (SD) | 25.2 (3.94) |
| Median [Min, Max] | 25.0 [16.0, 34.0] |
| iss1 | |
| Mean (SD) | 24.6 (4.41) |
| Median [Min, Max] | 25.0 [9.00, 34.0] |
| iss2 | |
| 1 | 1 (1.7%) |
| 2 | 44 (73.3%) |
| 3 | 14 (23.3%) |
| 4 | 1 (1.7%) |
| nmc | |
| 0 | 30 (50.0%) |
| 1 | 30 (50.0%) |
| dmc | |
| 0 | 17 (28.3%) |
| 1 | 43 (71.7%) |
| trongnao | |
| 0 | 33 (55.0%) |
| 1 | 27 (45.0%) |
| xhdn | |
| 0 | 38 (63.3%) |
| 1 | 22 (36.7%) |
| xhnt | |
| 0 | 57 (95.0%) |
| 1 | 3 (5.0%) |
| xoabeday | |
| 0 | 60 (100%) |
| dayduonggiua | |
| 0 | 14 (23.3%) |
| 1 | 46 (76.7%) |
| phunao | |
| 0 | 2 (3.3%) |
| 1 | 58 (96.7%) |
| tutha | |
| 0 | 56 (93.3%) |
| 1 | 4 (6.7%) |
| vanmach | |
| 0 | 56 (93.3%) |
| 1 | 4 (6.7%) |
| nor | |
| 0 | 56 (93.3%) |
| 3 | 3 (5.0%) |
| 5 | 1 (1.7%) |
| adre | |
| 0 | 59 (98.3%) |
| 2 | 1 (1.7%) |
| dobu | |
| 0 | 60 (100%) |
| dopa | |
| 0 | 60 (100%) |
| maumattren1l | |
| 0 | 29 (48.3%) |
| 1 | 31 (51.7%) |
| dtup2 | |
| 1 | 29 (48.3%) |
| 2 | 31 (51.7%) |
| pxap | |
| 1 | 25 (41.7%) |
| 2 | 33 (55.0%) |
| 3 | 2 (3.3%) |
| pxat | |
| 1 | 12 (20.0%) |
| 2 | 38 (63.3%) |
| 3 | 10 (16.7%) |
| song | |
| 0 | 21 (35.0%) |
| 1 | 39 (65.0%) |
| tv | |
| 0 | 39 (65.0%) |
| 1 | 21 (35.0%) |
t1=compareGroups(group~gioi+age_gr+iss0+iss1+iss2+nmc+dmc+trongnao+xhdn+xhnt+xoabeday+dayduonggiua+phunao+tutha+vanmach+nor+adre+dobu+dopa+maumattren1l+dtup2+pxap+pxat+song+tv, data=data)
## Warning in chisq.test(xx, correct = FALSE): Chi-squared approximation may be
## incorrect
## Warning in chisq.test(xx, correct = FALSE): Chi-squared approximation may be
## incorrect
## Warning in chisq.test(xx, correct = FALSE): Chi-squared approximation may be
## incorrect
## Warning in chisq.test(xx, correct = FALSE): Chi-squared approximation may be
## incorrect
## Warning in chisq.test(xx, correct = FALSE): Chi-squared approximation may be
## incorrect
t1
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 gioi 60 0.055* categorical ALL
## 2 age_gr 59 0.787 categorical ALL
## 3 iss0 60 0.089* continuous normal ALL
## 4 iss1 60 0.014** continuous normal ALL
## 5 iss2 60 0.292 categorical ALL
## 6 nmc 60 0.796 categorical ALL
## 7 dmc 60 0.567 categorical ALL
## 8 trongnao 60 1.000 categorical ALL
## 9 xhdn 60 0.422 categorical ALL
## 10 xhnt 60 1.000 categorical ALL
## 11 xoabeday 60 . categorical ALL
## 12 dayduonggiua 60 1.000 categorical ALL
## 13 phunao 60 1.000 categorical ALL
## 14 tutha 60 1.000 categorical ALL
## 15 vanmach 60 1.000 categorical ALL
## 16 nor 60 1.000 categorical ALL
## 17 adre 60 1.000 categorical ALL
## 18 dobu 60 . categorical ALL
## 19 dopa 60 . categorical ALL
## 20 maumattren1l 60 1.000 categorical ALL
## 21 dtup2 60 1.000 categorical ALL
## 22 pxap 60 0.638 categorical ALL
## 23 pxat 60 0.103 categorical ALL
## 24 song 60 1.000 categorical ALL
## 25 tv 60 1.000 categorical ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t1)
##
## --------Summary descriptives table by 'group'---------
##
## _______________________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## gioi: 0.055
## 0 0 (0.00%) 4 (13.3%)
## 1 28 (93.3%) 26 (86.7%)
## 2 2 (6.67%) 0 (0.00%)
## age_gr: 0.787
## <35 11 (36.7%) 13 (44.8%)
## 36-55 13 (43.3%) 12 (41.4%)
## tren 55 6 (20.0%) 4 (13.8%)
## iss0 26.0 (2.80) 24.3 (4.71) 0.089
## iss1 26.0 (2.80) 23.2 (5.27) 0.014
## iss2: 0.292
## 1 0 (0.00%) 1 (3.33%)
## 2 20 (66.7%) 24 (80.0%)
## 3 9 (30.0%) 5 (16.7%)
## 4 1 (3.33%) 0 (0.00%)
## nmc: 0.796
## 0 14 (46.7%) 16 (53.3%)
## 1 16 (53.3%) 14 (46.7%)
## dmc: 0.567
## 0 10 (33.3%) 7 (23.3%)
## 1 20 (66.7%) 23 (76.7%)
## trongnao: 1.000
## 0 17 (56.7%) 16 (53.3%)
## 1 13 (43.3%) 14 (46.7%)
## xhdn: 0.422
## 0 17 (56.7%) 21 (70.0%)
## 1 13 (43.3%) 9 (30.0%)
## xhnt: 1.000
## 0 29 (96.7%) 28 (93.3%)
## 1 1 (3.33%) 2 (6.67%)
## xoabeday: 0 30 (100%) 30 (100%) .
## dayduonggiua: 1.000
## 0 7 (23.3%) 7 (23.3%)
## 1 23 (76.7%) 23 (76.7%)
## phunao: 1.000
## 0 1 (3.33%) 1 (3.33%)
## 1 29 (96.7%) 29 (96.7%)
## tutha: 1.000
## 0 28 (93.3%) 28 (93.3%)
## 1 2 (6.67%) 2 (6.67%)
## vanmach: 1.000
## 0 28 (93.3%) 28 (93.3%)
## 1 2 (6.67%) 2 (6.67%)
## nor: 1.000
## 0 28 (93.3%) 28 (93.3%)
## 3 1 (3.33%) 2 (6.67%)
## 5 1 (3.33%) 0 (0.00%)
## adre: 1.000
## 0 30 (100%) 29 (96.7%)
## 2 0 (0.00%) 1 (3.33%)
## dobu: 0 30 (100%) 30 (100%) .
## dopa: 0 30 (100%) 30 (100%) .
## maumattren1l: 1.000
## 0 15 (50.0%) 14 (46.7%)
## 1 15 (50.0%) 16 (53.3%)
## dtup2: 1.000
## 1 15 (50.0%) 14 (46.7%)
## 2 15 (50.0%) 16 (53.3%)
## pxap: 0.638
## 1 13 (43.3%) 12 (40.0%)
## 2 17 (56.7%) 16 (53.3%)
## 3 0 (0.00%) 2 (6.67%)
## pxat: 0.103
## 1 6 (20.0%) 6 (20.0%)
## 2 16 (53.3%) 22 (73.3%)
## 3 8 (26.7%) 2 (6.67%)
## song: 1.000
## 0 10 (33.3%) 11 (36.7%)
## 1 20 (66.7%) 19 (63.3%)
## tv: 1.000
## 0 20 (66.7%) 19 (63.3%)
## 1 10 (33.3%) 11 (36.7%)
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t2=compareGroups(group~gcs+gcs0+gcs1+gcs2+gcs3+gcs4+gcs5, data=data)
t2
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 gcs 60 0.226 continuous normal ALL
## 2 gcs0 60 0.536 continuous normal ALL
## 3 gcs1 60 0.045** continuous normal ALL
## 4 gcs2 60 0.186 continuous normal ALL
## 5 gcs3 60 0.081* continuous normal ALL
## 6 gcs4 54 <0.001** continuous normal ALL
## 7 gcs5 30 0.055* continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t2)
##
## --------Summary descriptives table by 'group'---------
##
## ______________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## gcs 7.13 (1.74) 6.67 (1.15) 0.226
## gcs0 6.00 (0.00) 6.07 (0.58) 0.536
## gcs1 6.00 (0.00) 6.50 (1.31) 0.045
## gcs2 6.06 (0.33) 6.60 (2.16) 0.186
## gcs3 6.00 (0.00) 7.00 (3.03) 0.081
## gcs4 6.33 (1.44) 9.44 (3.84) <0.001
## gcs5 10.3 (1.59) 12.4 (2.91) 0.055
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t3=compareGroups(group~m+t+hatt+hatr+hieuap+hatb+gcs5, data=data)
t3
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 m 60 0.106 continuous normal ALL
## 2 t 60 1.000 continuous normal ALL
## 3 hatt 60 0.360 continuous normal ALL
## 4 hatr 60 0.583 continuous normal ALL
## 5 hieuap 60 0.452 continuous normal ALL
## 6 hatb 60 0.402 continuous normal ALL
## 7 gcs5 30 0.055* continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t3)
##
## --------Summary descriptives table by 'group'---------
##
## ________________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## m 73.8 (10.9) 79.9 (17.0) 0.106
## t 37.4 (0.37) 37.4 (0.44) 1.000
## hatt 106 (17.0) 111 (31.0) 0.360
## hatr 64.2 (13.9) 66.0 (11.2) 0.583
## hieuap 41.3 (11.1) 45.5 (27.9) 0.452
## hatb 78.0 (14.0) 81.2 (15.2) 0.402
## gcs5 10.3 (1.59) 12.4 (2.91) 0.055
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t4=compareGroups(group~dtup+dtup2+dtut+dtut2+nmc+dmc+trongnao+xhdn+phunao+lech, data=data)
## Warning in chisq.test(xx, correct = FALSE): Chi-squared approximation may be
## incorrect
t4
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 dtup 60 0.907 continuous normal ALL
## 2 dtup2 60 1.000 categorical ALL
## 3 dtut 60 0.945 continuous normal ALL
## 4 dtut2 60 0.092* continuous normal ALL
## 5 nmc 60 0.796 categorical ALL
## 6 dmc 60 0.567 categorical ALL
## 7 trongnao 60 1.000 categorical ALL
## 8 xhdn 60 0.422 categorical ALL
## 9 phunao 60 1.000 categorical ALL
## 10 lech 60 0.900 continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t4)
##
## --------Summary descriptives table by 'group'---------
##
## ___________________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## dtup 3.02 (1.12) 2.98 (1.08) 0.907
## dtup2: 1.000
## 1 15 (50.0%) 14 (46.7%)
## 2 15 (50.0%) 16 (53.3%)
## dtut 2.38 (0.99) 2.37 (0.87) 0.945
## dtut2 1.50 (0.73) 1.23 (0.43) 0.092
## nmc: 0.796
## 0 14 (46.7%) 16 (53.3%)
## 1 16 (53.3%) 14 (46.7%)
## dmc: 0.567
## 0 10 (33.3%) 7 (23.3%)
## 1 20 (66.7%) 23 (76.7%)
## trongnao: 1.000
## 0 17 (56.7%) 16 (53.3%)
## 1 13 (43.3%) 14 (46.7%)
## xhdn: 0.422
## 0 17 (56.7%) 21 (70.0%)
## 1 13 (43.3%) 9 (30.0%)
## phunao: 1.000
## 0 1 (3.33%) 1 (3.33%)
## 1 29 (96.7%) 29 (96.7%)
## lech 8.20 (5.07) 8.03 (5.16) 0.900
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t5=compareGroups(group~ngaydtr+thomay+song+maumattren1l+vanmach, data=data)
## Warning in chisq.test(xx, correct = FALSE): Chi-squared approximation may be
## incorrect
t5
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 ngaydtr 60 0.742 continuous normal ALL
## 2 thomay 60 0.021** continuous normal ALL
## 3 song 60 1.000 categorical ALL
## 4 maumattren1l 60 1.000 categorical ALL
## 5 vanmach 60 1.000 categorical ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t5)
##
## --------Summary descriptives table by 'group'---------
##
## _______________________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## ngaydtr 25.2 (13.1) 23.8 (17.7) 0.742
## thomay 13.5 (6.88) 9.40 (6.62) 0.021
## song: 1.000
## 0 10 (33.3%) 11 (36.7%)
## 1 20 (66.7%) 19 (63.3%)
## maumattren1l: 1.000
## 0 15 (50.0%) 14 (46.7%)
## 1 15 (50.0%) 16 (53.3%)
## vanmach: 1.000
## 0 28 (93.3%) 28 (93.3%)
## 1 2 (6.67%) 2 (6.67%)
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t6=compareGroups(group~scvo21+scvo22+scvo23+il61+il62+il63+cre1+cre2+cre3, data=data)
t6
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 scvo21 60 0.060* continuous normal ALL
## 2 scvo22 60 0.313 continuous normal ALL
## 3 scvo23 49 0.125 continuous normal ALL
## 4 il61 60 0.723 continuous normal ALL
## 5 il62 60 0.088* continuous normal ALL
## 6 il63 49 0.004** continuous normal ALL
## 7 cre1 60 0.344 continuous normal ALL
## 8 cre2 60 0.484 continuous normal ALL
## 9 cre3 49 0.100 continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t6)
##
## --------Summary descriptives table by 'group'---------
##
## ________________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## scvo21 82.1 (10.8) 86.6 (6.95) 0.060
## scvo22 82.9 (9.26) 85.1 (8.01) 0.313
## scvo23 81.4 (6.76) 84.6 (7.59) 0.125
## il61 347 (271) 374 (315) 0.723
## il62 230 (201) 338 (274) 0.088
## il63 63.8 (56.7) 293 (361) 0.004
## cre1 85.9 (27.6) 112 (148) 0.344
## cre2 92.0 (30.3) 101 (62.6) 0.484
## cre3 81.5 (26.1) 96.0 (34.1) 0.100
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t7=compareGroups(group~bc+bc0+bc1+bc2+bc3+bc4+hc+hc1+hc2+hc3+hc4+tc+tc0+tc1+tc2+tc3+tc4+hb+hb0+hb1+hb2+hb3+hb4+pt, data=data)
t7
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 bc 60 0.332 continuous normal ALL
## 2 bc0 60 0.879 continuous normal ALL
## 3 bc1 60 0.122 continuous normal ALL
## 4 bc2 60 0.031** continuous normal ALL
## 5 bc3 60 0.125 continuous normal ALL
## 6 bc4 54 0.112 continuous normal ALL
## 7 hc 60 0.141 continuous normal ALL
## 8 hc1 60 0.813 continuous normal ALL
## 9 hc2 60 0.946 continuous normal ALL
## 10 hc3 60 0.929 continuous normal ALL
## 11 hc4 54 0.306 continuous normal ALL
## 12 tc 60 0.033** continuous normal ALL
## 13 tc0 60 0.090* continuous normal ALL
## 14 tc1 60 0.193 continuous normal ALL
## 15 tc2 60 0.062* continuous normal ALL
## 16 tc3 60 0.017** continuous normal ALL
## 17 tc4 54 0.068* continuous normal ALL
## 18 hb 60 0.110 continuous normal ALL
## 19 hb0 60 0.154 continuous normal ALL
## 20 hb1 60 0.881 continuous normal ALL
## 21 hb2 60 0.775 continuous normal ALL
## 22 hb3 60 0.307 continuous normal ALL
## 23 hb4 54 0.309 continuous normal ALL
## 24 pt 60 0.611 continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t7)
##
## --------Summary descriptives table by 'group'---------
##
## _____________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## bc 12.7 (4.71) 14.0 (5.71) 0.332
## bc0 13.2 (4.18) 13.4 (5.04) 0.879
## bc1 14.5 (4.40) 12.9 (3.93) 0.122
## bc2 14.9 (5.22) 12.3 (3.98) 0.031
## bc3 19.3 (24.6) 12.1 (2.82) 0.125
## bc4 13.2 (2.84) 11.7 (3.95) 0.112
## hc 3.45 (0.59) 3.73 (0.84) 0.141
## hc1 3.27 (0.39) 3.24 (0.55) 0.813
## hc2 3.28 (0.39) 3.27 (0.37) 0.946
## hc3 3.30 (0.36) 3.29 (0.33) 0.929
## hc4 3.31 (0.38) 3.41 (0.38) 0.306
## tc 188 (72.4) 234 (88.9) 0.033
## tc0 173 (71.7) 212 (101) 0.090
## tc1 154 (69.4) 179 (78.1) 0.193
## tc2 160 (82.4) 202 (87.7) 0.062
## tc3 159 (69.4) 209 (87.8) 0.017
## tc4 211 (97.3) 262 (106) 0.068
## hb 10.8 (1.91) 11.8 (2.69) 0.110
## hb0 10.6 (1.87) 11.3 (2.16) 0.154
## hb1 10.4 (1.56) 10.3 (1.87) 0.881
## hb2 10.4 (1.55) 10.5 (1.35) 0.775
## hb3 10.6 (1.54) 10.3 (1.13) 0.307
## hb4 14.8 (20.9) 10.6 (1.57) 0.309
## pt 86.8 (12.8) 85.2 (10.9) 0.611
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t8=compareGroups(group~ph0+ph1+ph2+ph3+ph4+po20+po21+po22+po23+po24+pco20+pco21+pco22+pco23+pco24+hco30+hco31+hco32+hco33+hco34, data=data)
## Warning in compareGroups.fit(X = X, y = y, include.label = include.label, :
## Variables 'po20' have been removed since some errors occurred
t8
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 ph0 60 0.367 continuous normal ALL
## 2 ph1 60 0.326 continuous normal ALL
## 3 ph2 60 0.525 continuous normal ALL
## 4 ph3 60 0.777 continuous normal ALL
## 5 ph4 54 0.203 continuous normal ALL
## 6 po21 60 0.433 continuous normal ALL
## 7 po22 60 0.124 continuous normal ALL
## 8 po23 60 0.180 continuous normal ALL
## 9 po24 54 0.422 continuous normal ALL
## 10 pco20 60 0.405 continuous normal ALL
## 11 pco21 60 0.346 continuous normal ALL
## 12 pco22 60 0.502 continuous normal ALL
## 13 pco23 60 0.573 continuous normal ALL
## 14 pco24 54 0.107 continuous normal ALL
## 15 hco30 60 0.066* continuous normal ALL
## 16 hco31 60 0.040** continuous normal ALL
## 17 hco32 60 0.712 continuous normal ALL
## 18 hco33 60 0.515 continuous normal ALL
## 19 hco34 54 0.414 continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t8)
##
## --------Summary descriptives table by 'group'---------
##
## _______________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## ph0 7.36 (0.08) 7.38 (0.06) 0.367
## ph1 18.3 (60.0) 7.40 (0.08) 0.326
## ph2 7.38 (0.08) 7.40 (0.05) 0.525
## ph3 7.38 (0.06) 7.38 (0.09) 0.777
## ph4 7.37 (0.07) 7.40 (0.10) 0.203
## po21 133 (47.8) 142 (46.7) 0.433
## po22 134 (35.5) 149 (40.7) 0.124
## po23 125 (35.2) 138 (34.7) 0.180
## po24 133 (35.1) 176 (271) 0.422
## pco20 39.9 (16.3) 37.2 (6.72) 0.405
## pco21 41.1 (18.5) 37.7 (7.14) 0.346
## pco22 38.2 (20.0) 35.6 (4.82) 0.502
## pco23 39.7 (16.0) 37.8 (9.26) 0.573
## pco24 42.9 (22.0) 35.5 (7.12) 0.107
## hco30 21.1 (4.70) 23.9 (6.57) 0.066
## hco31 22.0 (3.90) 24.8 (6.02) 0.040
## hco32 23.5 (4.79) 23.1 (3.20) 0.712
## hco33 23.6 (4.41) 22.9 (3.58) 0.515
## hco34 24.0 (4.31) 23.1 (3.20) 0.414
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t9=compareGroups(group~iss0+iss1+iss2+iss3+iss4+icp1+icp2+icp3+icp4, data=data)
t9
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 iss0 60 0.089* continuous normal ALL
## 2 iss1 60 0.014** continuous normal ALL
## 3 iss2 60 0.292 categorical ALL
## 4 iss3 60 0.003** continuous normal ALL
## 5 iss4 54 <0.001** continuous normal ALL
## 6 icp1 60 0.033** continuous normal ALL
## 7 icp2 60 0.177 continuous normal ALL
## 8 icp3 60 0.127 continuous normal ALL
## 9 icp4 54 0.306 continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t9)
##
## --------Summary descriptives table by 'group'---------
##
## _______________________________________
## 0 1 p.overall
## N=30 N=30
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## iss0 26.0 (2.80) 24.3 (4.71) 0.089
## iss1 26.0 (2.80) 23.2 (5.27) 0.014
## iss2: 0.292
## 1 0 (0.00%) 1 (3.33%)
## 2 20 (66.7%) 24 (80.0%)
## 3 9 (30.0%) 5 (16.7%)
## 4 1 (3.33%) 0 (0.00%)
## iss3 26.0 (2.80) 21.2 (7.98) 0.003
## iss4 24.4 (6.91) 15.4 (7.51) <0.001
## icp1 37.4 (10.6) 31.2 (11.3) 0.033
## icp2 34.4 (11.7) 29.7 (14.9) 0.177
## icp3 30.3 (9.00) 26.0 (12.1) 0.127
## icp4 23.8 (9.92) 21.0 (9.85) 0.306
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t10=compareGroups(group~bi1+bi2+bi3, data=data)
t10
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 bi1 41 0.087* continuous normal ALL
## 2 bi2 39 0.210 continuous normal ALL
## 3 bi3 39 0.557 continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t10)
##
## --------Summary descriptives table by 'group'---------
##
## _____________________________________
## 0 1 p.overall
## N=21 N=20
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## bi1 40.7 (12.0) 49.2 (18.2) 0.087
## bi2 69.8 (9.39) 76.3 (20.3) 0.210
## bi3 89.5 (8.41) 91.3 (10.5) 0.557
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
t11=compareGroups(group~bi1+bi2+bi3, data=data)
t11
##
##
## -------- Summary of results by groups of 'group'---------
##
##
## var N p.value method selection
## 1 bi1 41 0.087* continuous normal ALL
## 2 bi2 39 0.210 continuous normal ALL
## 3 bi3 39 0.557 continuous normal ALL
## -----
## Signif. codes: 0 '**' 0.05 '*' 0.1 ' ' 1
createTable(t11)
##
## --------Summary descriptives table by 'group'---------
##
## _____________________________________
## 0 1 p.overall
## N=21 N=20
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## bi1 40.7 (12.0) 49.2 (18.2) 0.087
## bi2 69.8 (9.39) 76.3 (20.3) 0.210
## bi3 89.5 (8.41) 91.3 (10.5) 0.557
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
res <- compareGroups(icp1_code~bi1, data = data)
alltab <- createTable(res, show.p.overall = TRUE)
group0 <- createTable(update(res, subset = group == "0"),
show.p.overall = TRUE)
group1 <- createTable(update(res, subset = group == "1"), show.p.overall = TRUE)
cbind(ALL = alltab, Khongghep = group0, GhepTBG = group1)
##
## --------Summary descriptives table ---------
##
## _______________________________________________________________________________________________
## ALL Khongghep GhepTBG
## _________________________________ _____________________ _________________________________
## <=20 >20 p.overall >20 p.overall <=20 >20 p.overall
## N=4 N=37 N=21 N=4 N=16
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## bi1 63.8 (14.4) 42.8 (14.7) 0.055 40.7 (12.0) . 63.8 (14.4) 45.6 (17.6) 0.079
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
res1 <- compareGroups(icp2_code~bi2, data = data)
alltab1 <- createTable(res1, show.p.overall = TRUE)
group01 <- createTable(update(res1, subset = group == "0"),
show.p.overall = TRUE)
group11 <- createTable(update(res1, subset = group == "1"), show.p.overall = TRUE)
cbind(ALL = alltab1, Khongghep = group01, GhepTBG = group11)
##
## --------Summary descriptives table ---------
##
## _______________________________________________________________________________________________
## ALL Khongghep GhepTBG
## _________________________________ _____________________ _________________________________
## <=20 >20 p.overall >20 p.overall <=20 >20 p.overall
## N=7 N=32 N=20 N=7 N=12
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## bi2 80.7 (18.6) 71.2 (14.9) 0.244 69.8 (9.39) . 80.7 (18.6) 73.8 (21.5) 0.470
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
res2 <- compareGroups(icp3_code~bi3, data = data)
alltab2 <- createTable(res2, show.p.overall = TRUE)
group02 <- createTable(update(res2, subset = group == "0"),
show.p.overall = TRUE)
group12 <- createTable(update(res2, subset = group == "1"), show.p.overall = TRUE)
cbind(ALL = alltab2, Khongghep = group02, GhepTBG = group12)
##
## --------Summary descriptives table ---------
##
## ___________________________________________________________________________________________________________
## ALL Khongghep GhepTBG
## _________________________________ _________________________________ _________________________________
## <=20 >20 p.overall <=20 >20 p.overall <=20 >20 p.overall
## N=16 N=23 N=4 N=16 N=12 N=7
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## bi3 94.7 (7.63) 87.4 (9.52) 0.012 90.0 (9.13) 89.4 (8.54) 0.907 96.2 (6.78) 82.9 (10.7) 0.016
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
data1=subset(data, group==1)
my_data1 = subset(data1, select=c(gcs, iss0, iss1, iss2, iss3, iss4, bi1, bi2, bi3 ,il61, il62, il63, thomay, tv))
# print the first 6 rows
names(my_data1)
## [1] "gcs" "iss0" "iss1" "iss2" "iss3" "iss4" "bi1" "bi2"
## [9] "bi3" "il61" "il62" "il63" "thomay" "tv"
library("Hmisc")
## Warning: package 'Hmisc' was built under R version 4.0.3
## Loading required package: lattice
##
## Attaching package: 'lattice'
## The following object is masked from 'package:moonBook':
##
## densityplot
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:table1':
##
## label, label<-, units
## The following objects are masked from 'package:dplyr':
##
## src, summarize
## The following objects are masked from 'package:base':
##
## format.pval, units
res3 <- rcorr(as.matrix(my_data1))
res3
## gcs iss0 iss1 iss2 iss3 iss4 bi1 bi2 bi3 il61 il62 il63
## gcs 1.00 -0.22 -0.34 -0.11 -0.27 -0.07 0.43 0.40 0.41 -0.26 -0.11 0.16
## iss0 -0.22 1.00 0.56 0.67 0.31 -0.16 0.36 0.44 0.30 0.22 0.19 -0.13
## iss1 -0.34 0.56 1.00 0.42 0.77 0.33 -0.24 -0.14 -0.12 0.27 0.40 0.07
## iss2 -0.11 0.67 0.42 1.00 0.44 0.22 -0.03 -0.08 -0.21 0.41 0.27 0.16
## iss3 -0.27 0.31 0.77 0.44 1.00 0.60 -0.51 -0.48 -0.30 0.45 0.43 0.18
## iss4 -0.07 -0.16 0.33 0.22 0.60 1.00 -0.73 -0.54 -0.53 0.41 0.43 0.36
## bi1 0.43 0.36 -0.24 -0.03 -0.51 -0.73 1.00 0.92 0.84 -0.66 -0.49 -0.56
## bi2 0.40 0.44 -0.14 -0.08 -0.48 -0.54 0.92 1.00 0.87 -0.49 -0.31 -0.45
## bi3 0.41 0.30 -0.12 -0.21 -0.30 -0.53 0.84 0.87 1.00 -0.46 -0.20 -0.34
## il61 -0.26 0.22 0.27 0.41 0.45 0.41 -0.66 -0.49 -0.46 1.00 0.71 0.42
## il62 -0.11 0.19 0.40 0.27 0.43 0.43 -0.49 -0.31 -0.20 0.71 1.00 0.62
## il63 0.16 -0.13 0.07 0.16 0.18 0.36 -0.56 -0.45 -0.34 0.42 0.62 1.00
## thomay -0.21 -0.17 0.09 -0.12 0.24 0.66 -0.77 -0.63 -0.42 0.08 0.17 0.31
## tv 0.04 0.13 0.39 0.25 0.57 0.76 -0.51 NaN NaN 0.34 0.56 0.34
## thomay tv
## gcs -0.21 0.04
## iss0 -0.17 0.13
## iss1 0.09 0.39
## iss2 -0.12 0.25
## iss3 0.24 0.57
## iss4 0.66 0.76
## bi1 -0.77 -0.51
## bi2 -0.63 NaN
## bi3 -0.42 NaN
## il61 0.08 0.34
## il62 0.17 0.56
## il63 0.31 0.34
## thomay 1.00 0.37
## tv 0.37 1.00
##
## n
## gcs iss0 iss1 iss2 iss3 iss4 bi1 bi2 bi3 il61 il62 il63 thomay tv
## gcs 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss0 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss1 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss2 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss3 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss4 27 27 27 27 27 27 20 19 19 27 27 25 27 27
## bi1 20 20 20 20 20 20 20 19 19 20 20 20 20 20
## bi2 19 19 19 19 19 19 19 19 19 19 19 19 19 19
## bi3 19 19 19 19 19 19 19 19 19 19 19 19 19 19
## il61 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## il62 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## il63 26 26 26 26 26 25 20 19 19 26 26 26 26 26
## thomay 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## tv 30 30 30 30 30 27 20 19 19 30 30 26 30 30
##
## P
## gcs iss0 iss1 iss2 iss3 iss4 bi1 bi2 bi3 il61
## gcs 0.2522 0.0629 0.5464 0.1559 0.7301 0.0569 0.0860 0.0784 0.1573
## iss0 0.2522 0.0012 0.0000 0.0991 0.4395 0.1211 0.0626 0.2166 0.2460
## iss1 0.0629 0.0012 0.0199 0.0000 0.0967 0.3084 0.5708 0.6124 0.1466
## iss2 0.5464 0.0000 0.0199 0.0150 0.2662 0.8963 0.7551 0.3815 0.0261
## iss3 0.1559 0.0991 0.0000 0.0150 0.0010 0.0225 0.0383 0.2110 0.0130
## iss4 0.7301 0.4395 0.0967 0.2662 0.0010 0.0003 0.0162 0.0184 0.0357
## bi1 0.0569 0.1211 0.3084 0.8963 0.0225 0.0003 0.0000 0.0000 0.0016
## bi2 0.0860 0.0626 0.5708 0.7551 0.0383 0.0162 0.0000 0.0000 0.0331
## bi3 0.0784 0.2166 0.6124 0.3815 0.2110 0.0184 0.0000 0.0000 0.0449
## il61 0.1573 0.2460 0.1466 0.0261 0.0130 0.0357 0.0016 0.0331 0.0449
## il62 0.5681 0.3265 0.0281 0.1567 0.0189 0.0258 0.0292 0.1998 0.4193 0.0000
## il63 0.4324 0.5210 0.7298 0.4390 0.3660 0.0741 0.0107 0.0524 0.1579 0.0317
## thomay 0.2607 0.3660 0.6209 0.5445 0.1991 0.0002 0.0000 0.0037 0.0739 0.6936
## tv 0.8312 0.4933 0.0317 0.1855 0.0010 0.0000 0.0226 0.0654
## il62 il63 thomay tv
## gcs 0.5681 0.4324 0.2607 0.8312
## iss0 0.3265 0.5210 0.3660 0.4933
## iss1 0.0281 0.7298 0.6209 0.0317
## iss2 0.1567 0.4390 0.5445 0.1855
## iss3 0.0189 0.3660 0.1991 0.0010
## iss4 0.0258 0.0741 0.0002 0.0000
## bi1 0.0292 0.0107 0.0000 0.0226
## bi2 0.1998 0.0524 0.0037
## bi3 0.4193 0.1579 0.0739
## il61 0.0000 0.0317 0.6936 0.0654
## il62 0.0008 0.3550 0.0014
## il63 0.0008 0.1184 0.0848
## thomay 0.3550 0.1184 0.0456
## tv 0.0014 0.0848 0.0456
data0=subset(data, group==0)
my_data0 = subset(data1, select=c(gcs, iss0, iss1, iss2, iss3, iss4, bi1, bi2, bi3 ,il61, il62, il63, thomay, tv))
# print the first 6 rows
head(my_data0, 4)
## gcs iss0 iss1 iss2 iss3 iss4 bi1 bi2 bi3 il61 il62 il63 thomay tv
## 31 6 34 34 3 34 NA NA NA NA 214.30 315.60 629.30 6 1
## 32 6 25 25 2 25 16 60 75 100 126.40 225.40 21.13 12 0
## 33 6 25 25 2 16 16 60 100 100 67.32 373.80 143.60 7 0
## 34 6 25 25 2 9 4 75 100 100 18.29 316.45 22.48 5 0
library("Hmisc")
res4 <- rcorr(as.matrix(my_data0))
res4
## gcs iss0 iss1 iss2 iss3 iss4 bi1 bi2 bi3 il61 il62 il63
## gcs 1.00 -0.22 -0.34 -0.11 -0.27 -0.07 0.43 0.40 0.41 -0.26 -0.11 0.16
## iss0 -0.22 1.00 0.56 0.67 0.31 -0.16 0.36 0.44 0.30 0.22 0.19 -0.13
## iss1 -0.34 0.56 1.00 0.42 0.77 0.33 -0.24 -0.14 -0.12 0.27 0.40 0.07
## iss2 -0.11 0.67 0.42 1.00 0.44 0.22 -0.03 -0.08 -0.21 0.41 0.27 0.16
## iss3 -0.27 0.31 0.77 0.44 1.00 0.60 -0.51 -0.48 -0.30 0.45 0.43 0.18
## iss4 -0.07 -0.16 0.33 0.22 0.60 1.00 -0.73 -0.54 -0.53 0.41 0.43 0.36
## bi1 0.43 0.36 -0.24 -0.03 -0.51 -0.73 1.00 0.92 0.84 -0.66 -0.49 -0.56
## bi2 0.40 0.44 -0.14 -0.08 -0.48 -0.54 0.92 1.00 0.87 -0.49 -0.31 -0.45
## bi3 0.41 0.30 -0.12 -0.21 -0.30 -0.53 0.84 0.87 1.00 -0.46 -0.20 -0.34
## il61 -0.26 0.22 0.27 0.41 0.45 0.41 -0.66 -0.49 -0.46 1.00 0.71 0.42
## il62 -0.11 0.19 0.40 0.27 0.43 0.43 -0.49 -0.31 -0.20 0.71 1.00 0.62
## il63 0.16 -0.13 0.07 0.16 0.18 0.36 -0.56 -0.45 -0.34 0.42 0.62 1.00
## thomay -0.21 -0.17 0.09 -0.12 0.24 0.66 -0.77 -0.63 -0.42 0.08 0.17 0.31
## tv 0.04 0.13 0.39 0.25 0.57 0.76 -0.51 NaN NaN 0.34 0.56 0.34
## thomay tv
## gcs -0.21 0.04
## iss0 -0.17 0.13
## iss1 0.09 0.39
## iss2 -0.12 0.25
## iss3 0.24 0.57
## iss4 0.66 0.76
## bi1 -0.77 -0.51
## bi2 -0.63 NaN
## bi3 -0.42 NaN
## il61 0.08 0.34
## il62 0.17 0.56
## il63 0.31 0.34
## thomay 1.00 0.37
## tv 0.37 1.00
##
## n
## gcs iss0 iss1 iss2 iss3 iss4 bi1 bi2 bi3 il61 il62 il63 thomay tv
## gcs 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss0 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss1 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss2 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss3 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## iss4 27 27 27 27 27 27 20 19 19 27 27 25 27 27
## bi1 20 20 20 20 20 20 20 19 19 20 20 20 20 20
## bi2 19 19 19 19 19 19 19 19 19 19 19 19 19 19
## bi3 19 19 19 19 19 19 19 19 19 19 19 19 19 19
## il61 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## il62 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## il63 26 26 26 26 26 25 20 19 19 26 26 26 26 26
## thomay 30 30 30 30 30 27 20 19 19 30 30 26 30 30
## tv 30 30 30 30 30 27 20 19 19 30 30 26 30 30
##
## P
## gcs iss0 iss1 iss2 iss3 iss4 bi1 bi2 bi3 il61
## gcs 0.2522 0.0629 0.5464 0.1559 0.7301 0.0569 0.0860 0.0784 0.1573
## iss0 0.2522 0.0012 0.0000 0.0991 0.4395 0.1211 0.0626 0.2166 0.2460
## iss1 0.0629 0.0012 0.0199 0.0000 0.0967 0.3084 0.5708 0.6124 0.1466
## iss2 0.5464 0.0000 0.0199 0.0150 0.2662 0.8963 0.7551 0.3815 0.0261
## iss3 0.1559 0.0991 0.0000 0.0150 0.0010 0.0225 0.0383 0.2110 0.0130
## iss4 0.7301 0.4395 0.0967 0.2662 0.0010 0.0003 0.0162 0.0184 0.0357
## bi1 0.0569 0.1211 0.3084 0.8963 0.0225 0.0003 0.0000 0.0000 0.0016
## bi2 0.0860 0.0626 0.5708 0.7551 0.0383 0.0162 0.0000 0.0000 0.0331
## bi3 0.0784 0.2166 0.6124 0.3815 0.2110 0.0184 0.0000 0.0000 0.0449
## il61 0.1573 0.2460 0.1466 0.0261 0.0130 0.0357 0.0016 0.0331 0.0449
## il62 0.5681 0.3265 0.0281 0.1567 0.0189 0.0258 0.0292 0.1998 0.4193 0.0000
## il63 0.4324 0.5210 0.7298 0.4390 0.3660 0.0741 0.0107 0.0524 0.1579 0.0317
## thomay 0.2607 0.3660 0.6209 0.5445 0.1991 0.0002 0.0000 0.0037 0.0739 0.6936
## tv 0.8312 0.4933 0.0317 0.1855 0.0010 0.0000 0.0226 0.0654
## il62 il63 thomay tv
## gcs 0.5681 0.4324 0.2607 0.8312
## iss0 0.3265 0.5210 0.3660 0.4933
## iss1 0.0281 0.7298 0.6209 0.0317
## iss2 0.1567 0.4390 0.5445 0.1855
## iss3 0.0189 0.3660 0.1991 0.0010
## iss4 0.0258 0.0741 0.0002 0.0000
## bi1 0.0292 0.0107 0.0000 0.0226
## bi2 0.1998 0.0524 0.0037
## bi3 0.4193 0.1579 0.0739
## il61 0.0000 0.0317 0.6936 0.0654
## il62 0.0008 0.3550 0.0014
## il63 0.0008 0.1184 0.0848
## thomay 0.3550 0.1184 0.0456
## tv 0.0014 0.0848 0.0456
baseline = Surv(data$ngaydtr, data$song1==1)
km = survfit(baseline ~ 1)
km
## Call: survfit(formula = baseline ~ 1)
##
## n events median 0.95LCL 0.95UCL
## 60 21 NA 33 NA
summary(km)
## Call: survfit(formula = baseline ~ 1)
##
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 60 1 0.983 0.0165 0.951 1.000
## 5 59 1 0.967 0.0232 0.922 1.000
## 6 58 3 0.917 0.0357 0.849 0.989
## 7 55 1 0.900 0.0387 0.827 0.979
## 8 54 2 0.867 0.0439 0.785 0.957
## 9 52 2 0.833 0.0481 0.744 0.933
## 12 50 2 0.800 0.0516 0.705 0.908
## 13 46 1 0.783 0.0534 0.685 0.895
## 14 45 1 0.765 0.0549 0.665 0.881
## 15 42 1 0.747 0.0566 0.644 0.867
## 17 40 1 0.728 0.0582 0.623 0.852
## 21 36 2 0.688 0.0616 0.577 0.820
## 22 32 1 0.666 0.0633 0.553 0.803
## 30 18 1 0.629 0.0698 0.506 0.782
## 33 13 1 0.581 0.0794 0.444 0.759
km_trt_fit <- survfit(Surv(ngaydtr, song1) ~ group, data=data)
print(km_trt_fit)
## Call: survfit(formula = Surv(ngaydtr, song1) ~ group, data = data)
##
## n events median 0.95LCL 0.95UCL
## group=0 30 10 NA 30 NA
## group=1 30 11 NA 22 NA
baseline = Surv(data$ngaydtr, data$song1==1)
km1 = survfit(Surv(data$ngaydtr, data$song1==1) ~ data$group)
summary(km1)
## Call: survfit(formula = Surv(data$ngaydtr, data$song1 == 1) ~ data$group)
##
## data$group=0
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 6 30 2 0.933 0.0455 0.848 1.000
## 7 28 1 0.900 0.0548 0.799 1.000
## 8 27 1 0.867 0.0621 0.753 0.997
## 9 26 1 0.833 0.0680 0.710 0.978
## 13 25 1 0.800 0.0730 0.669 0.957
## 14 24 1 0.767 0.0772 0.629 0.934
## 15 22 1 0.732 0.0812 0.589 0.910
## 21 19 1 0.693 0.0856 0.544 0.883
## 30 11 1 0.630 0.0983 0.464 0.856
##
## data$group=1
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 30 1 0.967 0.0328 0.905 1.000
## 5 29 1 0.933 0.0455 0.848 1.000
## 6 28 1 0.900 0.0548 0.799 1.000
## 8 27 1 0.867 0.0621 0.753 0.997
## 9 26 1 0.833 0.0680 0.710 0.978
## 12 25 2 0.767 0.0772 0.629 0.934
## 17 19 1 0.726 0.0830 0.581 0.909
## 21 17 1 0.684 0.0885 0.530 0.881
## 22 15 1 0.638 0.0936 0.479 0.850
## 33 5 1 0.510 0.1365 0.302 0.862
library(survminer)
## Warning: package 'survminer' was built under R version 4.0.3
## Loading required package: ggpubr
## Warning: package 'ggpubr' was built under R version 4.0.3
ggsurvplot(km_trt_fit, # survfit object with calculated statistics.
data = data, # data used to fit survival curves.
risk.table = TRUE, # show risk table.
pval = TRUE, # show p-value of log-rank test.
conf.int = TRUE, # show confidence intervals for
# point estimates of survival curves.
xlim = c(0,100), # present narrower X axis, but not affect
# survival estimates.
xlab = "Time in day", # customize X axis label.
break.time.by = 6, # break X axis in time intervals by 500.
ggtheme = theme_light(), # customize plot and risk table with a theme.
risk.table.y.text.col = T, # colour risk table text annotations.
risk.table.y.text = FALSE # show bars instead of names in text annotations
# in legend of risk table
)
## Warning: Vectorized input to `element_text()` is not officially supported.
## Results may be unexpected or may change in future versions of ggplot2.
plot(km_trt_fit, xlab="Time to death", ylab="Prob of survival")