Verificar en donde está la diferencia entre las variables
cuantitativas
- Se verificar la normalidad entre las variables
- Se selecciona la mejor pruebas estadistica (Anova o Kruskal
wallis)
- Se realiza la comapración entre pares
#Pruebas de normalidad
library(broom)
library(tidyr)
library(purrr)
library(dplyr)
tabla_shapiro <- BASE %>%
group_by(`Tipo de cirugía bariátrica`) %>%
summarise(
shapiro = list(shapiro.test(Edad)),
.groups = "drop"
) %>%
mutate(shapiro = map(shapiro, tidy)) %>%
unnest(shapiro)
library(gt)
tabla_shapiro %>%
gt() %>%
tab_header(
title = md("**Prueba de normalidad Shapiro-Wilk EDAD por tipo de cirugía**"),
subtitle = "Resultados agrupados"
) %>%
tab_style(
style = cell_text(align = "center", weight = "bold", color = "darkblue"),
locations = cells_column_labels(everything())
) %>%
tab_style(
style = cell_text(align = "center"),
locations = cells_body(columns = everything())
) %>%
fmt_number(
columns = where(is.numeric),
decimals = 4
) %>%
opt_table_outline() %>%
opt_row_striping()
Prueba de normalidad Shapiro-Wilk EDAD por tipo de cirugía |
Resultados agrupados |
Tipo de cirugía bariátrica |
statistic |
p.value |
method |
1 bypass/ Y Roux |
0.9522 |
0.4598 |
Shapiro-Wilk normality test |
Control |
0.9541 |
0.0504 |
Shapiro-Wilk normality test |
Manga gástrica |
0.9779 |
0.6730 |
Shapiro-Wilk normality test |
Comparación por pares
library(FSA)
# Correr la prueba de Dunn
dunn_res <- dunnTest(Edad ~ `Tipo de cirugía bariátrica`,
data = BASE,
method = "bonferroni")
# Extraer la tabla de resultados
tabla_dunn <- dunn_res$res
# Pasar a gt para embellecer
tabla_dunn %>%
gt() %>%
tab_header(
title = "Prueba de Dunn post-hoc EDAD",
subtitle = "Ajuste por Bonferroni"
) %>%
cols_label(
Comparison = "Comparación",
Z = "Estadístico Z",
P.unadj = "p-valor sin ajuste",
P.adj = "p-valor ajustado"
) %>%
fmt_number(
columns = c(Z, P.unadj, P.adj),
decimals = 4
) %>%
tab_style(
style = list(
cell_text(weight = "bold", align = "center")
),
locations = cells_column_labels(everything())
)
Prueba de Dunn post-hoc EDAD |
Ajuste por Bonferroni |
Comparación |
Estadístico Z |
p-valor sin ajuste |
p-valor ajustado |
1 bypass/ Y Roux - Control |
−0.2001 |
0.8414 |
1.0000 |
1 bypass/ Y Roux - Manga gástrica |
2.4133 |
0.0158 |
0.0474 |
Control - Manga gástrica |
3.4388 |
0.0006 |
0.0018 |
La diferencia esta entre: “Control - Manga gástrica y”1 bypass/Roux -
Manga gástrica”
tabla_shapiro2 <- BASE %>%
group_by(`Tipo de cirugía bariátrica`) %>%
summarise(
shapiro = list(shapiro.test(`IMC (Índice de masa corporal)`)),
.groups = "drop"
) %>%
mutate(shapiro = map(shapiro, tidy)) %>%
unnest(shapiro)
library(gt)
tabla_shapiro2 %>%
gt() %>%
tab_header(
title = md("**Prueba de normalidad Shapiro-Wilk IMC por tipo de cirugía**"),
subtitle = "Resultados agrupados"
) %>%
tab_style(
style = cell_text(align = "center", weight = "bold", color = "darkblue"),
locations = cells_column_labels(everything())
) %>%
tab_style(
style = cell_text(align = "center"),
locations = cells_body(columns = everything())
) %>%
fmt_number(
columns = where(is.numeric),
decimals = 4
) %>%
opt_table_outline() %>%
opt_row_striping()
Prueba de normalidad Shapiro-Wilk IMC por tipo de cirugía |
Resultados agrupados |
Tipo de cirugía bariátrica |
statistic |
p.value |
method |
1 bypass/ Y Roux |
0.9422 |
0.3154 |
Shapiro-Wilk normality test |
Control |
0.9275 |
0.0044 |
Shapiro-Wilk normality test |
Manga gástrica |
0.9509 |
0.1120 |
Shapiro-Wilk normality test |
dunn_res2 <- dunnTest(`IMC (Índice de masa corporal)` ~ `Tipo de cirugía bariátrica`,
data = BASE,
method = "bonferroni")
tabla_dunn2 <- dunn_res2$res
tabla_dunn2 %>%
gt() %>%
tab_header(
title = "Prueba de Dunn post-hoc IMC",
subtitle = "Ajuste por Bonferroni"
) %>%
cols_label(
Comparison = "Comparación",
Z = "Estadístico Z",
P.unadj = "p-valor sin ajuste",
P.adj = "p-valor ajustado"
) %>%
fmt_number(
columns = c(Z, P.unadj, P.adj),
decimals = 4
) %>%
tab_style(
style = list(
cell_text(weight = "bold", align = "center")
),
locations = cells_column_labels(everything())
)
Prueba de Dunn post-hoc IMC |
Ajuste por Bonferroni |
Comparación |
Estadístico Z |
p-valor sin ajuste |
p-valor ajustado |
1 bypass/ Y Roux - Control |
4.8587 |
0.0000 |
0.0000 |
1 bypass/ Y Roux - Manga gástrica |
−1.0343 |
0.3010 |
0.9030 |
Control - Manga gástrica |
−7.4759 |
0.0000 |
0.0000 |
Diferencias entre: 1 bypass/ Y Roux - Control & Control - Manga
gástrica
tabla_shapiro3 <- BASE %>%
group_by(`Tipo de cirugía bariátrica`) %>%
summarise(
shapiro = list(shapiro.test(`Manometría: IRP`)),
.groups = "drop"
) %>%
mutate(shapiro = map(shapiro, tidy)) %>%
unnest(shapiro)
tabla_shapiro3 %>%
gt() %>%
tab_header(
title = md("**Prueba de normalidad Shapiro-Wilk Manometría: IRP por tipo de cirugía**"),
subtitle = "Resultados agrupados"
) %>%
tab_style(
style = cell_text(align = "center", weight = "bold", color = "darkblue"),
locations = cells_column_labels(everything())
) %>%
tab_style(
style = cell_text(align = "center"),
locations = cells_body(columns = everything())
) %>%
fmt_number(
columns = where(is.numeric),
decimals = 4
) %>%
opt_table_outline() %>%
opt_row_striping()
Prueba de normalidad Shapiro-Wilk Manometría: IRP por tipo de cirugía |
Resultados agrupados |
Tipo de cirugía bariátrica |
statistic |
p.value |
method |
1 bypass/ Y Roux |
0.7717 |
0.0006 |
Shapiro-Wilk normality test |
Control |
0.9132 |
0.0014 |
Shapiro-Wilk normality test |
Manga gástrica |
0.9488 |
0.1129 |
Shapiro-Wilk normality test |
dunn_res3 <- dunnTest(`Manometría: IRP` ~ `Tipo de cirugía bariátrica`,
data = BASE,
method = "bonferroni")
# Extraer la tabla de resultados
tabla_dunn3 <- dunn_res3$res
# Pasar a gt para embellecer
tabla_dunn3 %>%
gt() %>%
tab_header(
title = "Prueba de Dunn post-hoc Manometría: IRP",
subtitle = "Ajuste por Bonferroni"
) %>%
cols_label(
Comparison = "Comparación",
Z = "Estadístico Z",
P.unadj = "p-valor sin ajuste",
P.adj = "p-valor ajustado"
) %>%
fmt_number(
columns = c(Z, P.unadj, P.adj),
decimals = 4
) %>%
tab_style(
style = list(
cell_text(weight = "bold", align = "center")
),
locations = cells_column_labels(everything())
)
Prueba de Dunn post-hoc Manometría: IRP |
Ajuste por Bonferroni |
Comparación |
Estadístico Z |
p-valor sin ajuste |
p-valor ajustado |
1 bypass/ Y Roux - Control |
2.9262 |
0.0034 |
0.0103 |
1 bypass/ Y Roux - Manga gástrica |
0.5224 |
0.6014 |
1.0000 |
Control - Manga gástrica |
−2.9335 |
0.0034 |
0.0101 |
Diferencias entre: 1 bypass/ Y Roux - Control & Control - Manga
gástrica
tabla_shapiro4 <- BASE %>%
group_by(`Tipo de cirugía bariátrica`) %>%
summarise(
shapiro = list(shapiro.test(`Manometría: Presión basal del LES`)),
.groups = "drop"
) %>%
mutate(shapiro = map(shapiro, tidy)) %>%
unnest(shapiro)
tabla_shapiro4 %>%
gt() %>%
tab_header(
title = md("**Prueba de normalidad Shapiro-Wilk Manometría: Presión basal del LES por tipo de cirugía**"),
subtitle = "Resultados agrupados"
) %>%
tab_style(
style = cell_text(align = "center", weight = "bold", color = "darkblue"),
locations = cells_column_labels(everything())
) %>%
tab_style(
style = cell_text(align = "center"),
locations = cells_body(columns = everything())
) %>%
fmt_number(
columns = where(is.numeric),
decimals = 4
) %>%
opt_table_outline() %>%
opt_row_striping()
Prueba de normalidad Shapiro-Wilk Manometría: Presión basal del LES por tipo de cirugía |
Resultados agrupados |
Tipo de cirugía bariátrica |
statistic |
p.value |
method |
1 bypass/ Y Roux |
0.8772 |
0.0234 |
Shapiro-Wilk normality test |
Control |
0.9614 |
0.1015 |
Shapiro-Wilk normality test |
Manga gástrica |
0.9375 |
0.0519 |
Shapiro-Wilk normality test |
dunn_res4 <- dunnTest(`Manometría: Presión basal del LES` ~ `Tipo de cirugía bariátrica`,
data = BASE,
method = "bonferroni")
# Extraer la tabla de resultados
tabla_dunn4 <- dunn_res4$res
# Pasar a gt para embellecer
tabla_dunn4 %>%
gt() %>%
tab_header(
title = "Prueba de Dunn post-hoc Manometría: Presión basal del LES",
subtitle = "Ajuste por Bonferroni"
) %>%
cols_label(
Comparison = "Comparación",
Z = "Estadístico Z",
P.unadj = "p-valor sin ajuste",
P.adj = "p-valor ajustado"
) %>%
fmt_number(
columns = c(Z, P.unadj, P.adj),
decimals = 4
) %>%
tab_style(
style = list(
cell_text(weight = "bold", align = "center")
),
locations = cells_column_labels(everything())
)
Prueba de Dunn post-hoc Manometría: Presión basal del LES |
Ajuste por Bonferroni |
Comparación |
Estadístico Z |
p-valor sin ajuste |
p-valor ajustado |
1 bypass/ Y Roux - Control |
1.4230 |
0.1547 |
0.4642 |
1 bypass/ Y Roux - Manga gástrica |
2.1428 |
0.0321 |
0.0964 |
Control - Manga gástrica |
1.0502 |
0.2936 |
0.8809 |
Hubo “mayo diferencia” entre: 1 bypass/ Y Roux - Manga gástrica
tabla_shapiro5 <- BASE %>%
group_by(`Tipo de cirugía bariátrica`) %>%
summarise(
shapiro = list(shapiro.test(`Manometría: IRP en la prueba de RDC`)),
.groups = "drop"
) %>%
mutate(shapiro = map(shapiro, tidy)) %>%
unnest(shapiro)
tabla_shapiro5 %>%
gt() %>%
tab_header(
title = md("**Prueba de normalidad Shapiro-Wilk `Manometría: IRP en la prueba de RDC` por tipo de cirugía**"),
subtitle = "Resultados agrupados"
) %>%
tab_style(
style = cell_text(align = "center", weight = "bold", color = "darkblue"),
locations = cells_column_labels(everything())
) %>%
tab_style(
style = cell_text(align = "center"),
locations = cells_body(columns = everything())
) %>%
fmt_number(
columns = where(is.numeric),
decimals = 4
) %>%
opt_table_outline() %>%
opt_row_striping()
Prueba de normalidad Shapiro-Wilk Manometría: IRP en la prueba de RDC por tipo de cirugía |
Resultados agrupados |
Tipo de cirugía bariátrica |
statistic |
p.value |
method |
1 bypass/ Y Roux |
0.5911 |
0.0000 |
Shapiro-Wilk normality test |
Control |
0.7838 |
0.0000 |
Shapiro-Wilk normality test |
Manga gástrica |
0.8205 |
0.0001 |
Shapiro-Wilk normality test |
dunn_res5 <- dunnTest(`Manometría: IRP en la prueba de RDC` ~ `Tipo de cirugía bariátrica`,
data = BASE,
method = "bonferroni")
tabla_dunn5 <- dunn_res5$res
tabla_dunn5 %>%
gt() %>%
tab_header(
title = "Prueba de Dunn post-hoc Manometría: IRP en la prueba de RDC",
subtitle = "Ajuste por Bonferroni"
) %>%
cols_label(
Comparison = "Comparación",
Z = "Estadístico Z",
P.unadj = "p-valor sin ajuste",
P.adj = "p-valor ajustado"
) %>%
fmt_number(
columns = c(Z, P.unadj, P.adj),
decimals = 4
) %>%
tab_style(
style = list(
cell_text(weight = "bold", align = "center")
),
locations = cells_column_labels(everything())
)
Prueba de Dunn post-hoc Manometría: IRP en la prueba de RDC |
Ajuste por Bonferroni |
Comparación |
Estadístico Z |
p-valor sin ajuste |
p-valor ajustado |
1 bypass/ Y Roux - Control |
0.7374 |
0.4609 |
1.0000 |
1 bypass/ Y Roux - Manga gástrica |
0.9299 |
0.3524 |
1.0000 |
Control - Manga gástrica |
0.3183 |
0.7503 |
1.0000 |
No se encontraron diferencias especificas
Analisis global escalas BED-Q
#dput(names(BASE_BED_Q))
myVars2 <- c("Total", "Mayor o igual a 1")
catVars2 <- c("Mayor o igual a 1")
tab2 <- CreateTableOne(vars = myVars2, factorVars= catVars2, data = BASE_BED_Q,strata = "Tipo de cirugía bariátrica", includeNA = F, addOverall = T, testNonNormal = T)
table2 <- as.data.frame(print(tab2, showAllLevels= TRUE, printToggle = FALSE, noSpaces = TRUE))
rownames(table2) <- gsub("\\.{3,}", "", rownames(table2)) # Quita puntos suspensivos "..."
rownames(table2) <- gsub("\\.{1,}", "_", rownames(table2)) # Quita puntos suspensivos "..."
rownames(table2) <- gsub("\\_{1,}", " ", rownames(table2)) # Quita puntos suspensivos "..."
kable(table2, format = "html", caption = "BED-Q") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F,position = "center") %>%
column_spec(1, bold = T, color = "white", background = "black") %>%
column_spec(2, border_left = T, color = "white", background = "grey")
BED-Q
|
level
|
Overall
|
1 bypass/ Y Roux
|
Manga gástrica
|
p
|
test
|
n
|
|
60
|
18
|
36
|
|
|
Total (mean (SD))
|
|
2.53 (4.38)
|
2.67 (2.09)
|
1.69 (2.29)
|
0.136
|
|
Mayor o igual a 1 (%)
|
no
|
24 (44.4)
|
5 (27.8)
|
19 (52.8)
|
0.146
|
|
|
Si
|
30 (55.6)
|
13 (72.2)
|
17 (47.2)
|
|
|
Analisis global escalas GERD-Q
dput(names(BASE_GERDQ))
## c("cedula", "Telefono", "¿En la última semana cuantos días ha tenido sensación de quemazón o ardor en el pecho?",
## "¿En la última semana cuantos días ha notado que el contenido del estómago le ha subido a la garganta o la boca?",
## "¿En la última semana cuantos días ha sentido dolor en la boca del estómago?",
## "¿En la última semana cuantos días ha tenido nauseas o ganas de vomitar?",
## "¿En la última semana cuantas noches ha tenido problemas para dormir bien a causa de tener ardor o por notar que el contenido del estómago le subía a la garganta o a la boca?",
## "¿En la última semana cuantos días ha tomado alguna medicina por tener ardor o por notar que el contenido del estómago le sube a la garganta o a la boca, aparte que le receto el medico?",
## "Total", "Sintomas >1", "Tipo de cirugia bariatrica", "Hernia hiatal"
## )
myVars3 <- c("Total", "Sintomas >1", "Hernia hiatal")
catVars3 <- c("Sintomas >1", "Hernia hiatal")
tab3 <- CreateTableOne(vars = myVars3, factorVars= catVars3, data = BASE_GERDQ,strata = "Tipo de cirugia bariatrica", includeNA = F, addOverall = T, testNonNormal = T)
table3 <- as.data.frame(print(tab3, showAllLevels= TRUE, printToggle = FALSE, noSpaces = TRUE))
rownames(table3) <- gsub("\\.{3,}", "", rownames(table3)) # Quita puntos suspensivos "..."
rownames(table3) <- gsub("\\.{1,}", "_", rownames(table3)) # Quita puntos suspensivos "..."
rownames(table3) <- gsub("\\_{1,}", " ", rownames(table3)) # Quita puntos suspensivos "..."
kable(table3, format = "html", caption = "GERDQ") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F,position = "center") %>%
column_spec(1, bold = T, color = "white", background = "black") %>%
column_spec(2, border_left = T, color = "white", background = "grey")
GERDQ
|
level
|
Overall
|
1 bypass/ Y Roux
|
Manga gástrica
|
p
|
test
|
n
|
|
55
|
18
|
36
|
|
|
Total mean SD
|
|
6.31 (4.67)
|
6.39 (3.82)
|
5.94 (4.75)
|
0.732
|
|
Sintomas 1
|
No
|
10 (18.2)
|
3 (16.7)
|
7 (19.4)
|
1.000
|
|
X
|
Si
|
45 (81.8)
|
15 (83.3)
|
29 (80.6)
|
|
|
Hernia hiatal
|
0
|
1 (1.9)
|
1 (5.6)
|
0 (0.0)
|
0.179
|
|
X 1
|
Hernia hiatal
|
37 (68.5)
|
10 (55.6)
|
27 (75.0)
|
|
|
X 2
|
otro
|
16 (29.6)
|
7 (38.9)
|
9 (25.0)
|
|
|