pacman::p_load(knitr,
kableExtra,
tidyverse,
janitor,
summarytools,
DataExplorer,
readxl,
arsenal,
epitools)
ds <- read_excel("C:/Users/lucas/Downloads/LUCAS (1).xlsx")
ds <- clean_names(ds)
ds <- ds %>% mutate_all(as.factor)
ds %>% count(sexo)
## # A tibble: 2 x 2
## sexo n
## <fct> <int>
## 1 0 43
## 2 1 77
ds %>% names
## [1] "id" "sexo" "idade" "escolaridade"
## [5] "tipo_de_escola" "comorbidade" "usa_medicamentos" "wsct"
ds %>% select(sexo:wsct) %>% tableone::CreateTableOne(data = .)
##
## Overall
## n 120
## sexo = 1 (%) 77 (64.2)
## idade = 1 (%) 63 (52.5)
## escolaridade = 1 (%) 39 (32.5)
## tipo_de_escola = 1 (%) 30 (25.0)
## comorbidade = 1 (%) 21 (17.5)
## usa_medicamentos = 1 (%) 59 (49.2)
## wsct = 1 (%) 42 (35.0)
ds %>% select(wsct, sexo:usa_medicamentos) %>%
compareGroups::compareGroups(wsct ~ .,
byrow = T,
riskratio = T,
data = .) %>%
compareGroups::createTable(.,
show.ratio = TRUE,
show.p.overall = F)
##
## --------Summary descriptives table by 'wsct'---------
##
## ________________________________________________________________
## 0 1 RR p.ratio
## N=78 N=42
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
## sexo:
## 0 25 (58.1%) 18 (41.9%) Ref. Ref.
## 1 53 (68.8%) 24 (31.2%) 0.74 [0.46;1.21] 0.249
## idade:
## 0 34 (59.6%) 23 (40.4%) Ref. Ref.
## 1 44 (69.8%) 19 (30.2%) 0.75 [0.46;1.22] 0.251
## escolaridade:
## 0 52 (64.2%) 29 (35.8%) Ref. Ref.
## 1 26 (66.7%) 13 (33.3%) 0.93 [0.55;1.58] 0.800
## tipo_de_escola:
## 0 61 (67.8%) 29 (32.2%) Ref. Ref.
## 1 17 (56.7%) 13 (43.3%) 1.34 [0.81;2.23] 0.281
## comorbidade:
## 0 64 (64.6%) 35 (35.4%) Ref. Ref.
## 1 14 (66.7%) 7 (33.3%) 0.94 [0.49;1.83] 0.876
## usa_medicamentos:
## 0 43 (70.5%) 18 (29.5%) Ref. Ref.
## 1 35 (59.3%) 24 (40.7%) 1.38 [0.84;2.26] 0.208
## ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
library(epitools)
riskratio(ds$sexo, ds$wsct )
## $data
## Outcome
## Predictor 0 1 Total
## 0 25 18 43
## 1 53 24 77
## Total 78 42 120
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## 0 1.0000000 NA NA
## 1 0.7445887 0.4589028 1.208126
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## 0 NA NA NA
## 1 0.2488116 0.3183615 0.2390161
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
Com base nos resultados, foi possível observar que o sexo masculino é um fator de proteção para o desenvolvimento de comprometimento das funções executivas (RR = 0.74 [0.45;1.21], p = 0.249). No entanto, embora fosse observado esse risco na amostra, os resultados não foram significativos (>0,05).
library(epitools)
riskratio(ds$idade, ds$wsct, rev = "r" )
## $data
## Outcome
## Predictor 0 1 Total
## 1 44 19 63
## 0 34 23 57
## Total 78 42 120
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## 1 1.00000 NA NA
## 0 1.33795 0.8190517 2.185589
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## 1 NA NA NA
## 0 0.2510058 0.2569936 0.242428
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
library(epitools)
riskratio(ds$escolaridade, ds$wsct, rev = "r" )
## $data
## Outcome
## Predictor 0 1 Total
## 1 26 13 39
## 0 52 29 81
## Total 78 42 120
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## 1 1.000000 NA NA
## 0 1.074074 0.6315285 1.826735
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## 1 NA NA NA
## 0 0.7999321 0.8404217 0.7905424
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
library(epitools)
riskratio(ds$tipo_de_escola, ds$wsct, rev = "r" )
## $data
## Outcome
## Predictor 0 1 Total
## 1 17 13 30
## 0 61 29 90
## Total 78 42 120
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## 1 1.0000000 NA NA
## 0 0.7435897 0.4477843 1.234804
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## 1 NA NA NA
## 0 0.2812036 0.278394 0.2691643
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
library(epitools)
riskratio(ds$comorbidade, ds$wsct )
## $data
## Outcome
## Predictor 0 1 Total
## 0 64 35 99
## 1 14 7 21
## Total 78 42 120
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## 0 1.0000000 NA NA
## 1 0.9428571 0.486872 1.8259
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## 0 NA NA NA
## 1 0.876436 1 0.860062
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"
library(epitools)
riskratio(ds$usa_medicamentos, ds$wsct)
## $data
## Outcome
## Predictor 0 1 Total
## 0 43 18 61
## 1 35 24 59
## Total 78 42 120
##
## $measure
## risk ratio with 95% C.I.
## Predictor estimate lower upper
## 0 1.000000 NA NA
## 1 1.378531 0.840002 2.262314
##
## $p.value
## two-sided
## Predictor midp.exact fisher.exact chi.square
## 0 NA NA NA
## 1 0.2076912 0.2514097 0.199671
##
## $correction
## [1] FALSE
##
## attr(,"method")
## [1] "Unconditional MLE & normal approximation (Wald) CI"