db <- read_excel(here::here("data-raw/Dati per statistica FL.xlsx")) |>
janitor::clean_names() |>
mutate(across(c(group_1_covid_2_transplant_3_donatore,
sex_1_m_2_f,
status_vivo_1_morto_0,
ecmo_y_1_n_2,
comorbidities_1_y_1_n_0,
fibrin_y_1_n_2:fungal_infections_y_1_n_2), as.factor))
# dataReporter::makeDataReport(db,codebook = TRUE)
• Vi sono differenze di infezioni tra i tre gruppi ?
Ho creato una nuova varaibile che si chiama inf_score
che assume i valore 1
se c’è almeno una infezione, e
2
o 3
se ce ne sono più di una. Ovviamente
0
se non ce ne sono in quel paziente.
db_inf <- db |> select(group_1_covid_2_transplant_3_donatore,
bacterial_infections_y_1_n_2,
viral_infections_y_1_n_2,
fungal_infections_y_1_n_2) |>
mutate(group_1_covid_2_transplant_3_donatore = case_when(
group_1_covid_2_transplant_3_donatore == 1 ~ 'COVID',
group_1_covid_2_transplant_3_donatore == 2 ~ 'Transplant',
TRUE ~ 'Donor')) |>
mutate(inf_score = case_when(
bacterial_infections_y_1_n_2 == 1 & viral_infections_y_1_n_2 == 1 & fungal_infections_y_1_n_2 == 1 ~ 3,
bacterial_infections_y_1_n_2 == 1 & viral_infections_y_1_n_2 == 1 ~ 2,
bacterial_infections_y_1_n_2 == 1 & fungal_infections_y_1_n_2 == 1 ~ 2,
viral_infections_y_1_n_2 == 1 & fungal_infections_y_1_n_2 == 1 ~ 2,
bacterial_infections_y_1_n_2 == 1 ~ 1,
viral_infections_y_1_n_2 == 1 ~ 1,
fungal_infections_y_1_n_2 == 1 ~ 1,
TRUE ~ 0
))
t0 <- db_inf |>
tbl_summary(by = group_1_covid_2_transplant_3_donatore)
t1 <- db_inf |>
filter(group_1_covid_2_transplant_3_donatore %in% c("COVID", "Transplant")) |>
tbl_summary(by = group_1_covid_2_transplant_3_donatore) |>
add_p() |>
modify_header(p.value ~ gt::md("**COVID vs. Transplant**")) |>
# hide summary stat columns
modify_table_styling(all_stat_cols(), hide = TRUE)
t2 <- db_inf |>
filter(group_1_covid_2_transplant_3_donatore %in% c("COVID", "Donor")) |>
tbl_summary(by = group_1_covid_2_transplant_3_donatore) |>
add_p() |>
modify_header(p.value ~ gt::md("**COVID vs. Donor**")) |>
# hide summary stat columns
modify_table_styling(all_stat_cols(), hide = TRUE)
t3 <- db_inf |>
filter(group_1_covid_2_transplant_3_donatore %in% c("Transplant", "Donor")) |>
tbl_summary(by = group_1_covid_2_transplant_3_donatore) |>
add_p() |>
modify_header(p.value ~ gt::md("**Transplant vs. Donor**")) |>
# hide summary stat columns
modify_table_styling(all_stat_cols(), hide = TRUE)
t_merge <- tbl_merge(list(t0, t1, t2, t3)) %>%
modify_spanning_header(
list(
all_stat_cols() ~ "**Groups**",
starts_with("p.value") ~ "**P-values**")
)
t_merge
Characteristic | Groups | P-values | ||||
---|---|---|---|---|---|---|
COVID, N = 161 | Donor, N = 121 | Transplant, N = 121 | COVID vs. Transplant2 | COVID vs. Donor2 | Transplant vs. Donor2 | |
bacterial_infections_y_1_n_2 | 0.7 | 0.053 | 0.037 | |||
1 | 5 (31%) | 0 (0%) | 5 (42%) | |||
2 | 11 (69%) | 12 (100%) | 7 (58%) | |||
viral_infections_y_1_n_2 | 0.7 | 0.053 | 0.037 | |||
1 | 5 (31%) | 0 (0%) | 5 (42%) | |||
2 | 11 (69%) | 12 (100%) | 7 (58%) | |||
fungal_infections_y_1_n_2 | 0.053 | 0.053 | >0.9 | |||
1 | 5 (31%) | 0 (0%) | 0 (0%) | |||
2 | 11 (69%) | 12 (100%) | 12 (100%) | |||
inf_score | >0.9 | <0.001 | <0.001 | |||
0 | 5 (31%) | 12 (100%) | 3 (25%) | |||
1 | 8 (50%) | 0 (0%) | 8 (67%) | |||
2 | 2 (12%) | 0 (0%) | 1 (8.3%) | |||
3 | 1 (6.2%) | 0 (0%) | 0 (0%) | |||
1 n (%) | ||||||
2 Fisher's exact test |
• L’associaz con gli i ag infettivi era maggiormente presente in paz COVID con lunga data di malattia
Associazione di infezioni (si/no) con durata della malattia, i.e. gli infetti sono hanno ICU LOS o H LOS più lunghe?
• La maggiore neutrofilia nei COVID era correlata con le infezioni o era presente a prescindere ?
db_los <- db |> select(
icu_los,
h_los,
bacterial_infections_y_1_n_2,
viral_infections_y_1_n_2,
fungal_infections_y_1_n_2,
group_1_covid_2_transplant_3_donatore,
neutrophilic_granulocytes_percent
) |>
mutate(across(c(bacterial_infections_y_1_n_2:fungal_infections_y_1_n_2), ~ifelse(.==1, 'Yes', 'No')))
tbl_summary(db_los |> select(icu_los,
h_los,
bacterial_infections_y_1_n_2,
group_1_covid_2_transplant_3_donatore,
neutrophilic_granulocytes_percent) |>
filter(group_1_covid_2_transplant_3_donatore == '1'),
by = bacterial_infections_y_1_n_2,
missing = 'no',
type = c(neutrophilic_granulocytes_percent) ~ 'continuous'
) |>
add_p() |>
modify_caption('**Bacterial**')
## Warning for variable 'icu_los':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'h_los':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'neutrophilic_granulocytes_percent':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
Characteristic | No, N = 111 | Yes, N = 51 | p-value2 |
---|---|---|---|
icu_los | 24 (16, 40) | 15 (15, 18) | 0.4 |
h_los | 33 (30, 60) | 30 (18, 60) | 0.5 |
group_1_covid_2_transplant_3_donatore | >0.9 | ||
1 | 11 (100%) | 5 (100%) | |
2 | 0 (0%) | 0 (0%) | |
3 | 0 (0%) | 0 (0%) | |
neutrophilic_granulocytes_percent | 60 (45, 85) | 50 (40, 90) | >0.9 |
1 Median (IQR); n (%) | |||
2 Wilcoxon rank sum test; Fisher's exact test |
tbl_summary(db_los |> select(icu_los,
h_los,
viral_infections_y_1_n_2,
group_1_covid_2_transplant_3_donatore,
neutrophilic_granulocytes_percent) |>
filter(group_1_covid_2_transplant_3_donatore == '1'),
by = viral_infections_y_1_n_2,
missing = 'no',
type = c(neutrophilic_granulocytes_percent) ~ 'continuous') |>
add_p() |>
modify_caption('**Viral**')
## Warning for variable 'icu_los':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'h_los':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'neutrophilic_granulocytes_percent':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
Characteristic | No, N = 111 | Yes, N = 51 | p-value2 |
---|---|---|---|
icu_los | 23 (12, 30) | 18 (18, 24) | 0.7 |
h_los | 30 (28, 60) | 33 (30, 41) | 0.8 |
group_1_covid_2_transplant_3_donatore | >0.9 | ||
1 | 11 (100%) | 5 (100%) | |
2 | 0 (0%) | 0 (0%) | |
3 | 0 (0%) | 0 (0%) | |
neutrophilic_granulocytes_percent | 50 (40, 85) | 60 (50, 90) | 0.6 |
1 Median (IQR); n (%) | |||
2 Wilcoxon rank sum test; Fisher's exact test |
tbl_summary(db_los |> select(icu_los,
h_los,
fungal_infections_y_1_n_2,
group_1_covid_2_transplant_3_donatore,
neutrophilic_granulocytes_percent) |>
filter(group_1_covid_2_transplant_3_donatore == '1'),
by = fungal_infections_y_1_n_2,
missing = 'no',
type = c(neutrophilic_granulocytes_percent) ~ 'continuous') |>
add_p() |>
modify_caption('**Fungal**')
## Warning for variable 'icu_los':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'h_los':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'neutrophilic_granulocytes_percent':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
Characteristic | No, N = 111 | Yes, N = 51 | p-value2 |
---|---|---|---|
icu_los | 18 (12, 24) | 28 (26, 53) | 0.079 |
h_los | 33 (22, 50) | 30 (30, 79) | 0.5 |
group_1_covid_2_transplant_3_donatore | >0.9 | ||
1 | 11 (100%) | 5 (100%) | |
2 | 0 (0%) | 0 (0%) | |
3 | 0 (0%) | 0 (0%) | |
neutrophilic_granulocytes_percent | 50 (40, 85) | 60 (50, 90) | 0.3 |
1 Median (IQR); n (%) | |||
2 Wilcoxon rank sum test; Fisher's exact test |
C’è una tendenza per le infezioni fungine, non per il resto.
• Vi sono differenze di cellularità (macrofagi, neutrofili, linfociti, fibrina, sangue e pneumociti reattivi tra i due gruppi (COVID vs IC controls) ?
db_cel <- db |> select(group_1_covid_2_transplant_3_donatore,
macrophages_percent:hyperplastic_pneumocytes_y_1_n_2) |>
filter(group_1_covid_2_transplant_3_donatore == 1 | group_1_covid_2_transplant_3_donatore == 2) |>
mutate(group_1_covid_2_transplant_3_donatore = case_when(
group_1_covid_2_transplant_3_donatore == 1 ~ 'COVID',
TRUE ~ 'Transplant')) |>
droplevels() # altrimenti tieni anche i donatori anche se non ci sono più
tbl_summary(db_cel, by = group_1_covid_2_transplant_3_donatore,
type = c(lymphocytes_percent) ~ 'continuous') |>
add_p()
## Warning for variable 'macrophages_percent':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'lymphocytes_percent':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'neutrophilic_granulocytes_percent':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
Characteristic | COVID, N = 161 | Transplant, N = 121 | p-value2 |
---|---|---|---|
macrophages_percent | 40 (10, 52) | 90 (90, 95) | <0.001 |
lymphocytes_percent | 0.0 (0.0, 0.0) | 6.5 (5.0, 10.0) | <0.001 |
neutrophilic_granulocytes_percent | 55 (40, 90) | 0 (0, 2) | <0.001 |
fibrin_y_1_n_2 | <0.001 | ||
1 | 16 (100%) | 0 (0%) | |
2 | 0 (0%) | 12 (100%) | |
eritrocytes_y_1_n_2 | <0.001 | ||
1 | 15 (94%) | 3 (25%) | |
2 | 1 (6.2%) | 9 (75%) | |
hyperplastic_pneumocytes_y_1_n_2 | 0.001 | ||
1 | 14 (88%) | 3 (25%) | |
2 | 2 (12%) | 9 (75%) | |
1 Median (IQR); n (%) | |||
2 Wilcoxon rank sum test; Pearson's Chi-squared test; Fisher's exact test |
E’ tutto differente
tbl_summary(db |> select(group_1_covid_2_transplant_3_donatore,
ifna1_delta_ct:tnf_delta_ct
),
by = group_1_covid_2_transplant_3_donatore,
type = everything() ~ "continuous") |>
add_p()
Characteristic | 1, N = 161 | 2, N = 121 | 3, N = 121 | p-value2 |
---|---|---|---|---|
ifna1_delta_ct | 7 (6, 8) | 9 (7, 11) | 7 (6, 7) | 0.065 |
ifna16_delta_ct | 12 (10, 30) | 30 (26, 30) | 11 (11, 30) | 0.2 |
ifna17_delta_ct | 8.7 (7.9, 10.6) | 9.4 (8.4, 10.6) | 8.2 (7.4, 9.0) | 0.13 |
ifna2_delta_ct | 9 (8, 10) | 9 (9, 11) | 8 (8, 9) | 0.2 |
ifna6_delta_ct | 7.7 (7.0, 9.0) | 8.2 (7.4, 9.2) | 7.0 (6.6, 7.5) | 0.2 |
ifna7_delta_ct | 7.21 (6.86, 9.03) | 9.35 (8.14, 10.00) | 7.19 (6.89, 7.82) | 0.024 |
ifna8_delta_ct | 9 (8, 10) | 9 (8, 10) | 8 (7, 8) | 0.038 |
ifnb1_delta_ct | 8 (8, 10) | 8 (8, 10) | 8 (7, 9) | 0.3 |
ifng_delta_ct | 30 (30, 30) | 30 (-11, 30) | 30 (30, 30) | 0.041 |
il10_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (26, 30) | 0.2 |
il12a_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (30, 30) | 0.7 |
il12b_delta_ct | 30 (21, 30) | 30 (30, 30) | 30 (30, 30) | 0.4 |
il13_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (30, 30) | 0.094 |
il15_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (30, 30) | >0.9 |
il16_delta_ct | 30 (30, 30) | 22 (12, 30) | 30 (30, 30) | 0.3 |
il17a_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (30, 30) | 0.3 |
il18_delta_ct | 30 (30, 30) | 30 (26, 30) | 30 (30, 30) | 0.2 |
il1a_delta_ct | 30 (25, 30) | 30 (12, 30) | 30 (30, 30) | 0.068 |
il1b_delta_ct | 10 (8, 30) | 12 (11, 30) | 30 (30, 30) | 0.005 |
il2_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (30, 30) | 0.5 |
il3_delta_ct | 30.0000 (30.0000, 30.0000) | 30.0000 (30.0000, 30.0000) | 30.0000 (30.0000, 30.0000) | 0.5 |
il4_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (30, 30) | 0.2 |
il5_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (30, 30) | 0.7 |
il6_delta_ct | 30 (25, 30) | 30 (26, 30) | 30 (10, 30) | 0.6 |
il8_delta_ct | 21 (8, 30) | 12 (10, 30) | 30 (13, 30) | 0.3 |
il9_delta_ct | 12 (10, 30) | 30 (30, 30) | 30 (14, 30) | 0.014 |
lta_delta_ct | 30 (30, 30) | 30 (30, 30) | 30 (30, 30) | 0.3 |
tnf_delta_ct | 30 (16, 30) | 30 (11, 30) | 30 (30, 30) | 0.2 |
1 Median (IQR) | ||||
2 Kruskal-Wallis rank sum test |
IFNA1 e IL1A non sono più significative (lo erano senza gli ultimi 4 aggiunti). Metto lo stesso i grafici
# graphs of significants --------------------------------------------------
out <- c('ifna1_delta_ct', 'ifna7_delta_ct', 'ifna8_delta_ct', 'ifng_delta_ct', 'il1a_delta_ct', 'il1b_delta_ct', 'il9_delta_ct')
graphs<- function(out){
ggbetweenstats(
data = db,
x = group_1_covid_2_transplant_3_donatore,
y = {{out}},
type = 'np',
title = paste0(out)
)
}
map(out, graphs)
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
L’associazione più interessante sembre sia con IL9, che è completamente diversa nei COVID e quindi sembra “tipica” della malattia
• (solo COVID) Le citochine alterate erano maggiormente o meno alterate nei pazienti COVID con agenti infettivi ( eventualmente differenziando per agente microbico)
db_cito <- db |> select(
bacterial_infections_y_1_n_2,
viral_infections_y_1_n_2,
fungal_infections_y_1_n_2,
group_1_covid_2_transplant_3_donatore,
ifna1_delta_ct,
ifna7_delta_ct,
ifna8_delta_ct,
ifng_delta_ct,
il1a_delta_ct,
il1b_delta_ct,
il9_delta_ct,
bmi,
age_years
) |>
mutate(across(c(bacterial_infections_y_1_n_2:fungal_infections_y_1_n_2), ~ifelse(.==1, 'Yes', 'No')))
tbl_summary(db_cito |> select(-viral_infections_y_1_n_2, -fungal_infections_y_1_n_2) |>
filter(group_1_covid_2_transplant_3_donatore == '1'),
by = bacterial_infections_y_1_n_2,
missing = 'no',
type = c(ifng_delta_ct, il1a_delta_ct) ~ 'continuous'
) |>
add_p() |>
modify_caption('**Bacterial**')
## Warning for variable 'ifna1_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifna7_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifna8_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifng_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il1a_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il1b_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il9_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'age_years':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
Characteristic | No, N = 111 | Yes, N = 51 | p-value2 |
---|---|---|---|
group_1_covid_2_transplant_3_donatore | >0.9 | ||
1 | 11 (100%) | 5 (100%) | |
2 | 0 (0%) | 0 (0%) | |
3 | 0 (0%) | 0 (0%) | |
ifna1_delta_ct | 7 (6, 8) | 7 (5, 7) | 0.6 |
ifna7_delta_ct | 7 (7, 9) | 7 (7, 7) | 0.5 |
ifna8_delta_ct | 9 (8, 10) | 8 (8, 8) | 0.11 |
ifng_delta_ct | 30.0 (30.0, 30.0) | 30.0 (30.0, 30.0) | 0.2 |
il1a_delta_ct | 30 (30, 30) | 30 (8, 30) | 0.3 |
il1b_delta_ct | 10 (9, 30) | 7 (6, 30) | 0.5 |
il9_delta_ct | 11 (9, 23) | 14 (13, 30) | 0.2 |
bmi | 29 (26, 36) | 38 (32, 40) | 0.4 |
age_years | 61 (57, 70) | 50 (46, 73) | 0.4 |
1 n (%); Median (IQR) | |||
2 Fisher's exact test; Wilcoxon rank sum test; Wilcoxon rank sum exact test |
tbl_summary(db_cito |> select(-bacterial_infections_y_1_n_2, -fungal_infections_y_1_n_2) |>
filter(group_1_covid_2_transplant_3_donatore == '1'),
by = viral_infections_y_1_n_2,
missing = 'no',
type = c(ifng_delta_ct, il1a_delta_ct) ~ 'continuous'
) |>
add_p() |>
modify_caption('**Viral**')
## Warning for variable 'ifna1_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifna7_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifna8_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifng_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il1a_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il1b_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il9_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'age_years':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
Characteristic | No, N = 111 | Yes, N = 51 | p-value2 |
---|---|---|---|
group_1_covid_2_transplant_3_donatore | >0.9 | ||
1 | 11 (100%) | 5 (100%) | |
2 | 0 (0%) | 0 (0%) | |
3 | 0 (0%) | 0 (0%) | |
ifna1_delta_ct | 7 (6, 19) | 7 (6, 7) | 0.5 |
ifna7_delta_ct | 7 (7, 9) | 7 (7, 7) | >0.9 |
ifna8_delta_ct | 9 (8, 20) | 8 (8, 8) | 0.4 |
ifng_delta_ct | 30.0 (30.0, 30.0) | 30.0 (30.0, 30.0) | 0.6 |
il1a_delta_ct | 30 (9, 30) | 30 (30, 30) | 0.2 |
il1b_delta_ct | 9 (7, 22) | 30 (10, 30) | 0.15 |
il9_delta_ct | 15 (10, 30) | 11 (11, 13) | 0.6 |
bmi | 30 (28, 35) | 40 (25, 50) | 0.7 |
age_years | 60 (51, 73) | 61 (60, 64) | >0.9 |
1 n (%); Median (IQR) | |||
2 Fisher's exact test; Wilcoxon rank sum test; Wilcoxon rank sum exact test |
tbl_summary(db_cito |> select(-viral_infections_y_1_n_2, -bacterial_infections_y_1_n_2) |>
filter(group_1_covid_2_transplant_3_donatore == '1'),
by = fungal_infections_y_1_n_2,
missing = 'no',
type = c(ifng_delta_ct, il1a_delta_ct) ~ 'continuous'
) |>
add_p() |>
modify_caption('**Fungal**')
## Warning for variable 'ifna1_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifna7_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifna8_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'ifng_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il1a_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il1b_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'il9_delta_ct':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
## Warning for variable 'age_years':
## simpleWarning in wilcox.test.default(x = DATA[[1L]], y = DATA[[2L]], ...): cannot compute exact p-value with ties
Characteristic | No, N = 111 | Yes, N = 51 | p-value2 |
---|---|---|---|
group_1_covid_2_transplant_3_donatore | >0.9 | ||
1 | 11 (100%) | 5 (100%) | |
2 | 0 (0%) | 0 (0%) | |
3 | 0 (0%) | 0 (0%) | |
ifna1_delta_ct | 7 (6, 19) | 6 (5, 7) | 0.2 |
ifna7_delta_ct | 7 (7, 9) | 7 (7, 8) | 0.8 |
ifna8_delta_ct | 8 (8, 20) | 9 (8, 9) | 0.6 |
ifng_delta_ct | 30.0 (30.0, 30.0) | 30.0 (30.0, 30.0) | 0.6 |
il1a_delta_ct | 30 (20, 30) | 30 (30, 30) | 0.9 |
il1b_delta_ct | 10 (7, 30) | 15 (10, 30) | 0.5 |
il9_delta_ct | 13 (10, 30) | 11 (8, 14) | 0.3 |
bmi | 30 (27, 39) | 31 (27, 50) | 0.5 |
age_years | 64 (53, 73) | 60 (45, 60) | 0.14 |
1 n (%); Median (IQR) | |||
2 Fisher's exact test; Wilcoxon rank sum test; Wilcoxon rank sum exact test |
No, nessuna differenza di espressione delle citochine in infetti e non (gruppo COVID)
• Relativamente ai pazienti COVID: Quale fattore era maggiormente predittivo di cattiva outcome: partern citochinico; coinfezioni ? caratteristiche del paz , pattern di citologiase puo applicare qualche algoritmo di machine learning sarebbe carino )
Gli outcome sono: Mortalità Long stay ICU Utilizzo di ECMO Ospedalizzazione
db_boruta <- db |> filter(group_1_covid_2_transplant_3_donatore ==1) |>
droplevels() |>
select(sex_1_m_2_f,
age_years,
bmi,
comorbidities_1_y_1_n_0:tnf_delta_ct,
status_vivo_1_morto_0,
icu_los,
h_los,
ecmo_y_1_n_2)
# Boruta non vuole missing, li imputo sempre con RF
db_imp <- randomForestSRC::impute(data = as.data.frame(db_boruta))
# seed <- c(1, 23, 3011, 12345, 654321) #ne laascio solo uno perché sono consistenti
seed <- c(1, 23, 3011, 12345, 654321)
# creo una funzione per far girare boruta in automatico con tutti i seed
boruta_fun <- function(seed){
set.seed(seed)
boruta.lungs_train <- Boruta(status_vivo_1_morto_0 ~ . ,
maxRuns = 1000, # aumento il numero per includere le variabili escluse
data = db_imp |> select(-icu_los, -h_los, -ecmo_y_1_n_2))
print(boruta.lungs_train)
boruta.lungs <- TentativeRoughFix(boruta.lungs_train)
print(boruta.lungs)
plot <- plot(boruta.lungs, xlab = "", las = 3, cex.axis = 0.8,
whichShadow = c(FALSE, FALSE, FALSE),
pars = par(mar = c(9.5,4,2,1)))
lungs_df <- attStats(boruta.lungs) %>%
relocate(decision) %>%
dplyr::select(-normHits) %>% # così ci sta nella pagina
arrange(decision, desc(meanImp))
return(list(lungs_df, plot))
}
boruta_res <- map(seed, ~ boruta_fun(.x))
## Boruta performed 999 iterations in 30.05836 secs.
## 1 attributes confirmed important: age_years;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## 1 tentative attributes left: tnf_delta_ct;
## Boruta performed 999 iterations in 30.05836 secs.
## Tentatives roughfixed over the last 999 iterations.
## 1 attributes confirmed important: age_years;
## 42 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 37 more;
## Boruta performed 999 iterations in 20.48649 secs.
## 1 attributes confirmed important: age_years;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## 1 tentative attributes left: tnf_delta_ct;
## Boruta performed 999 iterations in 20.48649 secs.
## Tentatives roughfixed over the last 999 iterations.
## 1 attributes confirmed important: age_years;
## 42 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 37 more;
## Boruta performed 112 iterations in 2.664259 secs.
## 1 attributes confirmed important: age_years;
## 42 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 37 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 112 iterations in 2.664259 secs.
## 1 attributes confirmed important: age_years;
## 42 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 37 more;
## Boruta performed 999 iterations in 19.84405 secs.
## 1 attributes confirmed important: age_years;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## 1 tentative attributes left: tnf_delta_ct;
## Boruta performed 999 iterations in 19.84405 secs.
## Tentatives roughfixed over the last 999 iterations.
## 1 attributes confirmed important: age_years;
## 42 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 37 more;
## Boruta performed 162 iterations in 2.45484 secs.
## 1 attributes confirmed important: age_years;
## 42 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 37 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 162 iterations in 2.45484 secs.
## 1 attributes confirmed important: age_years;
## 42 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 37 more;
# extract the results table in the 'boruta_res' object
extraction <- function(x) {
ext <- boruta_res[[x]][[1]] %>%
rownames_to_column(var ='variable') %>%
select(variable, decision, meanImp) %>%
filter(decision == 'Confirmed')
return(ext)
}
extracted_res <- map(1:5, ~extraction(.x))
# create a dataframe of the common boruta results in all the three results lists
boruta_final <- function(extracted_res){
extraction_merged <- inner_join(extracted_res[[1]], extracted_res[[2]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_merged_2 <- inner_join(extraction_merged, extracted_res[[3]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_merged_3 <- inner_join(extraction_merged_2, extracted_res[[4]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_final <- inner_join(extraction_merged_3, extracted_res[[5]],
by = 'variable') %>%
select(-starts_with('decision'))
return(extraction_final)
}
# pretty table with the results
boruta_final(extracted_res) |>
gt() |>
cols_label(
variable = md('__Variable__'),
meanImp.x = md('__MeanImp 1__'),
meanImp.y = md('__MeanImp 2__'),
meanImp.x.x = md('__MeanImp 3__'),
meanImp.y.y = md('__MeanImp 4__'),
meanImp = md('__MeanImp 5__')
) |>
tab_header(
title = md("**Common important variables**"), #use md() to specify rmkdn formatting
subtitle = md(glue::glue("_Boruta iteration on 5 seeds_"))
)
Common important variables | |||||
---|---|---|---|---|---|
Boruta iteration on 5 seeds | |||||
Variable | MeanImp 1 | MeanImp 2 | MeanImp 3 | MeanImp 4 | MeanImp 5 |
age_years | 4.894423 | 4.984158 | 4.952032 | 4.911679 | 4.797455 |
# creo una funzione per far girare boruta in automatico con tutti i seed
boruta_fun <- function(seed){
set.seed(seed)
boruta.lungs_train <- Boruta(icu_los~ . ,
maxRuns = 1000, # aumento il numero per includere le variabili escluse
data = db_imp |> select(-status_vivo_1_morto_0, -h_los, -ecmo_y_1_n_2))
print(boruta.lungs_train)
boruta.lungs <- TentativeRoughFix(boruta.lungs_train)
print(boruta.lungs)
plot <- plot(boruta.lungs, xlab = "", las = 3, cex.axis = 0.8,
whichShadow = c(FALSE, FALSE, FALSE),
pars = par(mar = c(9.5,4,2,1)))
lungs_df <- attStats(boruta.lungs) %>%
relocate(decision) %>%
dplyr::select(-normHits) %>% # così ci sta nella pagina
arrange(decision, desc(meanImp))
return(list(lungs_df, plot))
}
boruta_res <- map(seed, ~ boruta_fun(.x))
## Boruta performed 13 iterations in 0.2984929 secs.
## No attributes deemed important.
## 43 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, comorbidities_1_y_1_n_0,
## eritrocytes_y_1_n_2 and 38 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 13 iterations in 0.2984929 secs.
## No attributes deemed important.
## 43 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, comorbidities_1_y_1_n_0,
## eritrocytes_y_1_n_2 and 38 more;
## Boruta performed 13 iterations in 0.2749541 secs.
## No attributes deemed important.
## 43 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, comorbidities_1_y_1_n_0,
## eritrocytes_y_1_n_2 and 38 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 13 iterations in 0.2749541 secs.
## No attributes deemed important.
## 43 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, comorbidities_1_y_1_n_0,
## eritrocytes_y_1_n_2 and 38 more;
## Boruta performed 187 iterations in 2.709885 secs.
## 2 attributes confirmed important: comorbidities_1_y_1_n_0,
## il18_delta_ct;
## 41 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, eritrocytes_y_1_n_2, fibrin_y_1_n_2
## and 36 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 187 iterations in 2.709885 secs.
## 2 attributes confirmed important: comorbidities_1_y_1_n_0,
## il18_delta_ct;
## 41 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, eritrocytes_y_1_n_2, fibrin_y_1_n_2
## and 36 more;
## Boruta performed 13 iterations in 0.2905951 secs.
## No attributes deemed important.
## 43 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, comorbidities_1_y_1_n_0,
## eritrocytes_y_1_n_2 and 38 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 13 iterations in 0.2905951 secs.
## No attributes deemed important.
## 43 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, comorbidities_1_y_1_n_0,
## eritrocytes_y_1_n_2 and 38 more;
## Boruta performed 13 iterations in 0.2342601 secs.
## No attributes deemed important.
## 43 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, comorbidities_1_y_1_n_0,
## eritrocytes_y_1_n_2 and 38 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 13 iterations in 0.2342601 secs.
## No attributes deemed important.
## 43 attributes confirmed unimportant: age_years,
## bacterial_infections_y_1_n_2, bmi, comorbidities_1_y_1_n_0,
## eritrocytes_y_1_n_2 and 38 more;
# extract the results table in the 'boruta_res' object
extraction <- function(x) {
ext <- boruta_res[[x]][[1]] %>%
rownames_to_column(var ='variable') %>%
select(variable, decision, meanImp) %>%
filter(decision == 'Confirmed')
return(ext)
}
extracted_res <- map(1:5, ~extraction(.x))
# create a dataframe of the common boruta results in all the three results lists
boruta_final <- function(extracted_res){
extraction_merged <- inner_join(extracted_res[[1]], extracted_res[[2]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_merged_2 <- inner_join(extraction_merged, extracted_res[[3]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_merged_3 <- inner_join(extraction_merged_2, extracted_res[[4]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_final <- inner_join(extraction_merged_3, extracted_res[[5]],
by = 'variable') %>%
select(-starts_with('decision'))
return(extraction_final)
}
# pretty table with the results
boruta_final(extracted_res) |>
gt() |>
cols_label(
variable = md('__Variable__'),
meanImp.x = md('__MeanImp 1__'),
meanImp.y = md('__MeanImp 2__'),
meanImp.x.x = md('__MeanImp 3__'),
meanImp.y.y = md('__MeanImp 4__'),
meanImp = md('__MeanImp 5__')
) |>
tab_header(
title = md("**Common important variables**"), #use md() to specify rmkdn formatting
subtitle = md(glue::glue("_Boruta iteration on 5 seeds_"))
)
Common important variables | |||||
---|---|---|---|---|---|
Boruta iteration on 5 seeds | |||||
Variable | MeanImp 1 | MeanImp 2 | MeanImp 3 | MeanImp 4 | MeanImp 5 |
# creo una funzione per far girare boruta in automatico con tutti i seed
boruta_fun <- function(seed){
set.seed(seed)
boruta.lungs_train <- Boruta(h_los~ . ,
maxRuns = 1000, # aumento il numero per includere le variabili escluse
data = db_imp |> select(-status_vivo_1_morto_0, -icu_los, -ecmo_y_1_n_2))
print(boruta.lungs_train)
boruta.lungs <- TentativeRoughFix(boruta.lungs_train)
print(boruta.lungs)
plot <- plot(boruta.lungs, xlab = "", las = 3, cex.axis = 0.8,
whichShadow = c(FALSE, FALSE, FALSE),
pars = par(mar = c(9.5,4,2,1)))
lungs_df <- attStats(boruta.lungs) %>%
relocate(decision) %>%
dplyr::select(-normHits) %>% # così ci sta nella pagina
arrange(decision, desc(meanImp))
return(list(lungs_df, plot))
}
boruta_res <- map(seed, ~ boruta_fun(.x))
## Warning in addShadowsAndGetImp(decReg, runs): getImp result contains NA(s) or
## NaN(s); replacing with 0(s), yet this is suspicious.
## Boruta performed 355 iterations in 5.093733 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 355 iterations in 5.093733 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Boruta performed 445 iterations in 10.39789 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 445 iterations in 10.39789 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Boruta performed 78 iterations in 1.214906 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 78 iterations in 1.214906 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Boruta performed 320 iterations in 5.964861 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 320 iterations in 5.964861 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Boruta performed 434 iterations in 7.018322 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 434 iterations in 7.018322 secs.
## 2 attributes confirmed important: age_years, il18_delta_ct;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
# extract the results table in the 'boruta_res' object
extraction <- function(x) {
ext <- boruta_res[[x]][[1]] %>%
rownames_to_column(var ='variable') %>%
select(variable, decision, meanImp) %>%
filter(decision == 'Confirmed')
return(ext)
}
extracted_res <- map(1:5, ~extraction(.x))
# create a dataframe of the common boruta results in all the three results lists
boruta_final <- function(extracted_res){
extraction_merged <- inner_join(extracted_res[[1]], extracted_res[[2]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_merged_2 <- inner_join(extraction_merged, extracted_res[[3]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_merged_3 <- inner_join(extraction_merged_2, extracted_res[[4]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_final <- inner_join(extraction_merged_3, extracted_res[[5]],
by = 'variable') %>%
select(-starts_with('decision'))
return(extraction_final)
}
# pretty table with the results
boruta_final(extracted_res) |>
gt() |>
cols_label(
variable = md('__Variable__'),
meanImp.x = md('__MeanImp 1__'),
meanImp.y = md('__MeanImp 2__'),
meanImp.x.x = md('__MeanImp 3__'),
meanImp.y.y = md('__MeanImp 4__'),
meanImp = md('__MeanImp 5__')
) |>
tab_header(
title = md("**Common important variables**"), #use md() to specify rmkdn formatting
subtitle = md(glue::glue("_Boruta iteration on 5 seeds_"))
)
Common important variables | |||||
---|---|---|---|---|---|
Boruta iteration on 5 seeds | |||||
Variable | MeanImp 1 | MeanImp 2 | MeanImp 3 | MeanImp 4 | MeanImp 5 |
il18_delta_ct | 5.208267 | 5.343406 | 4.804936 | 5.214985 | 5.238157 |
age_years | 3.677935 | 3.949990 | 3.975347 | 4.122035 | 3.745468 |
Non mi convince molto
cor.test(db_boruta$h_los, db_boruta$il18_delta_ct, method = "spearman")
## Warning in cor.test.default(db_boruta$h_los, db_boruta$il18_delta_ct, method =
## "spearman"): Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: db_boruta$h_los and db_boruta$il18_delta_ct
## S = 212.65, p-value = 0.003264
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.6872749
b <- ggplot(db_boruta, aes(x = h_los, y = il18_delta_ct)) #initiate plot
b + geom_point(aes(color = il18_delta_ct), size = 4) +
geom_smooth(method = lm) +
scale_color_gradientn(colors = c("#00AFBB", "#E7B800", "#FC4E07")) +
theme(legend.position = "right") +
theme_classic(base_size = 15) +
xlab(' Hospital Stay (days)') +
ylab('IL-18 expression (ΔCt)') +
theme(legend.title = element_blank()) +
geom_text(x=90, y=0, label="Rho = 0.68") +
geom_text(aes(fontface = 3), x=90, y=-5, label="p = ") +
geom_text(x=95, y=-5, label="0.003")
## `geom_smooth()` using formula 'y ~ x'
# creo una funzione per far girare boruta in automatico con tutti i seed
boruta_fun <- function(seed){
set.seed(seed)
boruta.lungs_train <- Boruta(ecmo_y_1_n_2~ . ,
maxRuns = 1000, # aumento il numero per includere le variabili escluse
data = db_imp |> select(-status_vivo_1_morto_0, -h_los, -icu_los))
print(boruta.lungs_train)
boruta.lungs <- TentativeRoughFix(boruta.lungs_train)
print(boruta.lungs)
plot <- plot(boruta.lungs, xlab = "", las = 3, cex.axis = 0.8,
whichShadow = c(FALSE, FALSE, FALSE),
pars = par(mar = c(9.5,4,2,1)))
lungs_df <- attStats(boruta.lungs) %>%
relocate(decision) %>%
dplyr::select(-normHits) %>% # così ci sta nella pagina
arrange(decision, desc(meanImp))
return(list(lungs_df, plot))
}
boruta_res <- map(seed, ~ boruta_fun(.x))
## Warning in addShadowsAndGetImp(decReg, runs): getImp result contains NA(s) or
## NaN(s); replacing with 0(s), yet this is suspicious.
## Boruta performed 999 iterations in 16.29534 secs.
## 2 attributes confirmed important: age_years,
## neutrophilic_granulocytes_percent;
## 40 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 35 more;
## 1 tentative attributes left: ifnb1_delta_ct;
## Boruta performed 999 iterations in 16.29534 secs.
## Tentatives roughfixed over the last 999 iterations.
## 2 attributes confirmed important: age_years,
## neutrophilic_granulocytes_percent;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Boruta performed 340 iterations in 5.995959 secs.
## 3 attributes confirmed important: age_years,
## neutrophilic_granulocytes_percent, tnf_delta_ct;
## 40 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 35 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 340 iterations in 5.995959 secs.
## 3 attributes confirmed important: age_years,
## neutrophilic_granulocytes_percent, tnf_delta_ct;
## 40 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 35 more;
## Boruta performed 999 iterations in 15.96097 secs.
## 2 attributes confirmed important: age_years,
## neutrophilic_granulocytes_percent;
## 40 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 35 more;
## 1 tentative attributes left: ifnb1_delta_ct;
## Boruta performed 999 iterations in 15.96097 secs.
## Tentatives roughfixed over the last 999 iterations.
## 2 attributes confirmed important: age_years,
## neutrophilic_granulocytes_percent;
## 41 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 36 more;
## Boruta performed 246 iterations in 4.002913 secs.
## 4 attributes confirmed important: age_years, ifnb1_delta_ct,
## neutrophilic_granulocytes_percent, tnf_delta_ct;
## 39 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 34 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 246 iterations in 4.002913 secs.
## 4 attributes confirmed important: age_years, ifnb1_delta_ct,
## neutrophilic_granulocytes_percent, tnf_delta_ct;
## 39 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 34 more;
## Boruta performed 212 iterations in 3.08289 secs.
## 3 attributes confirmed important: age_years,
## neutrophilic_granulocytes_percent, tnf_delta_ct;
## 40 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 35 more;
## Warning in TentativeRoughFix(boruta.lungs_train): There are no Tentative
## attributes! Returning original object.
## Boruta performed 212 iterations in 3.08289 secs.
## 3 attributes confirmed important: age_years,
## neutrophilic_granulocytes_percent, tnf_delta_ct;
## 40 attributes confirmed unimportant: bacterial_infections_y_1_n_2,
## bmi, comorbidities_1_y_1_n_0, eritrocytes_y_1_n_2, fibrin_y_1_n_2 and
## 35 more;
# extract the results table in the 'boruta_res' object
extraction <- function(x) {
ext <- boruta_res[[x]][[1]] %>%
rownames_to_column(var ='variable') %>%
select(variable, decision, meanImp) %>%
filter(decision == 'Confirmed')
return(ext)
}
extracted_res <- map(1:5, ~extraction(.x))
# create a dataframe of the common boruta results in all the three results lists
boruta_final <- function(extracted_res){
extraction_merged <- inner_join(extracted_res[[1]], extracted_res[[2]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_merged_2 <- inner_join(extraction_merged, extracted_res[[3]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_merged_3 <- inner_join(extraction_merged_2, extracted_res[[4]],
by = 'variable') %>%
select(-starts_with('decision'))
extraction_final <- inner_join(extraction_merged_3, extracted_res[[5]],
by = 'variable') %>%
select(-starts_with('decision'))
return(extraction_final)
}
# pretty table with the results
boruta_final(extracted_res) |>
gt() |>
cols_label(
variable = md('__Variable__'),
meanImp.x = md('__MeanImp 1__'),
meanImp.y = md('__MeanImp 2__'),
meanImp.x.x = md('__MeanImp 3__'),
meanImp.y.y = md('__MeanImp 4__'),
meanImp = md('__MeanImp 5__')
) |>
tab_header(
title = md("**Common important variables**"), #use md() to specify rmkdn formatting
subtitle = md(glue::glue("_Boruta iteration on 5 seeds_"))
)
Common important variables | |||||
---|---|---|---|---|---|
Boruta iteration on 5 seeds | |||||
Variable | MeanImp 1 | MeanImp 2 | MeanImp 3 | MeanImp 4 | MeanImp 5 |
neutrophilic_granulocytes_percent | 6.764996 | 7.458533 | 6.814973 | 7.151645 | 7.540191 |
age_years | 2.974455 | 4.404362 | 3.098043 | 4.204640 | 4.409143 |
Non mi convince molto neanche questo
ggbetweenstats(
data = db_boruta,
x = ecmo_y_1_n_2,
y = neutrophilic_granulocytes_percent,
type = 'np'
)
Non ho messo nessun aggiustamento per molteplicità (visto che non lo abbiamo messo neanche prima)
db_cor <- db |>
filter(group_1_covid_2_transplant_3_donatore == '1') |>
select(age_years, bmi, icu_los, h_los,
ifna1_delta_ct, ifna7_delta_ct, ifna8_delta_ct, ifng_delta_ct, il1a_delta_ct, il1b_delta_ct, il9_delta_ct, il18_delta_ct,
neutrophilic_granulocytes_percent)
ggcorrmat(db_cor,
type = 'np',
p.adjust.method = 'none')
Dai plot non sembra niente di allarmante, le correlazioni sembrano più dovute al caso che a qualche effetto biologico
cor.test(db_cor$age_years, db_cor$il18_delta_ct, method = "spearman")
## Warning in cor.test.default(db_cor$age_years, db_cor$il18_delta_ct, method =
## "spearman"): Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: db_cor$age_years and db_cor$il18_delta_ct
## S = 1045.1, p-value = 0.03197
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## -0.5369777
b <- ggplot(db_cor, aes(x = age_years, y = il18_delta_ct)) #initiate plot
b + geom_point(aes(color = il18_delta_ct), size = 4) +
geom_smooth(method = lm) +
scale_color_gradientn(colors = c("#00AFBB", "#E7B800", "#FC4E07")) +
theme(legend.position = "right") +
theme_classic(base_size = 15) +
xlab(' Age (years)') +
ylab('IL-18 expression (ΔCt)') +
theme(legend.title = element_blank()) #+
## `geom_smooth()` using formula 'y ~ x'
#
# geom_text(x=90, y=0, label="Rho = 0.68") +
#
# geom_text(aes(fontface = 3), x=90, y=-5, label="p = ") +
#
# geom_text(x=95, y=-5, label="0.003")
b <- ggplot(db_cor, aes(x = icu_los, y = il18_delta_ct)) #initiate plot
b + geom_point(aes(color = il18_delta_ct), size = 4) +
geom_smooth(method = lm) +
scale_color_gradientn(colors = c("#00AFBB", "#E7B800", "#FC4E07")) +
theme(legend.position = "right") +
theme_classic(base_size = 15) +
xlab(' ICU LOS (years)') +
ylab('IL-18 expression (ΔCt)') +
theme(legend.title = element_blank())
## `geom_smooth()` using formula 'y ~ x'
b <- ggplot(db_cor, aes(x = h_los, y = ifna7_delta_ct)) #initiate plot
b + geom_point(aes(color = ifna7_delta_ct), size = 4) +
geom_smooth(method = lm) +
scale_color_gradientn(colors = c("#00AFBB", "#E7B800", "#FC4E07")) +
theme(legend.position = "right") +
theme_classic(base_size = 15) +
xlab(' Hospital LOS (years)') +
ylab('IFN-A7 expression (ΔCt)') +
theme(legend.title = element_blank())
## `geom_smooth()` using formula 'y ~ x'