CARGUE BD ORIGINAL

CREACIÓN DE SUB-BASE PARA ANALISIS

library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.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
# Variables para el subset
variables <- c("COD_EVE", "FEC_NOT", "SEMANA", "ANO", "EDAD", "UNI_MED", "nombre_nacionalidad", "SEXO", "AREA", "TIP_SS", "COD_ASE", "PER_ETN", "nom_grupo", "estrato", "GP_DESPLAZ", "GP_MIGRANT", "GP_POBICFB", "GP_VIC_VIO", "GP_OTROS", "fuente", "FEC_CON", "INI_SIN", "TIP_CAS", "PAC_HOS", "FEC_HOS", "FEC_DEF", "AJUSTE", "FECHA_NTO", "CER_DEF", "CBMTE", "FEC_AJU", "confirmados", "consecutive_origen", "va_sispro", "nom_est_f_caso", "Nom_upgd", "Pais_ocurrencia", "Nombre_evento", "Departamento_ocurrencia", "Municipio_ocurrencia", "Pais_residencia", "Departamento_residencia", "Municipio_residencia", "Departamento_Notificacion", "Municipio_notificacion", "CONSECUTIVE_12")

# Crear subset
variables_existentes <- variables[variables %in% names(bases_591)]
datos_subset <- bases_591 %>% select(all_of(variables_existentes))

# Resultados
cat("Subset creado:", ncol(datos_subset), "variables,", nrow(datos_subset), "registros\n")
## Subset creado: 46 variables, 814 registros
cat("Variables incluidas:\n")
## Variables incluidas:
print(names(datos_subset))
##  [1] "COD_EVE"                   "FEC_NOT"                  
##  [3] "SEMANA"                    "ANO"                      
##  [5] "EDAD"                      "UNI_MED"                  
##  [7] "nombre_nacionalidad"       "SEXO"                     
##  [9] "AREA"                      "TIP_SS"                   
## [11] "COD_ASE"                   "PER_ETN"                  
## [13] "nom_grupo"                 "estrato"                  
## [15] "GP_DESPLAZ"                "GP_MIGRANT"               
## [17] "GP_POBICFB"                "GP_VIC_VIO"               
## [19] "GP_OTROS"                  "fuente"                   
## [21] "FEC_CON"                   "INI_SIN"                  
## [23] "TIP_CAS"                   "PAC_HOS"                  
## [25] "FEC_HOS"                   "FEC_DEF"                  
## [27] "AJUSTE"                    "FECHA_NTO"                
## [29] "CER_DEF"                   "CBMTE"                    
## [31] "FEC_AJU"                   "confirmados"              
## [33] "consecutive_origen"        "va_sispro"                
## [35] "nom_est_f_caso"            "Nom_upgd"                 
## [37] "Pais_ocurrencia"           "Nombre_evento"            
## [39] "Departamento_ocurrencia"   "Municipio_ocurrencia"     
## [41] "Pais_residencia"           "Departamento_residencia"  
## [43] "Municipio_residencia"      "Departamento_Notificacion"
## [45] "Municipio_notificacion"    "CONSECUTIVE_12"

CONVERSION VARIABLES

library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
predatos <- datos_subset

# Crear nuevo dataframe con fechas convertidas
predatos<- predatos %>%
  mutate(
    FEC_NOT_DATE = as.Date(FEC_NOT),
    FEC_CON_DATE = as.Date(FEC_CON),
    INI_SIN_DATE = as.Date(INI_SIN),
    FEC_HOS_DATE = as.Date(FEC_HOS),
    FEC_DEF_DATE = as.Date(FEC_DEF),
    FECHA_NTO_DATE = as.Date(FECHA_NTO),
    FEC_AJU_DATE = as.Date(FEC_AJU)
  )

# Verificar conversiones
cat("Resumen de fechas convertidas:\n")
## Resumen de fechas convertidas:
fechas_vars <- c("FEC_NOT_DATE", "FEC_CON_DATE", "INI_SIN_DATE", 
                 "FEC_HOS_DATE", "FEC_DEF_DATE", "FECHA_NTO_DATE", "FEC_AJU_DATE")

for(var in fechas_vars) {
  if(var %in% names(predatos)) {
    cat(paste(var, ":", sum(!is.na(predatos[[var]])), "registros válidos\n"))
  }
}
## FEC_NOT_DATE : 814 registros válidos
## FEC_CON_DATE : 813 registros válidos
## INI_SIN_DATE : 814 registros válidos
## FEC_HOS_DATE : 551 registros válidos
## FEC_DEF_DATE : 814 registros válidos
## FECHA_NTO_DATE : 807 registros válidos
## FEC_AJU_DATE : 814 registros válidos
# Mostrar estructura
str(predatos %>% select(ends_with("_DATE")))
## tibble [814 × 7] (S3: tbl_df/tbl/data.frame)
##  $ FEC_NOT_DATE  : Date[1:814], format: "2023-04-17" "2023-08-10" ...
##  $ FEC_CON_DATE  : Date[1:814], format: "2023-04-09" "2023-04-08" ...
##  $ INI_SIN_DATE  : Date[1:814], format: "2023-04-04" "2023-04-08" ...
##  $ FEC_HOS_DATE  : Date[1:814], format: "2023-04-09" "2023-04-08" ...
##  $ FEC_DEF_DATE  : Date[1:814], format: "2023-04-17" "2023-04-19" ...
##  $ FECHA_NTO_DATE: Date[1:814], format: "2021-10-16" "2023-03-09" ...
##  $ FEC_AJU_DATE  : Date[1:814], format: "2023-11-01" "2023-11-14" ...

CONVERSION VARIABLE EDAD

library(dplyr)

# Conversión directa
predatos <- predatos %>%
  mutate(
    UNI_MED = as.numeric(as.character(UNI_MED)),
    EDAD = as.numeric(as.character(EDAD))
  )

# nueva variable
predatos <- predatos %>%
  mutate(
    edad_meses = case_when(
      UNI_MED == 3 ~ 1,           # Menor de 1 mes -> 1 mes
      UNI_MED == 2 ~ EDAD,        # Ya en meses -> mismo valor
      UNI_MED == 1 ~ EDAD * 12,   # Años -> multiplicar por 12
      TRUE ~ NA_real_             # Otros casos -> NA
    )
  )

# Verificación rápida
cat("Resumen de la conversión:\n")
## Resumen de la conversión:
cat("UNI_MED = 1 (años):", nrow(predatos %>% filter(UNI_MED == 1)), "registros\n")
## UNI_MED = 1 (años): 308 registros
cat("UNI_MED = 2 (meses):", nrow(predatos %>% filter(UNI_MED == 2)), "registros\n")
## UNI_MED = 2 (meses): 489 registros
cat("UNI_MED = 3 (menor 1 mes):", nrow(predatos %>% filter(UNI_MED == 3)), "registros\n")
## UNI_MED = 3 (menor 1 mes): 17 registros
cat("Rango de edad_meses:", range(predatos$edad_meses, na.rm = TRUE), "\n")
## Rango de edad_meses: 1 48
# Conversión directa
predatos <- predatos %>%
  mutate(
    edad_meses = as.numeric(as.character(edad_meses)),
    ANO = as.numeric(as.character(ANO)),
    SEMANA = as.numeric(as.character(SEMANA)))

SUBBASE CON EDAD MODIFICADA

# Variables para el subset
variables2 <- c("COD_EVE", "SEMANA", "ANO", "edad_meses", "nombre_nacionalidad", "SEXO", "AREA", "TIP_SS", "COD_ASE", "PER_ETN", "nom_grupo", "estrato", "GP_DESPLAZ", "GP_MIGRANT", "GP_POBICFB", "GP_VIC_VIO", "GP_OTROS", "fuente", "TIP_CAS", "AJUSTE",  "CBMTE", "confirmados", "consecutive_origen", "va_sispro", "nom_est_f_caso", "Pais_ocurrencia", "Nombre_evento", "Departamento_ocurrencia", "Pais_residencia", "Departamento_residencia",  "Departamento_Notificacion")

# Crear subset
variables_existentes2 <- variables2[variables2 %in% names(predatos)]
datos_finales <- predatos %>% select(all_of(variables_existentes2))

# Resultados
cat("Subset creado:", ncol(datos_finales), "variables,", nrow(datos_finales), "registros\n")
## Subset creado: 31 variables, 814 registros
cat("Variables incluidas:\n")
## Variables incluidas:
print(names(datos_finales))
##  [1] "COD_EVE"                   "SEMANA"                   
##  [3] "ANO"                       "edad_meses"               
##  [5] "nombre_nacionalidad"       "SEXO"                     
##  [7] "AREA"                      "TIP_SS"                   
##  [9] "COD_ASE"                   "PER_ETN"                  
## [11] "nom_grupo"                 "estrato"                  
## [13] "GP_DESPLAZ"                "GP_MIGRANT"               
## [15] "GP_POBICFB"                "GP_VIC_VIO"               
## [17] "GP_OTROS"                  "fuente"                   
## [19] "TIP_CAS"                   "AJUSTE"                   
## [21] "CBMTE"                     "confirmados"              
## [23] "consecutive_origen"        "va_sispro"                
## [25] "nom_est_f_caso"            "Pais_ocurrencia"          
## [27] "Nombre_evento"             "Departamento_ocurrencia"  
## [29] "Pais_residencia"           "Departamento_residencia"  
## [31] "Departamento_Notificacion"

DESCRIPTIVO AUTOMATIZADO

#library(SmartEDA)

# similarly, with dplyr syntax: df %>% ExpReport(...)
#ExpReport(
  #datos_finales,
  #Target="COD_EVE",
  #label=NULL,
  #op_file="Report.html",
  #op_dir=getwd())
#library(openxlsx)
# Exportar a Excel
#write.xlsx(datos_finales, file = "datos.xlsx")

ANALISIS UNIVARIADO

library(readxl)
library(dplyr)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
library(knitr)
## Warning: package 'knitr' was built under R version 4.3.3
library(kableExtra)
## Warning: package 'kableExtra' was built under R version 4.3.3
## 
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
## 
##     group_rows
library(lubridate)
library(tidyr)
## Warning: package 'tidyr' was built under R version 4.3.3
library(purrr)


vars_omitidas <- c("EDAD", "UNI_MED", "CONSECUTIVE_12", "consecutive_origen", "Nom_upgd", "CER_DEF")
datos <- predatos %>% select(-any_of(vars_omitidas))

ANALISIS EDAD EN MESES

resumen_edad <- datos %>%
  summarise(
    Min = min(edad_meses, na.rm = TRUE),
    Q1 = quantile(edad_meses, 0.25, na.rm = TRUE),
    Media = mean(edad_meses, na.rm = TRUE),
    Mediana = median(edad_meses, na.rm = TRUE),
    Q3 = quantile(edad_meses, 0.75, na.rm = TRUE),
    Max = max(edad_meses, na.rm = TRUE),
    SD = sd(edad_meses, na.rm = TRUE),
    NA_Count = sum(is.na(edad_meses))
  )

print(resumen_edad)
## # A tibble: 1 × 8
##     Min    Q1 Media Mediana    Q3   Max    SD NA_Count
##   <dbl> <dbl> <dbl>   <dbl> <dbl> <dbl> <dbl>    <int>
## 1     1     4  10.5       9    12    48  10.3        0
ggplot(datos, aes(y = edad_meses)) +
  geom_boxplot(fill = "#FFB6C1", color = "#555555", alpha = 0.8) +  # rosa pastel
  theme_minimal() +
  labs(
    title = "Boxplot de edad_meses",
    y = "Edad en meses"
  ) +
  theme(
    plot.title = element_text(size = 14, face = "bold"),
    axis.title = element_text(size = 12)
  )

ANALISIS POR SEMANA EPIDEMIOLÓGICA

library(dplyr)
library(ggplot2)

df_lineas <- datos %>%
  group_by(COD_EVE, SEMANA) %>%
  summarise(Frecuencia = n(), .groups = "drop")

ggplot(df_lineas, aes(x = SEMANA, y = Frecuencia, color = factor(COD_EVE))) +
  geom_line(linewidth = 1) +
  theme_minimal() +
  labs(
    title = "Tendencia semanal diferenciada por tipo de mortalidad",
    x = "Semana",
    y = "Frecuencia",
    color = "Codigo del evento"
  ) +
  scale_color_brewer(palette = "Set2")  # paleta pastel

ANALISIS VARIABLES CATEGORICAS

vars <- c("nombre_nacionalidad", "SEXO", "AREA", "TIP_SS", "PER_ETN", 
          "estrato", "GP_DESPLAZ", "GP_MIGRANT", "GP_POBICFB", 
          "GP_VIC_VIO", "GP_OTROS", "fuente", "nom_est_f_caso")

tabla_resumen <- map_df(vars, function(v) {
  
  datos %>%
    count(!!sym(v)) %>%
    mutate(
      Variable = v,
      Porcentaje = round((n / sum(n)) * 100, 2)   # ← aquí multiplicamos por 100
    ) %>%
    rename(Categoria = !!sym(v), Frecuencia = n) %>%
    select(Variable, Categoria, Frecuencia, Porcentaje)
})

kable(tabla_resumen,
      caption = "Tabla resumen de frecuencias y porcentaje",
      align = "l") %>%
  kable_styling(full_width = FALSE, bootstrap_options = c("striped", "hover"))
Tabla resumen de frecuencias y porcentaje
Variable Categoria Frecuencia Porcentaje
nombre_nacionalidad COLOMBIA 783 96.19
nombre_nacionalidad VENEZUELA 31 3.81
SEXO F 334 41.03
SEXO M 480 58.97
AREA 1 370 45.45
AREA 2 61 7.49
AREA 3 383 47.05
TIP_SS C 66 8.11
TIP_SS E 1 0.12
TIP_SS I 15 1.84
TIP_SS N 76 9.34
TIP_SS S 656 80.59
PER_ETN 1 422 51.84
PER_ETN 3 1 0.12
PER_ETN 5 44 5.41
PER_ETN 6 347 42.63
estrato 1 644 79.12
estrato 2 104 12.78
estrato 3 21 2.58
estrato NA 45 5.53
GP_DESPLAZ 1 13 1.60
GP_DESPLAZ 2 801 98.40
GP_MIGRANT 1 30 3.69
GP_MIGRANT 2 784 96.31
GP_POBICFB 1 15 1.84
GP_POBICFB 2 799 98.16
GP_VIC_VIO 1 3 0.37
GP_VIC_VIO 2 811 99.63
GP_OTROS 1 771 94.72
GP_OTROS 2 43 5.28
fuente 1 622 76.41
fuente 2 113 13.88
fuente 3 13 1.60
fuente 4 42 5.16
fuente 5 24 2.95
nom_est_f_caso Confirmado por Clínica 665 81.70
nom_est_f_caso Confirmado por laboratorio 149 18.30

ANALISIS CAUSA MUERTE

df_cbmte <- datos %>%
  count(CBMTE) %>%
  arrange(desc(n))

top10 <- df_cbmte %>% slice(1:10)
otros <- df_cbmte %>% slice(11:n()) %>%
  summarise(CBMTE = "Otros", n = sum(n))

df_final <- bind_rows(top10, otros) %>%
  arrange(n)

ggplot(df_final, aes(x = n, y = reorder(CBMTE, n), fill = CBMTE)) +
  geom_col() +
  # ---------- ETIQUETAS ----------
  geom_text(aes(label = n),
            hjust = -0.1,          # Mueve el texto hacia afuera de la barra
            size = 3.8) +
  scale_fill_brewer(palette = "Set3") +  
  theme_minimal() +
  labs(
    title = "Top 10 causas básicas de muerte",
    x = "Frecuencia",
    y = ""
  ) +
  coord_cartesian(xlim = c(0, max(df_final$n) * 1.15)) +  # deja espacio para texto
  theme(
    legend.position = "none",
    plot.title = element_text(size = 14, face = "bold")
  )

ANALISIS GEOREFERENCIACION

DEPARTAMENTO OCURRENCIA

library(kableExtra)

tabla_dep <- datos %>%
  count(Departamento_ocurrencia, name = "Frecuencia") %>%
  arrange(desc(Frecuencia))

# Top 10
top10 <- tabla_dep %>% slice(1:10)

# Calcular "Otros"
otros <- tabla_dep %>%
  slice(11:n()) %>%
  summarise(
    Departamento_ocurrencia = "Otros",
    Frecuencia = sum(Frecuencia)
  )

# Unir top 10 + otros
tabla_final <- bind_rows(top10, otros) %>%
  mutate(
    Porcentaje = round((Frecuencia / sum(Frecuencia)) * 100, 2)
  )

# ---- Agregar fila TOTAL ----
fila_total <- tibble(
  Departamento_ocurrencia = "TOTAL",
  Frecuencia = sum(tabla_final$Frecuencia),
  Porcentaje = 100
)

tabla_final2 <- bind_rows(tabla_final, fila_total)

# ---- Tabla con formato profesional ----
kable(
  tabla_final2,
  caption = "Top 10 de Departamento de ocurrencia",
  col.names = c("Departamento", "Frecuencia", "Porcentaje (%)"),
  align = "l"
) %>%
  kable_styling(
    bootstrap_options = c("striped", "hover", "condensed"),
    full_width = FALSE
  ) %>%
  row_spec(
    nrow(tabla_final2),       # última fila (TOTAL)
    background = "#003366",   # azul oscuro
    color = "white",          # texto blanco
    bold = TRUE
  )
Top 10 de Departamento de ocurrencia
Departamento Frecuencia Porcentaje (%)
GUAJIRA 148 18.18
CHOCO 118 14.50
ANTIOQUIA 43 5.28
MAGDALENA 41 5.04
CESAR 39 4.79
BOLIVAR 38 4.67
BOGOTA 34 4.18
VALLE 31 3.81
EXTERIOR 30 3.69
META 28 3.44
Otros 264 32.43
TOTAL 814 100.00

MUNICIPIO OCURRENCIA

tabla_mun <- datos %>%
  count(Municipio_ocurrencia, name = "Frecuencia") %>%
  arrange(desc(Frecuencia))

# Top 10
top10 <- tabla_mun %>% slice(1:10)

# Calcular "Otros"
otros <- tabla_mun %>%
  slice(11:n()) %>%
  summarise(
    Municipio_ocurrencia = "Otros",
    Frecuencia = sum(Frecuencia)
  )

# Unir top 10 + otros
tabla_final_mun <- bind_rows(top10, otros) %>%
  mutate(
    Porcentaje = round((Frecuencia / sum(Frecuencia)) * 100, 2)
  )

# ---- Agregar fila TOTAL ----
fila_total <- tibble(
  Municipio_ocurrencia = "TOTAL",
  Frecuencia = sum(tabla_final_mun$Frecuencia),
  Porcentaje = 100
)

tabla_final_mun2 <- bind_rows(tabla_final_mun, fila_total)

# ---- Tabla con estilo profesional ----
kable(
  tabla_final_mun2,
  caption = "Top 10 de Municipio de ocurrencia",
  col.names = c("Municipio", "Frecuencia", "Porcentaje (%)"),
  align = "l"
) %>%
  kable_styling(
    bootstrap_options = c("striped", "hover", "condensed"),
    full_width = FALSE
  ) %>%
  row_spec(
    nrow(tabla_final_mun2),     # última fila (TOTAL)
    background = "#003366",     # azul oscuro
    color = "white",            # texto blanco
    bold = TRUE
  )
Top 10 de Municipio de ocurrencia
Municipio Frecuencia Porcentaje (%)
URIBIA 58 7.13
BOGOTA 34 4.18
EXTERIOR_VENEZUELA 29 3.56
MAICAO 28 3.44
MANAURE 26 3.19
BAJO BAUDO (PIZARRO) 22 2.70
RIOHACHA 22 2.70
QUIBDO 18 2.21
PUEBLO RICO 16 1.97
CUMARIBO 15 1.84
Otros 546 67.08
TOTAL 814 100.00

DEPARTAMENTO RESIDENCIA

tabla_depr <- datos %>%
  count(Departamento_residencia, name = "Frecuencia") %>%
  arrange(desc(Frecuencia))

# Top 10
top10 <- tabla_depr %>% slice(1:10)

# Calcular "Otros"
otros <- tabla_depr %>%
  slice(11:n()) %>%
  summarise(
    Departamento_residencia = "Otros",
    Frecuencia = sum(Frecuencia)
  )

# Unir top 10 + otros
tabla_final <- bind_rows(top10, otros) %>%
  mutate(
    Porcentaje = round((Frecuencia / sum(Frecuencia)) * 100, 2)
  )

# ---- Agregar fila TOTAL ----
fila_total <- tibble(
  Departamento_residencia = "TOTAL",
  Frecuencia = sum(tabla_final$Frecuencia),
  Porcentaje = 100
)

tabla_final2 <- bind_rows(tabla_final, fila_total)

# ---- Tabla con fila TOTAL en azul oscuro ----
kable(
  tabla_final2,
  caption = "Top 10 de Departamento residencia",
  col.names = c("Departamento", "Frecuencia", "Porcentaje (%)"),
  align = "l"
) %>%
  kable_styling(
    bootstrap_options = c("striped", "hover", "condensed"),
    full_width = FALSE
  ) %>%
  row_spec(
    nrow(tabla_final2),        # última fila (TOTAL)
    background = "#003366",    # azul oscuro
    color = "white",           # texto blanco
    bold = TRUE
  )
Top 10 de Departamento residencia
Departamento Frecuencia Porcentaje (%)
GUAJIRA 140 17.20
CHOCO 119 14.62
ANTIOQUIA 43 5.28
EXTERIOR 42 5.16
MAGDALENA 42 5.16
BOLIVAR 39 4.79
CESAR 38 4.67
BOGOTA 32 3.93
VALLE 32 3.93
CORDOBA 25 3.07
Otros 262 32.19
TOTAL 814 100.00

MUNICIPIO RESIDENCIA

tabla_munr <- datos %>%
  count(Municipio_residencia, name = "Frecuencia") %>%
  arrange(desc(Frecuencia))

# Top 10
top10 <- tabla_munr %>% slice(1:10)

# Calcular "Otros"
otros <- tabla_munr %>%
  slice(11:n()) %>%
  summarise(
    Municipio_residencia = "Otros",
    Frecuencia = sum(Frecuencia)
  )

# Unir top 10 + otros
tabla_final <- bind_rows(top10, otros) %>%
  mutate(
    Porcentaje = round((Frecuencia / sum(Frecuencia)) * 100, 2)
  )

# ---- Agregar fila TOTAL ----
fila_total <- tibble(
  Municipio_residencia = "TOTAL",
  Frecuencia = sum(tabla_final$Frecuencia),
  Porcentaje = 100
)

tabla_final2 <- bind_rows(tabla_final, fila_total)

# ---- Tabla con fila TOTAL en azul oscuro ----
kable(
  tabla_final2,
  caption = "Top 10 de Municipio residencia",
  col.names = c("Municipio", "Frecuencia", "Porcentaje (%)"),
  align = "l"
) %>%
  kable_styling(
    bootstrap_options = c("striped", "hover", "condensed"),
    full_width = FALSE
  ) %>%
  row_spec(
    nrow(tabla_final2),        # última fila (TOTAL)
    background = "#003366",    # azul oscuro
    color = "white",           # texto blanco
    bold = TRUE
  )
Top 10 de Municipio residencia
Municipio Frecuencia Porcentaje (%)
URIBIA 58 7.13
EXTERIOR_VENEZUELA 41 5.04
BOGOTA 32 3.93
MANAURE 25 3.07
MAICAO 24 2.95
BAJO BAUDO (PIZARRO) 22 2.70
RIOHACHA 21 2.58
CUMARIBO 20 2.46
QUIBDO 18 2.21
PUEBLO RICO 16 1.97
Otros 537 65.97
TOTAL 814 100.00

DEPARTAMENTO NOTIFICACION

tabla_depn <- datos %>%
  count(Departamento_Notificacion, name = "Frecuencia") %>%
  arrange(desc(Frecuencia))

# Top 10
top10 <- tabla_depn %>% slice(1:10)

# Calcular "Otros"
otros <- tabla_depn %>%
  slice(11:n()) %>%
  summarise(
    Departamento_Notificacion = "Otros",
    Frecuencia = sum(Frecuencia)
  )

# Unir top 10 + otros
tabla_final <- bind_rows(top10, otros) %>%
  mutate(
    Porcentaje = round((Frecuencia / sum(Frecuencia)) * 100, 2)
  )

# ---- Agregar fila TOTAL ----
fila_total <- tibble(
  Departamento_Notificacion = "TOTAL",
  Frecuencia = sum(tabla_final$Frecuencia),
  Porcentaje = 100
)

tabla_final2 <- bind_rows(tabla_final, fila_total)

# ---- Tabla con estilo y fila TOTAL resaltada ----
kable(
  tabla_final2,
  caption = "Top 10 de Departamento notificación",
  col.names = c("Departamento", "Frecuencia", "Porcentaje (%)"),
  align = "l"
) %>%
  kable_styling(
    bootstrap_options = c("striped", "hover", "condensed"),
    full_width = FALSE
  ) %>%
  row_spec(
    nrow(tabla_final2),         # última fila = TOTAL
    background = "#003366",     # azul oscuro
    color = "white",            # texto blanco
    bold = TRUE
  )
Top 10 de Departamento notificación
Departamento Frecuencia Porcentaje (%)
GUAJIRA 139 17.08
CHOCO 98 12.04
CESAR 49 6.02
BOGOTA 48 5.90
ANTIOQUIA 43 5.28
CORDOBA 40 4.91
ATLANTICO 39 4.79
MAGDALENA 39 4.79
META 35 4.30
VALLE 34 4.18
Otros 250 30.71
TOTAL 814 100.00

MUNICIPIO NOTIFICACIÓN

tabla_munn <- datos %>%
  count(Municipio_notificacion, name = "Frecuencia") %>%
  arrange(desc(Frecuencia))

# Top 10
top10 <- tabla_munn %>% slice(1:10)

# Calcular "Otros"
otros <- tabla_munn %>%
  slice(11:n()) %>%
  summarise(
    Municipio_notificacion = "Otros",
    Frecuencia = sum(Frecuencia)
  )

# Unir top 10 + otros
tabla_final <- bind_rows(top10, otros) %>%
  mutate(
    Porcentaje = round((Frecuencia / sum(Frecuencia)) * 100, 2)
  )

# ---- Agregar fila TOTAL ----
fila_total <- tibble(
  Municipio_notificacion = "TOTAL",
  Frecuencia = sum(tabla_final$Frecuencia),
  Porcentaje = 100
)

tabla_final2 <- bind_rows(tabla_final, fila_total)

# ---- Tabla con estilo y fila TOTAL en azul oscuro ----
kable(
  tabla_final2,
  caption = "Top 10 de Municipio notificación",
  col.names = c("Municipio", "Frecuencia", "Porcentaje (%)"),
  align = "l"
) %>%
  kable_styling(
    bootstrap_options = c("striped", "hover", "condensed"),
    full_width = FALSE
  ) %>%
  row_spec(
    nrow(tabla_final2),          # última fila (TOTAL)
    background = "#003366",      # azul oscuro
    color = "white",             # texto blanco
    bold = TRUE
  )
Top 10 de Municipio notificación
Municipio Frecuencia Porcentaje (%)
QUIBDO 66 8.11
MAICAO 56 6.88
BOGOTA 48 5.90
VALLEDUPAR 40 4.91
MONTERIA 33 4.05
BARRANQUILLA 32 3.93
URIBIA 31 3.81
RIOHACHA 29 3.56
VILLAVICENCIO 25 3.07
SANTA MARTHA 24 2.95
Otros 430 52.83
TOTAL 814 100.00

ANALISIS BIVARIADO

datosf <- datos_finales

t1 <- table1::table1(~SEXO + edad_meses + AREA + TIP_SS + PER_ETN + estrato + GP_DESPLAZ + GP_MIGRANT + GP_POBICFB + GP_VIC_VIO + nom_est_f_caso + Departamento_residencia + Departamento_ocurrencia | Nombre_evento, data = datosf )
t1
MORTALIDAD POR DESNUTRICIÓN
(N=301)
MORTALIDAD POR EDA 0-4 AÑOS
(N=132)
MORTALIDAD POR IRA
(N=381)
Overall
(N=814)
SEXO
F 130 (43.2%) 50 (37.9%) 154 (40.4%) 334 (41.0%)
M 171 (56.8%) 82 (62.1%) 227 (59.6%) 480 (59.0%)
edad_meses
Mean (SD) 9.91 (8.05) 12.5 (11.8) 10.3 (11.1) 10.5 (10.3)
Median [Min, Max] 9.00 [1.00, 48.0] 10.0 [1.00, 48.0] 7.00 [1.00, 48.0] 9.00 [1.00, 48.0]
AREA
1 120 (39.9%) 41 (31.1%) 209 (54.9%) 370 (45.5%)
2 24 (8.0%) 12 (9.1%) 25 (6.6%) 61 (7.5%)
3 157 (52.2%) 79 (59.8%) 147 (38.6%) 383 (47.1%)
TIP_SS
C 5 (1.7%) 7 (5.3%) 54 (14.2%) 66 (8.1%)
E 1 (0.3%) 0 (0%) 0 (0%) 1 (0.1%)
I 5 (1.7%) 4 (3.0%) 6 (1.6%) 15 (1.8%)
N 28 (9.3%) 19 (14.4%) 29 (7.6%) 76 (9.3%)
S 262 (87.0%) 102 (77.3%) 292 (76.6%) 656 (80.6%)
PER_ETN
1 182 (60.5%) 92 (69.7%) 148 (38.8%) 422 (51.8%)
5 15 (5.0%) 5 (3.8%) 24 (6.3%) 44 (5.4%)
6 104 (34.6%) 35 (26.5%) 208 (54.6%) 347 (42.6%)
3 0 (0%) 0 (0%) 1 (0.3%) 1 (0.1%)
estrato
1 262 (87.0%) 119 (90.2%) 263 (69.0%) 644 (79.1%)
2 20 (6.6%) 6 (4.5%) 78 (20.5%) 104 (12.8%)
3 0 (0%) 0 (0%) 21 (5.5%) 21 (2.6%)
Missing 19 (6.3%) 7 (5.3%) 19 (5.0%) 45 (5.5%)
GP_DESPLAZ
1 4 (1.3%) 1 (0.8%) 8 (2.1%) 13 (1.6%)
2 297 (98.7%) 131 (99.2%) 373 (97.9%) 801 (98.4%)
GP_MIGRANT
1 7 (2.3%) 8 (6.1%) 15 (3.9%) 30 (3.7%)
2 294 (97.7%) 124 (93.9%) 366 (96.1%) 784 (96.3%)
GP_POBICFB
1 7 (2.3%) 2 (1.5%) 6 (1.6%) 15 (1.8%)
2 294 (97.7%) 130 (98.5%) 375 (98.4%) 799 (98.2%)
GP_VIC_VIO
1 3 (1.0%) 0 (0%) 0 (0%) 3 (0.4%)
2 298 (99.0%) 132 (100%) 381 (100%) 811 (99.6%)
nom_est_f_caso
Confirmado por Clínica 301 (100%) 130 (98.5%) 234 (61.4%) 665 (81.7%)
Confirmado por laboratorio 0 (0%) 2 (1.5%) 147 (38.6%) 149 (18.3%)
Departamento_residencia
AMAZONAS 1 (0.3%) 2 (1.5%) 6 (1.6%) 9 (1.1%)
ANTIOQUIA 19 (6.3%) 3 (2.3%) 21 (5.5%) 43 (5.3%)
ARAUCA 3 (1.0%) 2 (1.5%) 6 (1.6%) 11 (1.4%)
ATLANTICO 12 (4.0%) 1 (0.8%) 11 (2.9%) 24 (2.9%)
BOLIVAR 16 (5.3%) 1 (0.8%) 22 (5.8%) 39 (4.8%)
BOYACA 1 (0.3%) 1 (0.8%) 8 (2.1%) 10 (1.2%)
CAQUETA 5 (1.7%) 0 (0%) 2 (0.5%) 7 (0.9%)
CESAR 22 (7.3%) 4 (3.0%) 12 (3.1%) 38 (4.7%)
CHOCO 50 (16.6%) 25 (18.9%) 44 (11.5%) 119 (14.6%)
CORDOBA 9 (3.0%) 1 (0.8%) 15 (3.9%) 25 (3.1%)
EXTERIOR 13 (4.3%) 11 (8.3%) 18 (4.7%) 42 (5.2%)
GUAINIA 1 (0.3%) 5 (3.8%) 4 (1.0%) 10 (1.2%)
GUAJIRA 66 (21.9%) 27 (20.5%) 47 (12.3%) 140 (17.2%)
GUAVIARE 1 (0.3%) 0 (0%) 1 (0.3%) 2 (0.2%)
HUILA 5 (1.7%) 1 (0.8%) 6 (1.6%) 12 (1.5%)
MAGDALENA 20 (6.6%) 6 (4.5%) 16 (4.2%) 42 (5.2%)
META 7 (2.3%) 2 (1.5%) 14 (3.7%) 23 (2.8%)
NARIÑO 5 (1.7%) 2 (1.5%) 13 (3.4%) 20 (2.5%)
NORTE SANTANDER 1 (0.3%) 1 (0.8%) 6 (1.6%) 8 (1.0%)
RISARALDA 8 (2.7%) 8 (6.1%) 9 (2.4%) 25 (3.1%)
SANTANDER 4 (1.3%) 6 (4.5%) 7 (1.8%) 17 (2.1%)
SUCRE 2 (0.7%) 3 (2.3%) 5 (1.3%) 10 (1.2%)
TOLIMA 2 (0.7%) 0 (0%) 8 (2.1%) 10 (1.2%)
VALLE 11 (3.7%) 3 (2.3%) 18 (4.7%) 32 (3.9%)
VICHADA 17 (5.6%) 4 (3.0%) 2 (0.5%) 23 (2.8%)
CASANARE 0 (0%) 4 (3.0%) 2 (0.5%) 6 (0.7%)
CAUCA 0 (0%) 7 (5.3%) 13 (3.4%) 20 (2.5%)
PUTUMAYO 0 (0%) 1 (0.8%) 1 (0.3%) 2 (0.2%)
VAUPES 0 (0%) 1 (0.8%) 4 (1.0%) 5 (0.6%)
BOGOTA 0 (0%) 0 (0%) 32 (8.4%) 32 (3.9%)
CALDAS 0 (0%) 0 (0%) 1 (0.3%) 1 (0.1%)
CUNDINAMARCA 0 (0%) 0 (0%) 3 (0.8%) 3 (0.4%)
QUINDIO 0 (0%) 0 (0%) 2 (0.5%) 2 (0.2%)
SAN ANDRES 0 (0%) 0 (0%) 2 (0.5%) 2 (0.2%)
Departamento_ocurrencia
AMAZONAS 1 (0.3%) 2 (1.5%) 6 (1.6%) 9 (1.1%)
ANTIOQUIA 19 (6.3%) 3 (2.3%) 21 (5.5%) 43 (5.3%)
ARAUCA 3 (1.0%) 2 (1.5%) 5 (1.3%) 10 (1.2%)
ATLANTICO 12 (4.0%) 1 (0.8%) 11 (2.9%) 24 (2.9%)
BOLIVAR 16 (5.3%) 1 (0.8%) 21 (5.5%) 38 (4.7%)
BOYACA 1 (0.3%) 1 (0.8%) 9 (2.4%) 11 (1.4%)
CALDAS 1 (0.3%) 0 (0%) 1 (0.3%) 2 (0.2%)
CAQUETA 5 (1.7%) 0 (0%) 2 (0.5%) 7 (0.9%)
CESAR 22 (7.3%) 4 (3.0%) 13 (3.4%) 39 (4.8%)
CHOCO 49 (16.3%) 26 (19.7%) 43 (11.3%) 118 (14.5%)
CORDOBA 9 (3.0%) 1 (0.8%) 15 (3.9%) 25 (3.1%)
EXTERIOR 10 (3.3%) 6 (4.5%) 14 (3.7%) 30 (3.7%)
GUAINIA 1 (0.3%) 5 (3.8%) 4 (1.0%) 10 (1.2%)
GUAJIRA 69 (22.9%) 30 (22.7%) 49 (12.9%) 148 (18.2%)
GUAVIARE 1 (0.3%) 0 (0%) 1 (0.3%) 2 (0.2%)
HUILA 5 (1.7%) 1 (0.8%) 6 (1.6%) 12 (1.5%)
MAGDALENA 20 (6.6%) 6 (4.5%) 15 (3.9%) 41 (5.0%)
META 11 (3.7%) 3 (2.3%) 14 (3.7%) 28 (3.4%)
NARIÑO 5 (1.7%) 2 (1.5%) 13 (3.4%) 20 (2.5%)
NORTE SANTANDER 1 (0.3%) 2 (1.5%) 6 (1.6%) 9 (1.1%)
QUINDIO 1 (0.3%) 0 (0%) 2 (0.5%) 3 (0.4%)
RISARALDA 8 (2.7%) 8 (6.1%) 9 (2.4%) 25 (3.1%)
SANTANDER 4 (1.3%) 6 (4.5%) 7 (1.8%) 17 (2.1%)
SUCRE 2 (0.7%) 3 (2.3%) 4 (1.0%) 9 (1.1%)
TOLIMA 2 (0.7%) 0 (0%) 8 (2.1%) 10 (1.2%)
VALLE 10 (3.3%) 2 (1.5%) 19 (5.0%) 31 (3.8%)
VICHADA 13 (4.3%) 4 (3.0%) 3 (0.8%) 20 (2.5%)
CASANARE 0 (0%) 4 (3.0%) 2 (0.5%) 6 (0.7%)
CAUCA 0 (0%) 7 (5.3%) 13 (3.4%) 20 (2.5%)
PUTUMAYO 0 (0%) 1 (0.8%) 2 (0.5%) 3 (0.4%)
VAUPES 0 (0%) 1 (0.8%) 3 (0.8%) 4 (0.5%)
BOGOTA 0 (0%) 0 (0%) 34 (8.9%) 34 (4.2%)
CUNDINAMARCA 0 (0%) 0 (0%) 4 (1.0%) 4 (0.5%)
SAN ANDRES 0 (0%) 0 (0%) 2 (0.5%) 2 (0.2%)
v1 = table(datosf$COD_EVE, datosf$SEXO)
rownames(v1) <- c( "112", "590", "600")
colnames(v1) <- c("F", "H") 
addmargins(v1)
##      
##         F   H Sum
##   112 130 171 301
##   590  50  82 132
##   600 154 227 381
##   Sum 334 480 814
library(CGPfunctions)
## Warning: package 'CGPfunctions' was built under R version 4.3.3
## Warning in .recacheSubclasses(def@className, def, env): undefined subclass
## "ndiMatrix" of class "replValueSp"; definition not updated
PlotXTabs2(data=datosf,x=SEXO,y=COD_EVE)

v2 = table(datosf$COD_EVE, datosf$AREA)
rownames(v2) <- c( "112", "590", "600")
colnames(v2) <- c("1", "2", "3") 
addmargins(v2)
##      
##         1   2   3 Sum
##   112 120  24 157 301
##   590  41  12  79 132
##   600 209  25 147 381
##   Sum 370  61 383 814
PlotXTabs2(data=datosf,x=AREA,y=COD_EVE)

v3 = table(datosf$COD_EVE, datosf$TIP_SS)
rownames(v3) <- c( "112", "590", "600")
colnames(v3) <- c("C", "E", "I", "N", "S") 
addmargins(v3)
##      
##         C   E   I   N   S Sum
##   112   5   1   5  28 262 301
##   590   7   0   4  19 102 132
##   600  54   0   6  29 292 381
##   Sum  66   1  15  76 656 814
PlotXTabs2(data=datosf,x=TIP_SS,y=COD_EVE)

v4 = table(datosf$COD_EVE, datosf$PER_ETN)
rownames(v4) <- c( "112", "590", "600")
colnames(v4) <- c("1", "3", "5", "6") 
addmargins(v4)
##      
##         1   3   5   6 Sum
##   112 182   0  15 104 301
##   590  92   0   5  35 132
##   600 148   1  24 208 381
##   Sum 422   1  44 347 814
PlotXTabs2(data=datosf,x=PER_ETN,y=COD_EVE)

v5 = table(datosf$COD_EVE, datosf$estrato)
rownames(v5) <- c( "112", "590", "600")
colnames(v5) <- c("1", "2", "3") 
addmargins(v5)
##      
##         1   2   3 Sum
##   112 262  20   0 282
##   590 119   6   0 125
##   600 263  78  21 362
##   Sum 644 104  21 769
PlotXTabs2(data=datosf,x=estrato,y=COD_EVE)

v6 = table(datosf$COD_EVE, datosf$GP_DESPLAZ)
rownames(v6) <- c( "112", "590", "600")
colnames(v6) <- c("1", "2") 
addmargins(v6)
##      
##         1   2 Sum
##   112   4 297 301
##   590   1 131 132
##   600   8 373 381
##   Sum  13 801 814
PlotXTabs2(data=datosf,x=GP_DESPLAZ,y=COD_EVE)

v7 = table(datosf$COD_EVE, datosf$GP_MIGRANT)
rownames(v7) <- c( "112", "590", "600")
colnames(v7) <- c("1", "2") 
addmargins(v7)
##      
##         1   2 Sum
##   112   7 294 301
##   590   8 124 132
##   600  15 366 381
##   Sum  30 784 814
PlotXTabs2(data=datosf,x=GP_MIGRANT,y=COD_EVE)

v8 = table(datosf$COD_EVE, datosf$GP_POBICFB)
rownames(v8) <- c( "112", "590", "600")
colnames(v8) <- c("1", "2") 
addmargins(v8)
##      
##         1   2 Sum
##   112   7 294 301
##   590   2 130 132
##   600   6 375 381
##   Sum  15 799 814
PlotXTabs2(data=datosf,x=GP_POBICFB,y=COD_EVE)

v9 = table(datosf$COD_EVE, datosf$GP_VIC_VIO)
rownames(v9) <- c( "112", "590", "600")
colnames(v9) <- c("1", "2") 
addmargins(v9)
##      
##         1   2 Sum
##   112   3 298 301
##   590   0 132 132
##   600   0 381 381
##   Sum   3 811 814
PlotXTabs2(data=datosf,x=GP_VIC_VIO,y=COD_EVE)

v10 = table(datosf$COD_EVE, datosf$nom_est_f_caso)
rownames(v10) <- c( "112", "590", "600")
colnames(v10) <- c("Confirmado por Clínica", "") 
addmargins(v10)
##      
##       Confirmado por Clínica     Sum
##   112                    301   0 301
##   590                    130   2 132
##   600                    234 147 381
##   Sum                    665 149 814
PlotXTabs2(data=datosf,x=nom_est_f_caso,y=COD_EVE)

ANALISIS FECHAS

DIFERENCIA EN DIAS ENTRE INICIO DE SINTOMAS Y FECHA DE DEFUNCIÓN (DIAS_ENFER)

datos <- datos %>%
  mutate(
    FEC_DEF = as.Date(FEC_DEF),
    INI_SIN = as.Date(INI_SIN),
    DIAS_ENFER = as.numeric(FEC_DEF - INI_SIN)
  )

DIFERENCIA ENTRE INICIO DE SINTOMAS Y FECHA DE CONSULTA (DIAS_CON)

datos <- datos %>%
  mutate(
    FEC_CON = as.Date(FEC_CON),
    INI_SIN = as.Date(INI_SIN),
    DIAS_CON = as.numeric(FEC_CON - INI_SIN)
  )

DIFERENCIA ENTRE FECHA DE CONSULTA Y FECHA DE NOTIFICACIÓN (DIAS_NOTI)

datos <- datos %>%
  mutate(
    FEC_NOT = as.Date(FEC_CON),
    FEC_CON = as.Date(INI_SIN),
    DIAS_NOTI = as.numeric(FEC_NOT - FEC_CON)
  )

ANALISIS DE DIFERENCIA DE FECHAS GENERAL

library(summarytools)

# Filtrar solo las variables numéricas que nos interesan
variables_numericas <- datos %>%
  select(DIAS_ENFER, DIAS_CON, DIAS_NOTI)

estadisticas_detalladas <- descr(variables_numericas)
print(estadisticas_detalladas)
## Descriptive Statistics  
## variables_numericas  
## N: 814  
## 
##                     DIAS_CON   DIAS_ENFER   DIAS_NOTI
## ----------------- ---------- ------------ -----------
##              Mean       5.99        10.07        5.99
##           Std.Dev      14.15        19.04       14.15
##               Min       0.00         0.00        0.00
##                Q1       0.00         2.00        0.00
##            Median       3.00         5.00        3.00
##                Q3       6.00        12.00        6.00
##               Max     232.00       265.00      232.00
##               MAD       4.45         5.93        4.45
##               IQR       6.00        10.00        6.00
##                CV       2.36         1.89        2.36
##          Skewness       9.07         7.33        9.07
##       SE.Skewness       0.09         0.09        0.09
##          Kurtosis     113.42        75.63      113.42
##           N.Valid     813.00       814.00      813.00
##         Pct.Valid      99.88       100.00       99.88

ANALISIS DE DIFERENCIA DE DIAS POR COD_EVENTO

estadisticas_especificas <- datos %>%
  filter(COD_EVE %in% c(112, 590, 600)) %>%
  group_by(COD_EVE) %>%
  select(DIAS_ENFER, DIAS_CON, DIAS_NOTI) %>%
  descr(stats = c("mean", "med", "sd", "min", "max"),
        transpose = TRUE)
## Adding missing grouping variables: `COD_EVE`
print(estadisticas_especificas)
## Descriptive Statistics  
## datos  
## Group: COD_EVE = 112  
## N: 301  
## 
##                     Mean   Median   Std.Dev    Min      Max
## ---------------- ------- -------- --------- ------ --------
##         DIAS_CON    8.14     3.00     19.56   0.00   232.00
##       DIAS_ENFER   12.42     7.00     21.58   0.00   237.00
##        DIAS_NOTI    8.14     3.00     19.56   0.00   232.00
## 
## Group: COD_EVE = 590  
## N: 132  
## 
##                    Mean   Median   Std.Dev    Min      Max
## ---------------- ------ -------- --------- ------ --------
##         DIAS_CON   4.91     2.00     12.92   0.00   138.00
##       DIAS_ENFER   6.45     3.00     13.36   0.00   138.00
##        DIAS_NOTI   4.91     2.00     12.92   0.00   138.00
## 
## Group: COD_EVE = 600  
## N: 381  
## 
##                    Mean   Median   Std.Dev    Min      Max
## ---------------- ------ -------- --------- ------ --------
##         DIAS_CON   4.67     3.00      7.90   0.00    74.00
##       DIAS_ENFER   9.46     5.00     18.36   0.00   265.00
##        DIAS_NOTI   4.67     3.00      7.90   0.00    74.00
datos_largo <- datos %>%
  select(COD_EVE, DIAS_ENFER, DIAS_CON, DIAS_NOTI) %>%
  pivot_longer(cols = c(DIAS_ENFER, DIAS_CON, DIAS_NOTI),
               names_to = "Variable",
               values_to = "Valor")

# Boxplot múltiple con facetas
ggplot(datos_largo, aes(x = as.factor(COD_EVE), y = Valor)) +
  geom_boxplot(aes(fill = Variable), alpha = 0.7) +
  facet_wrap(~ Variable, scales = "free_y") +
  labs(title = "Boxplots de Variables Numéricas por evento",
       x = "COD_EVE",
       y = "Valor") +
  theme_minimal() +
  scale_x_discrete(labels = c("112", "590", "600")) +
  theme(legend.position = "none")  
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

ANALISIS DE CAUSAS BASICAS DE MUERTE (CIE-10)

library(writexl)
## Warning: package 'writexl' was built under R version 4.3.3
# Crear subset con solo las variables COD_EVE y CBMTE
subset_causas <- datos %>%
  select(COD_EVE, CBMTE)

# Ver las primeras filas del subset
head(subset_causas)
## # A tibble: 6 × 2
##   COD_EVE CBMTE
##   <chr>   <chr>
## 1 112     A09X 
## 2 112     E46X 
## 3 112     E40X 
## 4 112     J189 
## 5 112     E46X 
## 6 112     P369
# Exportar a Excel
#write_xlsx(subset_causas, "CBMTE.xlsx")
# Frecuencias absolutas y relativas
frecuencias_COD_EVE <- subset_causas %>%
  count(COD_EVE) %>%
  mutate(porcentaje = n/sum(n)*100)

frecuencias_CBMTE <- subset_causas %>%
  count(CBMTE) %>%
  arrange(desc(n)) %>%
  mutate(porcentaje = n/sum(n)*100)

print(frecuencias_COD_EVE)
## # A tibble: 3 × 3
##   COD_EVE     n porcentaje
##   <chr>   <int>      <dbl>
## 1 112       301       37.0
## 2 590       132       16.2
## 3 600       381       46.8
print(head(frecuencias_CBMTE, 20)) # Top 20 causas
## # A tibble: 20 × 3
##    CBMTE     n porcentaje
##    <chr> <int>      <dbl>
##  1 A09X    102      12.5 
##  2 E43X     94      11.5 
##  3 J189     67       8.23
##  4 J960     59       7.25
##  5 R572     51       6.27
##  6 E46X     42       5.16
##  7 J158     29       3.56
##  8 J159     25       3.07
##  9 A419     18       2.21
## 10 E440     18       2.21
## 11 J129     17       2.09
## 12 J969     16       1.97
## 13 R571     16       1.97
## 14 I469     15       1.84
## 15 J22X     13       1.60
## 16 J219     12       1.47
## 17 J180     11       1.35
## 18 E640     10       1.23
## 19 J069     10       1.23
## 20 R092     10       1.23
# Tabla de contingencia
tabla_contingencia <- table(subset_causas$COD_EVE, subset_causas$CBMTE)

# Prueba chi-cuadrado de independencia
chi_cuadrado <- chisq.test(tabla_contingencia)
## Warning in chisq.test(tabla_contingencia): Chi-squared approximation may be
## incorrect
print(chi_cuadrado)
## 
##  Pearson's Chi-squared test
## 
## data:  tabla_contingencia
## X-squared = 963.35, df = 218, p-value < 2.2e-16
# Coeficiente V de Cramer (medida de asociación)
library(vcd)
## Warning: package 'vcd' was built under R version 4.3.3
## Loading required package: grid
cramer_v <- assocstats(tabla_contingencia)$cramer
print(paste("V de Cramer:", cramer_v))
## [1] "V de Cramer: 0.769245633323916"
# Principales causas por COD_EVE
causas_por_grupo <- subset_causas %>%
  group_by(COD_EVE, CBMTE) %>%
  summarise(n = n(), .groups = 'drop') %>%
  group_by(COD_EVE) %>%
  arrange(COD_EVE, desc(n)) %>%
  mutate(porcentaje_grupo = n/sum(n)*100,
         rank = row_number())

# Top 5 causas por grupo
top_causas <- causas_por_grupo %>%
  filter(rank <= 5)

print(top_causas)
## # A tibble: 15 × 5
## # Groups:   COD_EVE [3]
##    COD_EVE CBMTE     n porcentaje_grupo  rank
##    <chr>   <chr> <int>            <dbl> <int>
##  1 112     E43X     90            29.9      1
##  2 112     E46X     39            13.0      2
##  3 112     R572     24             7.97     3
##  4 112     A09X     18             5.98     4
##  5 112     E440     18             5.98     5
##  6 590     A09X     75            56.8      1
##  7 590     R571      9             6.82     2
##  8 590     A419      5             3.79     3
##  9 590     I469      5             3.79     4
## 10 590     E46X      3             2.27     5
## 11 600     J189     59            15.5      1
## 12 600     J960     51            13.4      2
## 13 600     J158     25             6.56     3
## 14 600     J159     24             6.30     4
## 15 600     R572     24             6.30     5
# Mapa de calor de frecuencias
library(ggplot2)

heatmap_data <- causas_por_grupo %>%
  filter(rank <= 10) # Top 10 causas por grupo

ggplot(heatmap_data, aes(x = factor(COD_EVE), y = reorder(CBMTE, rank), 
                         fill = n)) +
  geom_tile() +
  scale_fill_gradient(low = "white", high = "lightblue") +
  labs(title = "Frecuencia de Causas CIE-10 por COD_EVE",
       x = "COD_EVE", y = "CBMTE (Causa CIE-10)") +
  theme_minimal()

library(FactoMineR)
## Warning: package 'FactoMineR' was built under R version 4.3.3
library(factoextra)
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(ggplot2)
library(dplyr)
library(RColorBrewer)
library(ggrepel)

# Configurar tema profesional
theme_profesional <- theme_minimal() +
  theme(
    text = element_text(family = "sans", size = 12),
    plot.title = element_text(face = "bold", size = 16, hjust = 0.5),
    plot.subtitle = element_text(size = 12, hjust = 0.5, color = "gray50"),
    axis.title = element_text(face = "bold", size = 12),
    legend.title = element_text(face = "bold"),
    panel.grid.major = element_line(color = "gray90"),
    panel.grid.minor = element_blank(),
    plot.background = element_rect(fill = "white", color = NA)
  )

# Preparar datos filtrados para mejor visualización
causas_frecuentes <- subset_causas %>%
  count(CBMTE) %>%
  filter(n >= 5) %>% # Aumentar el umbral para mayor claridad
  pull(CBMTE)

datos_filtrados <- subset_causas %>%
  filter(CBMTE %in% causas_frecuentes) %>%
  mutate(COD_EVE = as.factor(COD_EVE),
         CBMTE = as.factor(CBMTE))

# Realizar ACM
acm_mejorado <- MCA(datos_filtrados[, c("COD_EVE", "CBMTE")], 
                    graph = FALSE, 
                    ncp = 5) # Mantener más componentes para mejor calidad

# Extraer coordenadas para personalización
coordenadas_var <- as.data.frame(acm_mejorado$var$coord)
coordenadas_var$Variable <- rownames(coordenadas_var)
coordenadas_var$Tipo <- ifelse(grepl("^112|^590|^600", coordenadas_var$Variable), 
                              "COD_EVE", "CBMTE")
coordenadas_var$Codigo <- coordenadas_var$Variable

# Crear paletas de colores profesionales
paleta_cod_eve <- c(
  "112" = "#1f77b4",  # Azul profesional
  "590" = "#ff7f0e",  # Naranja profesional  
  "600" = "#2ca02c"   # Verde profesional
)

# Paleta para CBMTE - variaciones de los mismos colores por categoría
generar_paleta_cbmtc <- function(cod_eve, n_colores) {
  color_base <- paleta_cod_eve[cod_eve]
  
  if (cod_eve == "112") {
    return(colorRampPalette(c("#1f77b4", "#aec7e8"))(n_colores)) # Azules
  } else if (cod_eve == "590") {
    return(colorRampPalette(c("#ff7f0e", "#ffbb78"))(n_colores)) # Naranjas
  } else if (cod_eve == "600") {
    return(colorRampPalette(c("#2ca02c", "#98df8a"))(n_colores)) # Verdes
  }
}

# Asignar colores a cada CBMTE basado en su COD_EVE predominante
asignar_colores_cbmtc <- function(subset_causas) {
  predominio <- subset_causas %>%
    count(COD_EVE, CBMTE) %>%
    group_by(CBMTE) %>%
    slice_max(n, n = 1) %>%
    ungroup()
  
  colores_cbmtc <- c()
  for (cod in c("112", "590", "600")) {
    cbmtcs_cod <- predominio %>% 
      filter(COD_EVE == cod) %>% 
      pull(CBMTE)
    n_colores <- length(cbmtcs_cod)
    if (n_colores > 0) {
      paleta <- generar_paleta_cbmtc(cod, n_colores)
      colores_cbmtc <- c(colores_cbmtc, setNames(paleta, cbmtcs_cod))
    }
  }
  return(colores_cbmtc)
}

colores_cbmtc <- asignar_colores_cbmtc(datos_filtrados)


# Gráfico principal del ACM
grafico_acm <- fviz_mca_var(acm_mejorado, 
                            repel = TRUE,
                            col.var = "contrib",
                            gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
                            alpha.var = "contrib",
                            shape.var = 15,
                            pointsize = 2) +
  theme_profesional +
  labs(title = "Análisis de Correspondencias Múltiples",
       subtitle = "Relación entre evento y causa basica de muerte (CIE-10)",
       x = paste("Dimensión 1 (", round(acm_mejorado$eig[1,2], 1), "%)", sep = ""),
       y = paste("Dimensión 2 (", round(acm_mejorado$eig[2,2], 1), "%)", sep = "")) +
  scale_color_gradient2(low = "blue", mid = "green", high = "red", 
                        midpoint = median(acm_mejorado$var$contrib[,1]),
                        name = "Contribución") +
  theme(legend.position = "right")
## Scale for colour is already present.
## Adding another scale for colour, which will replace the existing scale.
print(grafico_acm)

# Gráfico de eigenvalues (varianza explicada)
fviz_eig(acm_mejorado, 
         addlabels = TRUE, 
         ylim = c(0, 50),
         barfill = "#1f77b4",
         barcolor = "#1f77b4") +
  theme_profesional +
  labs(title = "Varianza Explicada por Cada Dimensión",
       subtitle = "Calidad de la representación en el ACM")

# Contribución de variables a las dimensiones
fviz_contrib(acm_mejorado, choice = "var", axes = 1, top = 15) +
  theme_profesional +
  labs(title = "Contribución de Variables a la Dimensión 1")

fviz_contrib(acm_mejorado, choice = "var", axes = 2, top = 15) +
  theme_profesional +
  labs(title = "Contribución de Variables a la Dimensión 2")

# Análisis cualitativo de patrones
patrones_interpretacion <- top_causas %>%
  group_by(COD_EVE) %>%
  summarise(
    causas_principales = paste(CBMTE, collapse = ", "),
    perfil_epidemiologico = case_when(
      any(grepl("^E40|^E43|^E46", CBMTE)) ~ "Desnutrición",
      any(grepl("^J18|^J12|^J15", CBMTE)) ~ "Infecciones respiratorias",
      any(grepl("^A09", CBMTE)) ~ "Gastroenteritis",
      TRUE ~ "Mixto"
    )
  )

print(patrones_interpretacion)
## # A tibble: 3 × 3
##   COD_EVE causas_principales           perfil_epidemiologico    
##   <chr>   <chr>                        <chr>                    
## 1 112     E43X, E46X, R572, A09X, E440 Desnutrición             
## 2 590     A09X, R571, A419, I469, E46X Desnutrición             
## 3 600     J189, J960, J158, J159, R572 Infecciones respiratorias

RIESGO RELATIVO

EVENTO 112

subset_112 <- subset(datosf, COD_EVE == 112)
library(dplyr)
# Crear variable indicadora
datos_112 <- datosf %>%
  mutate(Mortalidad_DNT = ifelse(COD_EVE == 112, "Sí", "No"))

# Tabla comparativa
t2 <- table1::table1(~ SEXO + edad_meses + AREA + TIP_SS + PER_ETN + estrato + 
                     GP_DESPLAZ + GP_MIGRANT + GP_POBICFB + GP_VIC_VIO + 
                     nom_est_f_caso + Departamento_residencia + Departamento_ocurrencia | 
                     Mortalidad_DNT, 
                   data = datos_112)
t2
No
(N=513)

(N=301)
Overall
(N=814)
SEXO
F 204 (39.8%) 130 (43.2%) 334 (41.0%)
M 309 (60.2%) 171 (56.8%) 480 (59.0%)
edad_meses
Mean (SD) 10.8 (11.3) 9.91 (8.05) 10.5 (10.3)
Median [Min, Max] 8.00 [1.00, 48.0] 9.00 [1.00, 48.0] 9.00 [1.00, 48.0]
AREA
1 250 (48.7%) 120 (39.9%) 370 (45.5%)
2 37 (7.2%) 24 (8.0%) 61 (7.5%)
3 226 (44.1%) 157 (52.2%) 383 (47.1%)
TIP_SS
C 61 (11.9%) 5 (1.7%) 66 (8.1%)
I 10 (1.9%) 5 (1.7%) 15 (1.8%)
N 48 (9.4%) 28 (9.3%) 76 (9.3%)
S 394 (76.8%) 262 (87.0%) 656 (80.6%)
E 0 (0%) 1 (0.3%) 1 (0.1%)
PER_ETN
1 240 (46.8%) 182 (60.5%) 422 (51.8%)
3 1 (0.2%) 0 (0%) 1 (0.1%)
5 29 (5.7%) 15 (5.0%) 44 (5.4%)
6 243 (47.4%) 104 (34.6%) 347 (42.6%)
estrato
1 382 (74.5%) 262 (87.0%) 644 (79.1%)
2 84 (16.4%) 20 (6.6%) 104 (12.8%)
3 21 (4.1%) 0 (0%) 21 (2.6%)
Missing 26 (5.1%) 19 (6.3%) 45 (5.5%)
GP_DESPLAZ
1 9 (1.8%) 4 (1.3%) 13 (1.6%)
2 504 (98.2%) 297 (98.7%) 801 (98.4%)
GP_MIGRANT
1 23 (4.5%) 7 (2.3%) 30 (3.7%)
2 490 (95.5%) 294 (97.7%) 784 (96.3%)
GP_POBICFB
1 8 (1.6%) 7 (2.3%) 15 (1.8%)
2 505 (98.4%) 294 (97.7%) 799 (98.2%)
GP_VIC_VIO
2 513 (100%) 298 (99.0%) 811 (99.6%)
1 0 (0%) 3 (1.0%) 3 (0.4%)
nom_est_f_caso
Confirmado por Clínica 364 (71.0%) 301 (100%) 665 (81.7%)
Confirmado por laboratorio 149 (29.0%) 0 (0%) 149 (18.3%)
Departamento_residencia
AMAZONAS 8 (1.6%) 1 (0.3%) 9 (1.1%)
ANTIOQUIA 24 (4.7%) 19 (6.3%) 43 (5.3%)
ARAUCA 8 (1.6%) 3 (1.0%) 11 (1.4%)
ATLANTICO 12 (2.3%) 12 (4.0%) 24 (2.9%)
BOGOTA 32 (6.2%) 0 (0%) 32 (3.9%)
BOLIVAR 23 (4.5%) 16 (5.3%) 39 (4.8%)
BOYACA 9 (1.8%) 1 (0.3%) 10 (1.2%)
CALDAS 1 (0.2%) 0 (0%) 1 (0.1%)
CAQUETA 2 (0.4%) 5 (1.7%) 7 (0.9%)
CASANARE 6 (1.2%) 0 (0%) 6 (0.7%)
CAUCA 20 (3.9%) 0 (0%) 20 (2.5%)
CESAR 16 (3.1%) 22 (7.3%) 38 (4.7%)
CHOCO 69 (13.5%) 50 (16.6%) 119 (14.6%)
CORDOBA 16 (3.1%) 9 (3.0%) 25 (3.1%)
CUNDINAMARCA 3 (0.6%) 0 (0%) 3 (0.4%)
EXTERIOR 29 (5.7%) 13 (4.3%) 42 (5.2%)
GUAINIA 9 (1.8%) 1 (0.3%) 10 (1.2%)
GUAJIRA 74 (14.4%) 66 (21.9%) 140 (17.2%)
GUAVIARE 1 (0.2%) 1 (0.3%) 2 (0.2%)
HUILA 7 (1.4%) 5 (1.7%) 12 (1.5%)
MAGDALENA 22 (4.3%) 20 (6.6%) 42 (5.2%)
META 16 (3.1%) 7 (2.3%) 23 (2.8%)
NARIÑO 15 (2.9%) 5 (1.7%) 20 (2.5%)
NORTE SANTANDER 7 (1.4%) 1 (0.3%) 8 (1.0%)
PUTUMAYO 2 (0.4%) 0 (0%) 2 (0.2%)
QUINDIO 2 (0.4%) 0 (0%) 2 (0.2%)
RISARALDA 17 (3.3%) 8 (2.7%) 25 (3.1%)
SAN ANDRES 2 (0.4%) 0 (0%) 2 (0.2%)
SANTANDER 13 (2.5%) 4 (1.3%) 17 (2.1%)
SUCRE 8 (1.6%) 2 (0.7%) 10 (1.2%)
TOLIMA 8 (1.6%) 2 (0.7%) 10 (1.2%)
VALLE 21 (4.1%) 11 (3.7%) 32 (3.9%)
VAUPES 5 (1.0%) 0 (0%) 5 (0.6%)
VICHADA 6 (1.2%) 17 (5.6%) 23 (2.8%)
Departamento_ocurrencia
AMAZONAS 8 (1.6%) 1 (0.3%) 9 (1.1%)
ANTIOQUIA 24 (4.7%) 19 (6.3%) 43 (5.3%)
ARAUCA 7 (1.4%) 3 (1.0%) 10 (1.2%)
ATLANTICO 12 (2.3%) 12 (4.0%) 24 (2.9%)
BOGOTA 34 (6.6%) 0 (0%) 34 (4.2%)
BOLIVAR 22 (4.3%) 16 (5.3%) 38 (4.7%)
BOYACA 10 (1.9%) 1 (0.3%) 11 (1.4%)
CALDAS 1 (0.2%) 1 (0.3%) 2 (0.2%)
CAQUETA 2 (0.4%) 5 (1.7%) 7 (0.9%)
CASANARE 6 (1.2%) 0 (0%) 6 (0.7%)
CAUCA 20 (3.9%) 0 (0%) 20 (2.5%)
CESAR 17 (3.3%) 22 (7.3%) 39 (4.8%)
CHOCO 69 (13.5%) 49 (16.3%) 118 (14.5%)
CORDOBA 16 (3.1%) 9 (3.0%) 25 (3.1%)
CUNDINAMARCA 4 (0.8%) 0 (0%) 4 (0.5%)
EXTERIOR 20 (3.9%) 10 (3.3%) 30 (3.7%)
GUAINIA 9 (1.8%) 1 (0.3%) 10 (1.2%)
GUAJIRA 79 (15.4%) 69 (22.9%) 148 (18.2%)
GUAVIARE 1 (0.2%) 1 (0.3%) 2 (0.2%)
HUILA 7 (1.4%) 5 (1.7%) 12 (1.5%)
MAGDALENA 21 (4.1%) 20 (6.6%) 41 (5.0%)
META 17 (3.3%) 11 (3.7%) 28 (3.4%)
NARIÑO 15 (2.9%) 5 (1.7%) 20 (2.5%)
NORTE SANTANDER 8 (1.6%) 1 (0.3%) 9 (1.1%)
PUTUMAYO 3 (0.6%) 0 (0%) 3 (0.4%)
QUINDIO 2 (0.4%) 1 (0.3%) 3 (0.4%)
RISARALDA 17 (3.3%) 8 (2.7%) 25 (3.1%)
SAN ANDRES 2 (0.4%) 0 (0%) 2 (0.2%)
SANTANDER 13 (2.5%) 4 (1.3%) 17 (2.1%)
SUCRE 7 (1.4%) 2 (0.7%) 9 (1.1%)
TOLIMA 8 (1.6%) 2 (0.7%) 10 (1.2%)
VALLE 21 (4.1%) 10 (3.3%) 31 (3.8%)
VAUPES 4 (0.8%) 0 (0%) 4 (0.5%)
VICHADA 7 (1.4%) 13 (4.3%) 20 (2.5%)

ANALISIS VARIABLE EDAD EN MESES

# Estadísticos básicos con summary


summary(datos_112$edad_meses)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1.00    4.00    9.00   10.49   12.00   48.00
# O de manera más detallada
estadisticos_edad <- datos_112 %>%
  summarise(
    n = n(),
    n_no_na = sum(!is.na(edad_meses)),
    media = mean(edad_meses, na.rm = TRUE),
    mediana = median(edad_meses, na.rm = TRUE),
    desviacion = sd(edad_meses, na.rm = TRUE),
    minimo = min(edad_meses, na.rm = TRUE),
    maximo = max(edad_meses, na.rm = TRUE),
    q1 = quantile(edad_meses, 0.25, na.rm = TRUE),
    q3 = quantile(edad_meses, 0.75, na.rm = TRUE),
    rango_iqr = IQR(edad_meses, na.rm = TRUE)
  )

print(estadisticos_edad)
## # A tibble: 1 × 10
##       n n_no_na media mediana desviacion minimo maximo    q1    q3 rango_iqr
##   <int>   <int> <dbl>   <dbl>      <dbl>  <dbl>  <dbl> <dbl> <dbl>     <dbl>
## 1   814     814  10.5       9       10.3      1     48     4    12         8
library(ggplot2)
# Histograma con curva de densidad
ggplot(datos_112, aes(x = edad_meses)) +
  geom_histogram(aes(y = ..density..), 
                 fill = "lightblue", color = "black", alpha = 0.7, bins = 30) +
  geom_density(alpha = 0.2, fill = "red") +
  labs(title = "Distribución de Edad en Meses con Curva de Densidad",
       x = "Edad (meses)",
       y = "Densidad") +
  theme_minimal()
## Warning: The dot-dot notation (`..density..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(density)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

GRUPO DE EDAD CADA 6 MESES

datos_112 <- datos_112 %>%
  mutate(
    edad_grupo_6meses = cut(edad_meses,
                           breaks = seq(0, 60, by = 6),
                           labels = c("0-6", "7-12", "13-18", "19-24", "25-30", 
                                     "31-36", "37-42", "43-48", "49-54", "55-69"),
                           include.lowest = TRUE,
                           right = FALSE)
  )
# Tabla de frecuencias simple
tabla_edad_grupo2 <- datos_112 %>%
  count(edad_grupo_6meses) %>%
  arrange(edad_grupo_6meses) %>%
  mutate(
    porcentaje = round(n / sum(n) * 100, 2),
    porcentaje_acumulado = round(cumsum(porcentaje), 2)
  )

print(tabla_edad_grupo2, n = Inf)
## # A tibble: 6 × 4
##   edad_grupo_6meses     n porcentaje porcentaje_acumulado
##   <fct>             <int>      <dbl>                <dbl>
## 1 0-6                 303      37.2                  37.2
## 2 7-12                203      24.9                  62.2
## 3 13-18               194      23.8                  86.0
## 4 25-30                59       7.25                 93.2
## 5 37-42                31       3.81                 97.0
## 6 49-54                24       2.95                100

GRUPO 6 MESES PARA EVENTO 112

tabla_edad_grupo_2_112 <- datos_112 %>%
  filter(COD_EVE == 112) %>%
  count(edad_grupo_6meses) %>%
  arrange(edad_grupo_6meses) %>%
  mutate(
    porcentaje = round(n / sum(n) * 100, 2),
    porcentaje_acumulado = round(cumsum(porcentaje), 2)
  )

print(tabla_edad_grupo_2_112, n = Inf)
## # A tibble: 6 × 4
##   edad_grupo_6meses     n porcentaje porcentaje_acumulado
##   <fct>             <int>      <dbl>                <dbl>
## 1 0-6                  94      31.2                  31.2
## 2 7-12                 83      27.6                  58.8
## 3 13-18                98      32.6                  91.4
## 4 25-30                18       5.98                 97.3
## 5 37-42                 1       0.33                 97.7
## 6 49-54                 7       2.33                100

CALCULO DE RIESGOS RELATIVOS PARA 112

SEXO

library(epiR)
## Loading required package: survival
## Warning: package 'survival' was built under R version 4.3.3
## Package epiR 2.0.84 is loaded
## Type help(epi.about) for summary information
## Type browseVignettes(package = 'epiR') to learn how to use epiR for applied epidemiological analyses
## 
sexo_tabla <- matrix(c(130, 204, 171, 309), nrow = 2, byrow = TRUE)
colnames(sexo_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(sexo_tabla) <- c("Femenino","Masculino")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_sexo <- epi.2by2(dat = sexo_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_sexo)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+         130         204        334     38.92 (33.66 to 44.38)
## Exposure-         171         309        480     35.62 (31.34 to 40.09)
## Total             301         513        814     36.98 (33.65 to 40.40)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.09 (0.91, 1.31)
## Inc odds ratio                                 1.15 (0.86, 1.54)
## Attrib risk in the exposed *                   3.30 (-3.46, 10.06)
## Attrib fraction in the exposed (%)            8.47 (-9.77, 23.47)
## Attrib risk in the population *                1.35 (-4.06, 6.77)
## Attrib fraction in the population (%)         3.66 (0.76, 6.88)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.919 Pr>chi2 = 0.338
## Fisher exact test that OR = 1: Pr>chi2 = 0.339
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

AREA

CABECERA MUNICIPAL Y CENTRO POBLADO

area_tabla <- matrix(c(24, 37, 120, 250), nrow = 2, byrow = TRUE)
colnames(area_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(area_tabla) <- c("Centro Poblado","Cabecera Municipal")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_area <- epi.2by2(dat = area_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_area)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          24          37         61     39.34 (27.07 to 52.69)
## Exposure-         120         250        370     32.43 (27.68 to 37.46)
## Total             144         287        431     33.41 (28.97 to 38.08)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.21 (0.86, 1.71)
## Inc odds ratio                                 1.35 (0.77, 2.36)
## Attrib risk in the exposed *                   6.91 (-6.24, 20.07)
## Attrib fraction in the exposed (%)            17.57 (-18.84, 40.06)
## Attrib risk in the population *                0.98 (-5.55, 7.50)
## Attrib fraction in the population (%)         2.93 (1.62, 4.43)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 1.124 Pr>chi2 = 0.289
## Fisher exact test that OR = 1: Pr>chi2 = 0.307
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

CABECERA MUNICIPAL Y RURAL DISPERSO

area_tabla2 <- matrix(c(157, 226, 120, 250), nrow = 2, byrow = TRUE)
colnames(area_tabla2) <- c("Mortalidad 112","Otra mortalidad")
rownames(area_tabla2) <- c("Rural Disperso","Cabecera Municipal")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_area2 <- epi.2by2(dat = area_tabla2, method = "cohort.count", conf.level = 0.95)
print(resultado_area2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+         157         226        383     40.99 (36.02 to 46.10)
## Exposure-         120         250        370     32.43 (27.68 to 37.46)
## Total             277         476        753     36.79 (33.33 to 40.34)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.26 (1.05, 1.53)
## Inc odds ratio                                 1.45 (1.07, 1.95)
## Attrib risk in the exposed *                   8.56 (1.70, 15.42)
## Attrib fraction in the exposed (%)            20.88 (4.44, 34.63)
## Attrib risk in the population *                4.35 (-1.53, 10.24)
## Attrib fraction in the population (%)         11.84 (7.14, 16.94)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 5.930 Pr>chi2 = 0.015
## Fisher exact test that OR = 1: Pr>chi2 = 0.016
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

ASEGURAMIENTO

CONTRIBUTIVO VS INDETERMINADO

aseg_tabla1 <- matrix(c(5, 10, 5, 61), nrow = 2, byrow = TRUE)
colnames(aseg_tabla1) <- c("Mortalidad 112","Otra mortalidad")
rownames(aseg_tabla1) <- c("Indeterminado","Contributivo")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_aseg1 <- epi.2by2(dat = aseg_tabla1, method = "cohort.count", conf.level = 0.95)
print(resultado_aseg1)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           5          10         15     33.33 (11.82 to 61.62)
## Exposure-           5          61         66       7.58 (2.51 to 16.80)
## Total              10          71         81      12.35 (6.08 to 21.53)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 4.40 (1.46, 13.29)
## Inc odds ratio                                 6.10 (1.49, 24.95)
## Attrib risk in the exposed *                   25.76 (1.06, 50.45)
## Attrib fraction in the exposed (%)            77.27 (32.23, 91.94)
## Attrib risk in the population *                4.77 (-4.83, 14.37)
## Attrib fraction in the population (%)         38.64 (21.98, 58.80)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 5.302 Pr>chi2 = 0.021
## Fisher exact test that OR = 1: Pr>chi2 = 0.016
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

CONTRIBUTIVO VS NO ASEGURADO

aseg_tabla2 <- matrix(c(28, 48, 5, 61), nrow = 2, byrow = TRUE)
colnames(aseg_tabla2) <- c("Mortalidad 112","Otra mortalidad")
rownames(aseg_tabla2) <- c("No asegurado","Contributivo")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_aseg2 <- epi.2by2(dat = aseg_tabla2, method = "cohort.count", conf.level = 0.95)
print(resultado_aseg2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          28          48         76     36.84 (26.06 to 48.69)
## Exposure-           5          61         66       7.58 (2.51 to 16.80)
## Total              33         109        142     23.24 (16.57 to 31.06)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 4.86 (1.99, 11.87)
## Inc odds ratio                                 7.12 (2.56, 19.81)
## Attrib risk in the exposed *                   29.27 (16.68, 41.85)
## Attrib fraction in the exposed (%)            79.44 (52.41, 91.47)
## Attrib risk in the population *                15.66 (6.23, 25.10)
## Attrib fraction in the population (%)         67.40 (45.91, 84.88)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 16.961 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

CONTRIBUTIVO VS SUBSIDIADO

aseg_tabla3 <- matrix(c(262, 394, 5, 61), nrow = 2, byrow = TRUE)
colnames(aseg_tabla3) <- c("Mortalidad 112","Otra mortalidad")
rownames(aseg_tabla3) <- c("Subsidiado","Contributivo")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_aseg3 <- epi.2by2(dat = aseg_tabla3, method = "cohort.count", conf.level = 0.95)
print(resultado_aseg3)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+         262         394        656     39.94 (36.17 to 43.80)
## Exposure-           5          61         66       7.58 (2.51 to 16.80)
## Total             267         455        722     36.98 (33.45 to 40.62)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 5.27 (2.26, 12.31)
## Inc odds ratio                                 8.11 (3.22, 20.46)
## Attrib risk in the exposed *                   32.36 (24.96, 39.77)
## Attrib fraction in the exposed (%)            81.03 (58.34, 91.83)
## Attrib risk in the population *                29.40 (22.11, 36.70)
## Attrib fraction in the population (%)         79.51 (58.64, 92.51)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 26.951 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

CONTRIBUTIVO VS ESPECIAL

aseg_tabla4 <- matrix(c(1, 0, 5, 61), nrow = 2, byrow = TRUE)
colnames(aseg_tabla4) <- c("Mortalidad 112","Otra mortalidad")
rownames(aseg_tabla4) <- c("Especial","Contributivo")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_aseg4 <- epi.2by2(dat = aseg_tabla4, method = "cohort.count", conf.level = 0.95)
print(resultado_aseg4)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           1           0          1    100.00 (2.50 to 100.00)
## Exposure-           5          61         66       7.58 (2.51 to 16.80)
## Total               6          61         67       8.96 (3.36 to 18.48)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 13.20 (5.68, 30.66)
## Inc odds ratio                                 Inf (NaN, Inf)
## Attrib risk in the exposed *                   92.42 (86.04, 98.81)
## Attrib fraction in the exposed (%)            92.42 (58.02, 96.72)
## Attrib risk in the population *                1.38 (-7.97, 10.73)
## Attrib fraction in the population (%)         15.40 (9.09, 25.38)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 2.098 Pr>chi2 = 0.148
## Fisher exact test that OR = 1: Pr>chi2 = 0.090
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

PERTENENCIA ETNICA

Otro vs Indígena

PE_tabla <- matrix(c(182, 240, 104, 243), nrow = 2, byrow = TRUE)
colnames(PE_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(PE_tabla) <- c("Indígena","Otro")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_PE1 <- epi.2by2(dat = PE_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_PE1)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+         182         240        422     43.13 (38.35 to 48.01)
## Exposure-         104         243        347     29.97 (25.20 to 35.09)
## Total             286         483        769     37.19 (33.76 to 40.72)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.44 (1.18, 1.75)
## Inc odds ratio                                 1.77 (1.31, 2.39)
## Attrib risk in the exposed *                   13.16 (6.41, 19.91)
## Attrib fraction in the exposed (%)            30.51 (15.78, 42.92)
## Attrib risk in the population *                7.22 (1.31, 13.13)
## Attrib fraction in the population (%)         19.41 (13.81, 25.38)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 14.111 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otro vs Raizal

PE_tabla2 <- matrix(c(0, 1, 104, 243), nrow = 2, byrow = TRUE)
colnames(PE_tabla2) <- c("Mortalidad 112","Otra mortalidad")
rownames(PE_tabla2) <- c("Raizal","Otro")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_PE2 <- epi.2by2(dat = PE_tabla2, method = "cohort.count", conf.level = 0.95)
## Warning in qf(1 - N., 2 * sa, 2 * sc + 2): NaNs produced
print(resultado_PE2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           0           1          1       0.00 (0.00 to 97.50)
## Exposure-         104         243        347     29.97 (25.20 to 35.09)
## Total             104         244        348     29.89 (25.12 to 35.00)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.00 (0.00, NaN)
## Inc odds ratio                                 0.00 (0.00, NaN)
## Attrib risk in the exposed *                   -29.97 (-34.79, -25.15)
## Attrib fraction in the exposed (%)            -Inf (-Inf, 62.99)
## Attrib risk in the population *                -0.09 (-6.90, 6.72)
## Attrib fraction in the population (%)         -0.29 (-0.30, -0.28)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.000 Pr>chi2 = 1.000
## Fisher exact test that OR = 1: Pr>chi2 = 1.000
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otro vs Afro

PE_tabla3 <- matrix(c(15, 29, 104, 243), nrow = 2, byrow = TRUE)
colnames(PE_tabla3) <- c("Mortalidad 112","Otra mortalidad")
rownames(PE_tabla3) <- c("Afro","Otro")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_PE3 <- epi.2by2(dat = PE_tabla3, method = "cohort.count", conf.level = 0.95)
print(resultado_PE3)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          15          29         44     34.09 (20.49 to 49.92)
## Exposure-         104         243        347     29.97 (25.20 to 35.09)
## Total             119         272        391     30.43 (25.91 to 35.26)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.14 (0.73, 1.77)
## Inc odds ratio                                 1.21 (0.62, 2.35)
## Attrib risk in the exposed *                   4.12 (-10.69, 18.93)
## Attrib fraction in the exposed (%)            12.08 (-40.59, 41.08)
## Attrib risk in the population *                0.46 (-6.17, 7.10)
## Attrib fraction in the population (%)         1.52 (0.47, 2.75)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.313 Pr>chi2 = 0.576
## Fisher exact test that OR = 1: Pr>chi2 = 0.603
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

ESTRATO

Estrato 1 vs Sin Dato

E1_tabla <- matrix(c(262, 382, 19, 26), nrow = 2, byrow = TRUE)
colnames(E1_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(E1_tabla) <- c("Estrato 1","Sin Dato")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_E1 <- epi.2by2(dat = E1_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_E1)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+         262         382        644     40.68 (36.86 to 44.59)
## Exposure-          19          26         45     42.22 (27.66 to 57.85)
## Total             281         408        689     40.78 (37.09 to 44.56)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.96 (0.68, 1.37)
## Inc odds ratio                                 0.94 (0.51, 1.73)
## Attrib risk in the exposed *                   -1.54 (-16.46, 13.38)
## Attrib fraction in the exposed (%)            -3.78 (-41.79, 29.53)
## Attrib risk in the population *                -1.44 (-16.33, 13.45)
## Attrib fraction in the population (%)         -3.53 (-29.83, 25.43)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.041 Pr>chi2 = 0.839
## Fisher exact test that OR = 1: Pr>chi2 = 0.876
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Estrato 2 vs Sin Dato

E2_tabla <- matrix(c(20, 84, 19, 26), nrow = 2, byrow = TRUE)
colnames(E2_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(E2_tabla) <- c("Estrato 2","SD")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_E2 <- epi.2by2(dat = E2_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_E2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          20          84        104     19.23 (12.16 to 28.13)
## Exposure-          19          26         45     42.22 (27.66 to 57.85)
## Total              39         110        149     26.17 (19.32 to 34.00)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.46 (0.27, 0.77)
## Inc odds ratio                                 0.33 (0.15, 0.70)
## Attrib risk in the exposed *                   -22.99 (-39.29, -6.69)
## Attrib fraction in the exposed (%)            -119.56 (-266.20, -29.68)
## Attrib risk in the population *                -16.05 (-32.11, 0.02)
## Attrib fraction in the population (%)         -61.31 (-70.15, -43.14)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 8.592 Pr>chi2 = 0.003
## Fisher exact test that OR = 1: Pr>chi2 = 0.005
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Estrato 3 vs Sin Dato

E3_tabla <- matrix(c(0, 21, 19, 26), nrow = 2, byrow = TRUE)
colnames(E3_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(E3_tabla) <- c("Estrato 3","SD")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_E3 <- epi.2by2(dat = E3_tabla, method = "cohort.count", conf.level = 0.95)
## Warning in qf(1 - N., 2 * sa, 2 * sc + 2): NaNs produced
print(resultado_E3)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           0          21         21       0.00 (0.00 to 16.11)
## Exposure-          19          26         45     42.22 (27.66 to 57.85)
## Total              19          47         66     28.79 (18.30 to 41.25)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.00 (0.00, NaN)
## Inc odds ratio                                 0.00 (0.00, NaN)
## Attrib risk in the exposed *                   -42.22 (-56.65, -27.79)
## Attrib fraction in the exposed (%)            -Inf (-Inf, -168.30)
## Attrib risk in the population *                -13.43 (-31.53, 4.66)
## Attrib fraction in the population (%)         -46.67 (-51.10, -40.24)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 12.451 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

GRUPOS POBLACIONALES

Desplazado

GPD_tabla <- matrix(c(4, 9, 297, 504), nrow = 2, byrow = TRUE)
colnames(GPD_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(GPD_tabla) <- c("No desplazado","Desplazado")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_GPD <- epi.2by2(dat = GPD_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_GPD)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           4           9         13      30.77 (9.09 to 61.43)
## Exposure-         297         504        801     37.08 (33.72 to 40.53)
## Total             301         513        814     36.98 (33.65 to 40.40)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.83 (0.37, 1.88)
## Inc odds ratio                                 0.75 (0.23, 2.47)
## Attrib risk in the exposed *                   -6.31 (-31.62, 19.00)
## Attrib fraction in the exposed (%)            -20.51 (-193.55, 36.26)
## Attrib risk in the population *                -0.10 (-4.81, 4.61)
## Attrib fraction in the population (%)         -0.27 (-0.32, -0.21)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.032 Pr>chi2 = 0.859
## Fisher exact test that OR = 1: Pr>chi2 = 0.777
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

MIGRANTE

GPM_tabla <- matrix(c(7, 23, 294, 490), nrow = 2, byrow = TRUE)
colnames(GPM_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(GPM_tabla) <- c("No migrante","Migrante")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_GPM <- epi.2by2(dat = GPM_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_GPM)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           7          23         30      23.33 (9.93 to 42.28)
## Exposure-         294         490        784     37.50 (34.10 to 40.99)
## Total             301         513        814     36.98 (33.65 to 40.40)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.62 (0.32, 1.20)
## Inc odds ratio                                 0.51 (0.22, 1.20)
## Attrib risk in the exposed *                   -14.17 (-29.68, 1.34)
## Attrib fraction in the exposed (%)            -60.71 (-219.71, 9.18)
## Attrib risk in the population *                -0.52 (-5.26, 4.22)
## Attrib fraction in the population (%)         -1.41 (-1.48, -1.33)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 2.488 Pr>chi2 = 0.115
## Fisher exact test that OR = 1: Pr>chi2 = 0.127
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

ICBF

GPI_tabla <- matrix(c(7, 8, 294, 505), nrow = 2, byrow = TRUE)
colnames(GPI_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(GPI_tabla) <- c("No ICBF","ICBF")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_GPI <- epi.2by2(dat = GPI_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_GPI)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           7           8         15     46.67 (21.27 to 73.41)
## Exposure-         294         505        799     36.80 (33.44 to 40.25)
## Total             301         513        814     36.98 (33.65 to 40.40)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.27 (0.73, 2.20)
## Inc odds ratio                                 1.50 (0.54, 4.19)
## Attrib risk in the exposed *                   9.87 (-15.60, 35.34)
## Attrib fraction in the exposed (%)            21.15 (-49.16, 48.10)
## Attrib risk in the population *                0.18 (-4.53, 4.89)
## Attrib fraction in the population (%)         0.49 (0.38, 0.62)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.616 Pr>chi2 = 0.433
## Fisher exact test that OR = 1: Pr>chi2 = 0.431
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

VICTIMA VIOLENCIA

GPVV_tabla <- matrix(c(3, 0, 298, 513), nrow = 2, byrow = TRUE)
colnames(GPVV_tabla) <- c("Mortalidad 112","Otra mortalidad")
rownames(GPVV_tabla) <- c("No victima violencia","Victima violencia")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_GPVV <- epi.2by2(dat = GPVV_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_GPVV)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           3           0          3   100.00 (29.24 to 100.00)
## Exposure-         298         513        811     36.74 (33.42 to 40.17)
## Total             301         513        814     36.98 (33.65 to 40.40)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.72 (2.49, 2.98)
## Inc odds ratio                                 Inf (NaN, Inf)
## Attrib risk in the exposed *                   63.26 (59.94, 66.57)
## Attrib fraction in the exposed (%)            63.26 (15.90, 66.50)
## Attrib risk in the population *                0.23 (-4.46, 4.92)
## Attrib fraction in the population (%)         0.63 (0.57, 0.70)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 2.776 Pr>chi2 = 0.096
## Fisher exact test that OR = 1: Pr>chi2 = 0.050
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

DEPARTAMENTO DE RESIDENCIA

Otros vs Vichada

Dpto_tabla1 <- matrix(c(17, 6, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla1) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla1) <- c("Vichada","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto1 <- epi.2by2(dat = Dpto_tabla1, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto1)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          17           6         23     73.91 (51.59 to 89.77)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total             106         293        399     26.57 (22.30 to 31.19)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 3.12 (2.31, 4.23)
## Inc odds ratio                                 9.14 (3.50, 23.88)
## Attrib risk in the exposed *                   50.24 (31.79, 68.70)
## Attrib fraction in the exposed (%)            67.98 (54.00, 75.43)
## Attrib risk in the population *                2.90 (-3.21, 9.00)
## Attrib fraction in the population (%)         10.90 (9.27, 12.70)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 28.046 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Caqueta

Dpto_tabla2 <- matrix(c(5, 2, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla2) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla2) <- c("Caqueta","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto2 <- epi.2by2(dat = Dpto_tabla2, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           5           2          7     71.43 (29.04 to 96.33)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total              94         289        383     24.54 (20.31 to 29.17)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 3.02 (1.83, 4.99)
## Inc odds ratio                                 8.06 (1.54, 42.27)
## Attrib risk in the exposed *                   47.76 (14.02, 81.50)
## Attrib fraction in the exposed (%)            66.86 (32.78, 76.35)
## Attrib risk in the population *                0.87 (-5.21, 6.96)
## Attrib fraction in the population (%)         3.56 (2.99, 4.19)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 6.081 Pr>chi2 = 0.014
## Fisher exact test that OR = 1: Pr>chi2 = 0.011
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Cesar

Dpto_tabla3 <- matrix(c(22, 16, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla3) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla3) <- c("Cesar","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto3 <- epi.2by2(dat = Dpto_tabla3, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto3)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          22          16         38     57.89 (40.82 to 73.69)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total             111         303        414     26.81 (22.60 to 31.36)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.45 (1.76, 3.39)
## Inc odds ratio                                 4.43 (2.23, 8.81)
## Attrib risk in the exposed *                   34.22 (17.95, 50.50)
## Attrib fraction in the exposed (%)            59.12 (41.44, 69.61)
## Attrib risk in the population *                3.14 (-2.91, 9.20)
## Attrib fraction in the population (%)         11.72 (9.75, 13.89)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 20.601 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Atlantico

Dpto_tabla4 <- matrix(c(12, 12, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla4) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla4) <- c("Atlantico","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto4 <- epi.2by2(dat = Dpto_tabla4, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto4)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          12          12         24     50.00 (29.12 to 70.88)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total             101         299        400     25.25 (21.06 to 29.81)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.11 (1.36, 3.28)
## Inc odds ratio                                 3.22 (1.40, 7.43)
## Attrib risk in the exposed *                   26.33 (5.87, 46.79)
## Attrib fraction in the exposed (%)            52.66 (22.36, 67.52)
## Attrib risk in the population *                1.58 (-4.47, 7.63)
## Attrib fraction in the population (%)         6.26 (5.06, 7.60)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 8.286 Pr>chi2 = 0.004
## Fisher exact test that OR = 1: Pr>chi2 = 0.007
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Guaviare

Dpto_tabla5 <- matrix(c(1, 1, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla5) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla5) <- c("Guaviare","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto5 <- epi.2by2(dat = Dpto_tabla5, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto5)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           1           1          2      50.00 (1.26 to 98.74)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total              90         288        378     23.81 (19.60 to 28.43)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.11 (0.52, 8.55)
## Inc odds ratio                                 3.22 (0.20, 52.08)
## Attrib risk in the exposed *                   26.33 (-43.10, 95.76)
## Attrib fraction in the exposed (%)            52.66 (-151.99, 75.29)
## Attrib risk in the population *                0.14 (-5.93, 6.21)
## Attrib fraction in the population (%)         0.59 (0.47, 0.72)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.002 Pr>chi2 = 0.968
## Fisher exact test that OR = 1: Pr>chi2 = 0.420
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otro vs Magdalena

Dpto_tabla6 <- matrix(c(20, 22, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla6) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla6) <- c("Magdalena","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto6 <- epi.2by2(dat = Dpto_tabla6, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto6)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          20          22         42     47.62 (32.00 to 63.58)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total             109         309        418     26.08 (21.93 to 30.57)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.01 (1.40, 2.90)
## Inc odds ratio                                 2.93 (1.53, 5.62)
## Attrib risk in the exposed *                   23.95 (8.25, 39.65)
## Attrib fraction in the exposed (%)            50.29 (26.19, 64.38)
## Attrib risk in the population *                2.41 (-3.61, 8.42)
## Attrib fraction in the population (%)         9.23 (7.42, 11.25)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 11.241 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = 0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Guajira

Dpto_tabla7 <- matrix(c(66, 74, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla7) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla7) <- c("Guajira","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto7 <- epi.2by2(dat = Dpto_tabla7, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto7)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          66          74        140     47.14 (38.66 to 55.75)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total             155         361        516     30.04 (26.11 to 34.20)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.99 (1.55, 2.56)
## Inc odds ratio                                 2.88 (1.91, 4.33)
## Attrib risk in the exposed *                   23.47 (14.15, 32.79)
## Attrib fraction in the exposed (%)            49.79 (35.12, 60.84)
## Attrib risk in the population *                6.37 (0.53, 12.21)
## Attrib fraction in the population (%)         21.20 (17.25, 25.46)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 26.745 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

otros vs Antioquia

Dpto_tabla8 <- matrix(c(19, 24, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla8) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla8) <- c("Antioquia","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto8 <- epi.2by2(dat = Dpto_tabla8, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto8)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          19          24         43     44.19 (29.08 to 60.12)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total             108         311        419     25.78 (21.65 to 30.25)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.87 (1.27, 2.73)
## Inc odds ratio                                 2.55 (1.34, 4.88)
## Attrib risk in the exposed *                   20.52 (5.06, 35.97)
## Attrib fraction in the exposed (%)            46.43 (19.21, 62.19)
## Attrib risk in the population *                2.11 (-3.89, 8.11)
## Attrib fraction in the population (%)         8.17 (6.44, 10.11)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 8.489 Pr>chi2 = 0.004
## Fisher exact test that OR = 1: Pr>chi2 = 0.005
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

otros vs Chocó

Dpto_tabla9 <- matrix(c(50, 69, 89, 287), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla9) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_tabla9) <- c("Chocó","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto9 <- epi.2by2(dat = Dpto_tabla9, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto9)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          50          69        119     42.02 (33.03 to 51.41)
## Exposure-          89         287        376     23.67 (19.46 to 28.30)
## Total             139         356        495     28.08 (24.16 to 32.26)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.78 (1.34, 2.34)
## Inc odds ratio                                 2.34 (1.51, 3.61)
## Attrib risk in the exposed *                   18.35 (8.49, 28.20)
## Attrib fraction in the exposed (%)            43.66 (25.08, 57.05)
## Attrib risk in the population *                4.41 (-1.43, 10.25)
## Attrib fraction in the population (%)         15.71 (12.29, 19.45)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 15.066 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

ANALISIS DEPARTAMENTO OCURRENCIA

Otros vs Caqueta

Dpto_o_tabla1 <- matrix(c(5, 2, 139, 349), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla1 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_o_tabla1 ) <- c("Caquetá","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto_o1 <- epi.2by2(dat = Dpto_o_tabla1 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o1)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           5           2          7     71.43 (29.04 to 96.33)
## Exposure-         139         349        488     28.48 (24.52 to 32.71)
## Total             144         351        495     29.09 (25.12 to 33.31)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.51 (1.54, 4.09)
## Inc odds ratio                                 6.28 (1.20, 32.74)
## Attrib risk in the exposed *                   42.94 (9.24, 76.65)
## Attrib fraction in the exposed (%)            60.12 (19.72, 70.68)
## Attrib risk in the population *                0.61 (-5.05, 6.27)
## Attrib fraction in the population (%)         2.09 (1.79, 2.41)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 4.264 Pr>chi2 = 0.039
## Fisher exact test that OR = 1: Pr>chi2 = 0.024
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Vichada

Dpto_o_tabla2 <- matrix(c(13, 7, 139, 349), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla2 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_o_tabla2 ) <- c("Vichada","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto_o2 <- epi.2by2(dat = Dpto_o_tabla2 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          13           7         20     65.00 (40.78 to 84.61)
## Exposure-         139         349        488     28.48 (24.52 to 32.71)
## Total             152         356        508     29.92 (25.97 to 34.11)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.28 (1.61, 3.24)
## Inc odds ratio                                 4.66 (1.82, 11.93)
## Attrib risk in the exposed *                   36.52 (15.23, 57.80)
## Attrib fraction in the exposed (%)            56.18 (32.86, 66.97)
## Attrib risk in the population *                1.44 (-4.21, 7.08)
## Attrib fraction in the population (%)         4.80 (4.10, 5.58)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 12.218 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = 0.002
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Cesar

Dpto_o_tabla3 <- matrix(c(22, 17, 139, 349), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla3 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_o_tabla3 ) <- c("Cesar","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto_o3 <- epi.2by2(dat = Dpto_o_tabla3 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o3)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          22          17         39     56.41 (39.62 to 72.19)
## Exposure-         139         349        488     28.48 (24.52 to 32.71)
## Total             161         366        527     30.55 (26.64 to 34.68)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.98 (1.45, 2.70)
## Inc odds ratio                                 3.25 (1.67, 6.30)
## Attrib risk in the exposed *                   27.93 (11.86, 44.00)
## Attrib fraction in the exposed (%)            49.51 (28.64, 61.61)
## Attrib risk in the population *                2.07 (-3.55, 7.68)
## Attrib fraction in the population (%)         6.76 (5.67, 7.97)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 13.275 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Atlantico

Dpto_o_tabla4 <- matrix(c(12, 12, 139, 349), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla4 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_o_tabla4 ) <- c("Atlantico","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto_o4 <- epi.2by2(dat = Dpto_o_tabla4 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o4)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          12          12         24     50.00 (29.12 to 70.88)
## Exposure-         139         349        488     28.48 (24.52 to 32.71)
## Total             151         361        512     29.49 (25.57 to 33.65)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.76 (1.15, 2.68)
## Inc odds ratio                                 2.51 (1.10, 5.72)
## Attrib risk in the exposed *                   21.52 (1.12, 41.92)
## Attrib fraction in the exposed (%)            43.03 (7.68, 60.03)
## Attrib risk in the population *                1.01 (-4.62, 6.63)
## Attrib fraction in the population (%)         3.42 (2.79, 4.13)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 5.093 Pr>chi2 = 0.024
## Fisher exact test that OR = 1: Pr>chi2 = 0.037
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Caldas y Guaviare

Dpto_o_tabla5 <- matrix(c(1, 1, 139, 349), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla5 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_o_tabla5 ) <- c("Caldas y Guaviare","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto_o5 <- epi.2by2(dat = Dpto_o_tabla5 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o5)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           1           1          2      50.00 (1.26 to 98.74)
## Exposure-         139         349        488     28.48 (24.52 to 32.71)
## Total             140         350        490     28.57 (24.61 to 32.79)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.76 (0.44, 7.07)
## Inc odds ratio                                 2.51 (0.16, 40.42)
## Attrib risk in the exposed *                   21.52 (-47.89, 90.93)
## Attrib fraction in the exposed (%)            43.03 (-202.46, 69.62)
## Attrib risk in the population *                0.09 (-5.57, 5.75)
## Attrib fraction in the population (%)         0.31 (0.25, 0.37)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.000 Pr>chi2 = 1.000
## Fisher exact test that OR = 1: Pr>chi2 = 0.490
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Magdalena

Dpto_o_tabla6 <- matrix(c(20, 21, 139, 349), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla6 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_o_tabla6 ) <- c("Magdalena","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto_o6 <- epi.2by2(dat = Dpto_o_tabla6 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o6)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          20          21         41     48.78 (32.88 to 64.87)
## Exposure-         139         349        488     28.48 (24.52 to 32.71)
## Total             159         370        529     30.06 (26.18 to 34.16)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.71 (1.21, 2.42)
## Inc odds ratio                                 2.39 (1.26, 4.55)
## Attrib risk in the exposed *                   20.30 (4.48, 36.11)
## Attrib fraction in the exposed (%)            41.61 (14.80, 57.00)
## Attrib risk in the population *                1.57 (-4.02, 7.17)
## Attrib fraction in the population (%)         5.23 (4.24, 6.34)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 7.412 Pr>chi2 = 0.006
## Fisher exact test that OR = 1: Pr>chi2 = 0.012
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Guajira

Dpto_o_tabla7 <- matrix(c(69, 79, 139, 349), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla7 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_o_tabla7 ) <- c("Guajira","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto_o7 <- epi.2by2(dat = Dpto_o_tabla7 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o7)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          69          79        148     46.62 (38.39 to 54.99)
## Exposure-         139         349        488     28.48 (24.52 to 32.71)
## Total             208         428        636     32.70 (29.07 to 36.50)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.64 (1.31, 2.04)
## Inc odds ratio                                 2.19 (1.50, 3.20)
## Attrib risk in the exposed *                   18.14 (9.16, 27.12)
## Attrib fraction in the exposed (%)            38.90 (23.21, 50.80)
## Attrib risk in the population *                4.22 (-1.19, 9.64)
## Attrib fraction in the population (%)         12.91 (10.38, 15.65)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 16.975 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Antioquia

Dpto_o_tabla8 <- matrix(c(19, 24, 139, 349), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla8 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Dpto_o_tabla8 ) <- c("Antioquia","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto_o8 <- epi.2by2(dat = Dpto_o_tabla8 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o8)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          19          24         43     44.19 (29.08 to 60.12)
## Exposure-         139         349        488     28.48 (24.52 to 32.71)
## Total             158         373        531     29.76 (25.89 to 33.84)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.55 (1.08, 2.23)
## Inc odds ratio                                 1.99 (1.06, 3.74)
## Attrib risk in the exposed *                   15.70 (0.33, 31.08)
## Attrib fraction in the exposed (%)            35.54 (4.20, 53.47)
## Attrib risk in the population *                1.27 (-4.31, 6.85)
## Attrib fraction in the population (%)         4.27 (3.34, 5.32)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 4.662 Pr>chi2 = 0.031
## Fisher exact test that OR = 1: Pr>chi2 = 0.037
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

EDAD ANALISIS GRUPO POR 6 MESES

Menor de 6 meses vs mayor de 19 meses

Edad_6m_tabla1 <- matrix(c(94, 209, 26, 88), nrow = 2, byrow = TRUE)
colnames(Edad_6m_tabla1 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Edad_6m_tabla1 ) <- c("Menor de 6m","Mayor de 19m")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_edad_6m_1 <- epi.2by2(dat = Edad_6m_tabla1 , method = "cohort.count", conf.level = 0.95)
print(resultado_edad_6m_1)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          94         209        303     31.02 (25.86 to 36.56)
## Exposure-          26          88        114     22.81 (15.47 to 31.60)
## Total             120         297        417     28.78 (24.48 to 33.38)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.36 (0.93, 1.98)
## Inc odds ratio                                 1.52 (0.92, 2.51)
## Attrib risk in the exposed *                   8.22 (-1.08, 17.51)
## Attrib fraction in the exposed (%)            26.48 (-5.64, 50.02)
## Attrib risk in the population *                5.97 (-2.87, 14.81)
## Attrib fraction in the population (%)         20.75 (5.32, 36.79)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 2.728 Pr>chi2 = 0.099
## Fisher exact test that OR = 1: Pr>chi2 = 0.115
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Mayor a 19 meses vs 7 a 12 meses

Edad_6m_tabla2 <- matrix(c(83, 120, 26, 88), nrow = 2, byrow = TRUE)
colnames(Edad_6m_tabla2 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Edad_6m_tabla2 ) <- c("7-12 m","Mayor a 19m")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_edad_6m_2 <- epi.2by2(dat = Edad_6m_tabla2 , method = "cohort.count", conf.level = 0.95)
print(resultado_edad_6m_2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          83         120        203     40.89 (34.06 to 47.99)
## Exposure-          26          88        114     22.81 (15.47 to 31.60)
## Total             109         208        317     34.38 (29.17 to 39.90)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.79 (1.23, 2.61)
## Inc odds ratio                                 2.34 (1.39, 3.94)
## Attrib risk in the exposed *                   18.08 (7.83, 28.33)
## Attrib fraction in the exposed (%)            44.22 (19.88, 62.03)
## Attrib risk in the population *                11.58 (2.27, 20.89)
## Attrib fraction in the population (%)         33.67 (20.79, 46.95)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 10.577 Pr>chi2 = 0.001
## Fisher exact test that OR = 1: Pr>chi2 = 0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

mayor a 19 meses vs 13 a 18 meses

Edad_6m_tabla3 <- matrix(c(98, 96, 26, 88), nrow = 2, byrow = TRUE)
colnames(Edad_6m_tabla3 ) <- c("Mortalidad 112","Otra mortalidad")
rownames(Edad_6m_tabla3 ) <- c("13-18 m","Mayor a 19m")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_edad_6m_3 <- epi.2by2(dat = Edad_6m_tabla3 , method = "cohort.count", conf.level = 0.95)
print(resultado_edad_6m_3)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          98          96        194     50.52 (43.26 to 57.75)
## Exposure-          26          88        114     22.81 (15.47 to 31.60)
## Total             124         184        308     40.26 (34.74 to 45.97)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.21 (1.54, 3.19)
## Inc odds ratio                                 3.46 (2.05, 5.81)
## Attrib risk in the exposed *                   27.71 (17.28, 38.14)
## Attrib fraction in the exposed (%)            54.85 (35.93, 68.96)
## Attrib risk in the population *                17.45 (8.00, 26.90)
## Attrib fraction in the population (%)         43.35 (31.25, 55.46)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 22.921 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

RIESGO RELATIVO EVENTO 590

subset_590 <- subset(datosf, COD_EVE == 590)
library(dplyr)
# Crear variable indicadora
datos_590 <- datosf%>%
  mutate(Mortalidad_EDA = ifelse(COD_EVE == 590, "Sí", "No"))

# Tabla comparativa
t3 <- table1::table1(~ SEXO + edad_meses + AREA + TIP_SS + PER_ETN + estrato + 
                     GP_DESPLAZ + GP_MIGRANT + GP_POBICFB + GP_VIC_VIO + 
                     nom_est_f_caso + Departamento_residencia + Departamento_ocurrencia | 
                     Mortalidad_EDA, 
                   data = datos_590)
t3
No
(N=682)

(N=132)
Overall
(N=814)
SEXO
F 284 (41.6%) 50 (37.9%) 334 (41.0%)
M 398 (58.4%) 82 (62.1%) 480 (59.0%)
edad_meses
Mean (SD) 10.1 (9.90) 12.5 (11.8) 10.5 (10.3)
Median [Min, Max] 8.00 [1.00, 48.0] 10.0 [1.00, 48.0] 9.00 [1.00, 48.0]
AREA
1 329 (48.2%) 41 (31.1%) 370 (45.5%)
2 49 (7.2%) 12 (9.1%) 61 (7.5%)
3 304 (44.6%) 79 (59.8%) 383 (47.1%)
TIP_SS
C 59 (8.7%) 7 (5.3%) 66 (8.1%)
E 1 (0.1%) 0 (0%) 1 (0.1%)
I 11 (1.6%) 4 (3.0%) 15 (1.8%)
N 57 (8.4%) 19 (14.4%) 76 (9.3%)
S 554 (81.2%) 102 (77.3%) 656 (80.6%)
PER_ETN
1 330 (48.4%) 92 (69.7%) 422 (51.8%)
3 1 (0.1%) 0 (0%) 1 (0.1%)
5 39 (5.7%) 5 (3.8%) 44 (5.4%)
6 312 (45.7%) 35 (26.5%) 347 (42.6%)
estrato
1 525 (77.0%) 119 (90.2%) 644 (79.1%)
2 98 (14.4%) 6 (4.5%) 104 (12.8%)
3 21 (3.1%) 0 (0%) 21 (2.6%)
Missing 38 (5.6%) 7 (5.3%) 45 (5.5%)
GP_DESPLAZ
1 12 (1.8%) 1 (0.8%) 13 (1.6%)
2 670 (98.2%) 131 (99.2%) 801 (98.4%)
GP_MIGRANT
1 22 (3.2%) 8 (6.1%) 30 (3.7%)
2 660 (96.8%) 124 (93.9%) 784 (96.3%)
GP_POBICFB
1 13 (1.9%) 2 (1.5%) 15 (1.8%)
2 669 (98.1%) 130 (98.5%) 799 (98.2%)
GP_VIC_VIO
1 3 (0.4%) 0 (0%) 3 (0.4%)
2 679 (99.6%) 132 (100%) 811 (99.6%)
nom_est_f_caso
Confirmado por Clínica 535 (78.4%) 130 (98.5%) 665 (81.7%)
Confirmado por laboratorio 147 (21.6%) 2 (1.5%) 149 (18.3%)
Departamento_residencia
AMAZONAS 7 (1.0%) 2 (1.5%) 9 (1.1%)
ANTIOQUIA 40 (5.9%) 3 (2.3%) 43 (5.3%)
ARAUCA 9 (1.3%) 2 (1.5%) 11 (1.4%)
ATLANTICO 23 (3.4%) 1 (0.8%) 24 (2.9%)
BOGOTA 32 (4.7%) 0 (0%) 32 (3.9%)
BOLIVAR 38 (5.6%) 1 (0.8%) 39 (4.8%)
BOYACA 9 (1.3%) 1 (0.8%) 10 (1.2%)
CALDAS 1 (0.1%) 0 (0%) 1 (0.1%)
CAQUETA 7 (1.0%) 0 (0%) 7 (0.9%)
CASANARE 2 (0.3%) 4 (3.0%) 6 (0.7%)
CAUCA 13 (1.9%) 7 (5.3%) 20 (2.5%)
CESAR 34 (5.0%) 4 (3.0%) 38 (4.7%)
CHOCO 94 (13.8%) 25 (18.9%) 119 (14.6%)
CORDOBA 24 (3.5%) 1 (0.8%) 25 (3.1%)
CUNDINAMARCA 3 (0.4%) 0 (0%) 3 (0.4%)
EXTERIOR 31 (4.5%) 11 (8.3%) 42 (5.2%)
GUAINIA 5 (0.7%) 5 (3.8%) 10 (1.2%)
GUAJIRA 113 (16.6%) 27 (20.5%) 140 (17.2%)
GUAVIARE 2 (0.3%) 0 (0%) 2 (0.2%)
HUILA 11 (1.6%) 1 (0.8%) 12 (1.5%)
MAGDALENA 36 (5.3%) 6 (4.5%) 42 (5.2%)
META 21 (3.1%) 2 (1.5%) 23 (2.8%)
NARIÑO 18 (2.6%) 2 (1.5%) 20 (2.5%)
NORTE SANTANDER 7 (1.0%) 1 (0.8%) 8 (1.0%)
PUTUMAYO 1 (0.1%) 1 (0.8%) 2 (0.2%)
QUINDIO 2 (0.3%) 0 (0%) 2 (0.2%)
RISARALDA 17 (2.5%) 8 (6.1%) 25 (3.1%)
SAN ANDRES 2 (0.3%) 0 (0%) 2 (0.2%)
SANTANDER 11 (1.6%) 6 (4.5%) 17 (2.1%)
SUCRE 7 (1.0%) 3 (2.3%) 10 (1.2%)
TOLIMA 10 (1.5%) 0 (0%) 10 (1.2%)
VALLE 29 (4.3%) 3 (2.3%) 32 (3.9%)
VAUPES 4 (0.6%) 1 (0.8%) 5 (0.6%)
VICHADA 19 (2.8%) 4 (3.0%) 23 (2.8%)
Departamento_ocurrencia
AMAZONAS 7 (1.0%) 2 (1.5%) 9 (1.1%)
ANTIOQUIA 40 (5.9%) 3 (2.3%) 43 (5.3%)
ARAUCA 8 (1.2%) 2 (1.5%) 10 (1.2%)
ATLANTICO 23 (3.4%) 1 (0.8%) 24 (2.9%)
BOGOTA 34 (5.0%) 0 (0%) 34 (4.2%)
BOLIVAR 37 (5.4%) 1 (0.8%) 38 (4.7%)
BOYACA 10 (1.5%) 1 (0.8%) 11 (1.4%)
CALDAS 2 (0.3%) 0 (0%) 2 (0.2%)
CAQUETA 7 (1.0%) 0 (0%) 7 (0.9%)
CASANARE 2 (0.3%) 4 (3.0%) 6 (0.7%)
CAUCA 13 (1.9%) 7 (5.3%) 20 (2.5%)
CESAR 35 (5.1%) 4 (3.0%) 39 (4.8%)
CHOCO 92 (13.5%) 26 (19.7%) 118 (14.5%)
CORDOBA 24 (3.5%) 1 (0.8%) 25 (3.1%)
CUNDINAMARCA 4 (0.6%) 0 (0%) 4 (0.5%)
EXTERIOR 24 (3.5%) 6 (4.5%) 30 (3.7%)
GUAINIA 5 (0.7%) 5 (3.8%) 10 (1.2%)
GUAJIRA 118 (17.3%) 30 (22.7%) 148 (18.2%)
GUAVIARE 2 (0.3%) 0 (0%) 2 (0.2%)
HUILA 11 (1.6%) 1 (0.8%) 12 (1.5%)
MAGDALENA 35 (5.1%) 6 (4.5%) 41 (5.0%)
META 25 (3.7%) 3 (2.3%) 28 (3.4%)
NARIÑO 18 (2.6%) 2 (1.5%) 20 (2.5%)
NORTE SANTANDER 7 (1.0%) 2 (1.5%) 9 (1.1%)
PUTUMAYO 2 (0.3%) 1 (0.8%) 3 (0.4%)
QUINDIO 3 (0.4%) 0 (0%) 3 (0.4%)
RISARALDA 17 (2.5%) 8 (6.1%) 25 (3.1%)
SAN ANDRES 2 (0.3%) 0 (0%) 2 (0.2%)
SANTANDER 11 (1.6%) 6 (4.5%) 17 (2.1%)
SUCRE 6 (0.9%) 3 (2.3%) 9 (1.1%)
TOLIMA 10 (1.5%) 0 (0%) 10 (1.2%)
VALLE 29 (4.3%) 2 (1.5%) 31 (3.8%)
VAUPES 3 (0.4%) 1 (0.8%) 4 (0.5%)
VICHADA 16 (2.3%) 4 (3.0%) 20 (2.5%)

ANALISIS VARIABLE EDAD EN MESES

# Estadísticos básicos con summary

summary(datos_590$edad_meses)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1.00    4.00    9.00   10.49   12.00   48.00
# O de manera más detallada
estadisticos_edad_590 <- datos_590 %>%
  summarise(
    n = n(),
    n_no_na = sum(!is.na(edad_meses)),
    media = mean(edad_meses, na.rm = TRUE),
    mediana = median(edad_meses, na.rm = TRUE),
    desviacion = sd(edad_meses, na.rm = TRUE),
    minimo = min(edad_meses, na.rm = TRUE),
    maximo = max(edad_meses, na.rm = TRUE),
    q1 = quantile(edad_meses, 0.25, na.rm = TRUE),
    q3 = quantile(edad_meses, 0.75, na.rm = TRUE),
    rango_iqr = IQR(edad_meses, na.rm = TRUE)
  )

print(estadisticos_edad_590)
## # A tibble: 1 × 10
##       n n_no_na media mediana desviacion minimo maximo    q1    q3 rango_iqr
##   <int>   <int> <dbl>   <dbl>      <dbl>  <dbl>  <dbl> <dbl> <dbl>     <dbl>
## 1   814     814  10.5       9       10.3      1     48     4    12         8
library(ggplot2)
# Histograma con curva de densidad
ggplot(datos_590, aes(x = edad_meses)) +
  geom_histogram(aes(y = ..density..), 
                 fill = "lightblue", color = "black", alpha = 0.7, bins = 30) +
  geom_density(alpha = 0.2, fill = "red") +
  labs(title = "Distribución de Edad en Meses con Curva de Densidad",
       x = "Edad (meses)",
       y = "Densidad") +
  theme_minimal()

GRUPO DE EDAD CADA 6 MESES

datos_590 <- datos_590 %>%
  mutate(
    edad_grupo_6meses = cut(edad_meses,
                           breaks = seq(0, 60, by = 6),
                           labels = c("0-6", "7-12", "13-18", "19-24", "25-30", 
                                     "31-36", "37-42", "43-48", "49-54", "55-60"),
                           include.lowest = TRUE,
                           right = FALSE)
  )
# Tabla de frecuencias simple
tabla_edad_grupo_6m <- datos_590 %>%
  count(edad_grupo_6meses) %>%
  arrange(edad_grupo_6meses) %>%
  mutate(
    porcentaje = round(n / sum(n) * 100, 2),
    porcentaje_acumulado = round(cumsum(porcentaje), 2)
  )

print(tabla_edad_grupo_6m, n = Inf)
## # A tibble: 6 × 4
##   edad_grupo_6meses     n porcentaje porcentaje_acumulado
##   <fct>             <int>      <dbl>                <dbl>
## 1 0-6                 303      37.2                  37.2
## 2 7-12                203      24.9                  62.2
## 3 13-18               194      23.8                  86.0
## 4 25-30                59       7.25                 93.2
## 5 37-42                31       3.81                 97.0
## 6 49-54                24       2.95                100

GRUPO 6 MESES PARA EVENTO 590

tabla_edad_grupo_6m_590 <- datos_590 %>%
  filter(COD_EVE == 590) %>%
  count(edad_grupo_6meses) %>%
  arrange(edad_grupo_6meses) %>%
  mutate(
    porcentaje = round(n / sum(n) * 100, 2),
    porcentaje_acumulado = round(cumsum(porcentaje), 2)
  )

print(tabla_edad_grupo_6m_590, n = Inf)
## # A tibble: 6 × 4
##   edad_grupo_6meses     n porcentaje porcentaje_acumulado
##   <fct>             <int>      <dbl>                <dbl>
## 1 0-6                  37      28.0                  28.0
## 2 7-12                 46      34.8                  62.9
## 3 13-18                24      18.2                  81.1
## 4 25-30                10       7.58                 88.6
## 5 37-42                 9       6.82                 95.5
## 6 49-54                 6       4.55                100.

CALCULO DE RIESGOS RELATIVOS PARA 590

SEXO

library(epiR)
sexo_tabla_2 <- matrix(c(82, 398, 50, 284), nrow = 2, byrow = TRUE)
colnames(sexo_tabla) <- c("Mortalidad 590","Otra mortalidad")
rownames(sexo_tabla) <- c("Femenino","Masculino")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_sexo <- epi.2by2(dat = sexo_tabla_2, method = "cohort.count", conf.level = 0.95)
print(resultado_sexo)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          82         398        480     17.08 (13.82 to 20.75)
## Exposure-          50         284        334     14.97 (11.32 to 19.26)
## Total             132         682        814     16.22 (13.75 to 18.93)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.14 (0.83, 1.58)
## Inc odds ratio                                 1.17 (0.80, 1.72)
## Attrib risk in the exposed *                   2.11 (-2.98, 7.21)
## Attrib fraction in the exposed (%)            12.37 (-20.60, 36.59)
## Attrib risk in the population *                1.25 (-3.34, 5.83)
## Attrib fraction in the population (%)         7.68 (-1.71, 17.67)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.647 Pr>chi2 = 0.421
## Fisher exact test that OR = 1: Pr>chi2 = 0.441
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

AREA

CABECERA MUNICIPAL Y CENTRO POBLADO

area_tabla5 <- matrix(c(12, 49, 41, 329), nrow = 2, byrow = TRUE)
colnames(area_tabla5) <- c("Mortalidad 590","Otra mortalidad")
rownames(area_tabla5) <- c("Centro Poblado","Cabecera Municipal")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_area3 <- epi.2by2(dat = area_tabla5, method = "cohort.count", conf.level = 0.95)
print(resultado_area3)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          12          49         61     19.67 (10.60 to 31.84)
## Exposure-          41         329        370      11.08 (8.07 to 14.73)
## Total              53         378        431      12.30 (9.35 to 15.77)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.78 (0.99, 3.18)
## Inc odds ratio                                 1.97 (0.97, 4.00)
## Attrib risk in the exposed *                   8.59 (-1.88, 19.07)
## Attrib fraction in the exposed (%)            43.67 (-2.04, 67.61)
## Attrib risk in the population *                1.22 (-3.24, 5.67)
## Attrib fraction in the population (%)         9.89 (6.61, 13.67)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 3.584 Pr>chi2 = 0.058
## Fisher exact test that OR = 1: Pr>chi2 = 0.089
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

CABECERA MUNICIPAL Y RURAL DISPERSO

area_tabla6 <- matrix(c(79, 304, 41, 329), nrow = 2, byrow = TRUE)
colnames(area_tabla6) <- c("Mortalidad 590","Otra mortalidad")
rownames(area_tabla6) <- c("Centro Poblado","Cabecera Municipal")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_area4 <- epi.2by2(dat = area_tabla6, method = "cohort.count", conf.level = 0.95)
print(resultado_area4)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          79         304        383     20.63 (16.68 to 25.03)
## Exposure-          41         329        370      11.08 (8.07 to 14.73)
## Total             120         633        753     15.94 (13.39 to 18.75)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.86 (1.31, 2.64)
## Inc odds ratio                                 2.09 (1.39, 3.14)
## Attrib risk in the exposed *                   9.55 (4.38, 14.71)
## Attrib fraction in the exposed (%)            46.28 (24.10, 62.12)
## Attrib risk in the population *                4.86 (0.72, 8.99)
## Attrib fraction in the population (%)         30.47 (21.43, 39.74)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 12.800 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

ASEGURAMIENTO

CONTRIBUTIVO VS INDETERMINADO

aseg_tabla5 <- matrix(c(4, 11, 7, 59), nrow = 2, byrow = TRUE)
colnames(aseg_tabla5) <- c("Mortalidad 590","Otra mortalidad")
rownames(aseg_tabla5) <- c("Indeterminado","Contributivo")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_aseg5 <- epi.2by2(dat = aseg_tabla5, method = "cohort.count", conf.level = 0.95)
print(resultado_aseg5)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           4          11         15      26.67 (7.79 to 55.10)
## Exposure-           7          59         66      10.61 (4.37 to 20.64)
## Total              11          70         81      13.58 (6.98 to 23.00)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.51 (0.84, 7.50)
## Inc odds ratio                                 3.06 (0.77, 12.27)
## Attrib risk in the exposed *                   16.06 (-7.52, 39.64)
## Attrib fraction in the exposed (%)            60.23 (-18.73, 85.41)
## Attrib risk in the population *                2.97 (-7.55, 13.50)
## Attrib fraction in the population (%)         21.90 (10.27, 37.36)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 1.492 Pr>chi2 = 0.222
## Fisher exact test that OR = 1: Pr>chi2 = 0.114
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

CONTRIBUTIVO VS NO ASEGURADO

aseg_tabla6 <- matrix(c(19, 57, 7, 59), nrow = 2, byrow = TRUE)
colnames(aseg_tabla6) <- c("Mortalidad 590","Otra mortalidad")
rownames(aseg_tabla6) <- c("No asegurado","Contributivo")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_aseg6 <- epi.2by2(dat = aseg_tabla6, method = "cohort.count", conf.level = 0.95)
print(resultado_aseg6)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          19          57         76     25.00 (15.77 to 36.26)
## Exposure-           7          59         66      10.61 (4.37 to 20.64)
## Total              26         116        142     18.31 (12.32 to 25.67)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.36 (1.06, 5.25)
## Inc odds ratio                                 2.81 (1.10, 7.19)
## Attrib risk in the exposed *                   14.39 (2.15, 26.64)
## Attrib fraction in the exposed (%)            57.58 (8.72, 80.82)
## Attrib risk in the population *                7.70 (-2.08, 17.48)
## Attrib fraction in the population (%)         42.07 (19.58, 64.52)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 4.893 Pr>chi2 = 0.027
## Fisher exact test that OR = 1: Pr>chi2 = 0.031
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

CONTRIBUTIVO VS SUBSIDIADO

aseg_tabla7 <- matrix(c(102, 554, 7, 59), nrow = 2, byrow = TRUE)
colnames(aseg_tabla7) <- c("Mortalidad 590","Otra mortalidad")
rownames(aseg_tabla7) <- c("Subsidiado","Contributivo")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_aseg7 <- epi.2by2(dat = aseg_tabla7, method = "cohort.count", conf.level = 0.95)
print(resultado_aseg7)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+         102         554        656     15.55 (12.86 to 18.55)
## Exposure-           7          59         66      10.61 (4.37 to 20.64)
## Total             109         613        722     15.10 (12.56 to 17.92)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.47 (0.71, 3.02)
## Inc odds ratio                                 1.55 (0.69, 3.49)
## Attrib risk in the exposed *                   4.94 (-2.99, 12.87)
## Attrib fraction in the exposed (%)            31.79 (-34.01, 67.01)
## Attrib risk in the population *                4.49 (-3.38, 12.37)
## Attrib fraction in the population (%)         29.75 (-15.18, 65.20)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 1.143 Pr>chi2 = 0.285
## Fisher exact test that OR = 1: Pr>chi2 = 0.367
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

PERTENENCIA ETNICA

Otro vs Indígena

PE_tabla4 <- matrix(c(92, 330, 35, 312), nrow = 2, byrow = TRUE)
colnames(PE_tabla4) <- c("Mortalidad 590","Otra mortalidad")
rownames(PE_tabla4) <- c("Indígena","Otro")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_PE4 <- epi.2by2(dat = PE_tabla4, method = "cohort.count", conf.level = 0.95)
print(resultado_PE4)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          92         330        422     21.80 (17.95 to 26.05)
## Exposure-          35         312        347      10.09 (7.13 to 13.75)
## Total             127         642        769     16.51 (13.96 to 19.33)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.16 (1.50, 3.11)
## Inc odds ratio                                 2.49 (1.63, 3.78)
## Attrib risk in the exposed *                   11.71 (6.66, 16.77)
## Attrib fraction in the exposed (%)            53.73 (33.86, 67.83)
## Attrib risk in the population *                6.43 (2.31, 10.54)
## Attrib fraction in the population (%)         38.93 (28.88, 48.94)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 18.953 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otro vs Afro

PE_tabla5 <- matrix(c(92, 330, 35, 312), nrow = 2, byrow = TRUE)
colnames(PE_tabla5) <- c("Mortalidad 590","Otra mortalidad")
rownames(PE_tabla5) <- c("Afro","Otro")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_PE5 <- epi.2by2(dat = PE_tabla5, method = "cohort.count", conf.level = 0.95)
print(resultado_PE5)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          92         330        422     21.80 (17.95 to 26.05)
## Exposure-          35         312        347      10.09 (7.13 to 13.75)
## Total             127         642        769     16.51 (13.96 to 19.33)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.16 (1.50, 3.11)
## Inc odds ratio                                 2.49 (1.63, 3.78)
## Attrib risk in the exposed *                   11.71 (6.66, 16.77)
## Attrib fraction in the exposed (%)            53.73 (33.86, 67.83)
## Attrib risk in the population *                6.43 (2.31, 10.54)
## Attrib fraction in the population (%)         38.93 (28.88, 48.94)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 18.953 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

ESTRATO

Estrato 1 vs Sin Dato

E4_tabla <- matrix(c(119, 525, 7, 38), nrow = 2, byrow = TRUE)
colnames(E4_tabla) <- c("Mortalidad 590","Otra mortalidad")
rownames(E4_tabla) <- c("Estrato 1","Sin Dato")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_E4 <- epi.2by2(dat = E4_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_E4)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+         119         525        644     18.48 (15.55 to 21.70)
## Exposure-           7          38         45      15.56 (6.49 to 29.46)
## Total             126         563        689     18.29 (15.47 to 21.38)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.19 (0.59, 2.39)
## Inc odds ratio                                 1.23 (0.54, 2.82)
## Attrib risk in the exposed *                   2.92 (-8.08, 13.93)
## Attrib fraction in the exposed (%)            15.82 (-59.48, 58.78)
## Attrib risk in the population *                2.73 (-8.24, 13.71)
## Attrib fraction in the population (%)         14.94 (-37.77, 58.04)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.240 Pr>chi2 = 0.624
## Fisher exact test that OR = 1: Pr>chi2 = 0.842
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Estrato 2 vs Sin Dato

E5_tabla <- matrix(c(6, 98, 7, 38), nrow = 2, byrow = TRUE)
colnames(E5_tabla) <- c("Mortalidad 590","Otra mortalidad")
rownames(E5_tabla) <- c("Estrato 2","Sin Dato")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_E5 <- epi.2by2(dat = E5_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_E5)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           6          98        104       5.77 (2.15 to 12.13)
## Exposure-           7          38         45      15.56 (6.49 to 29.46)
## Total              13         136        149       8.72 (4.73 to 14.46)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.37 (0.13, 1.04)
## Inc odds ratio                                 0.33 (0.10, 1.05)
## Attrib risk in the exposed *                   -9.79 (-21.28, 1.71)
## Attrib fraction in the exposed (%)            -169.63 (-623.34, 0.78)
## Attrib risk in the population *                -6.83 (-18.35, 4.69)
## Attrib fraction in the population (%)         -78.29 (-103.73, -37.30)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 2.648 Pr>chi2 = 0.104
## Fisher exact test that OR = 1: Pr>chi2 = 0.063
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

GRUPOS POBLACIONALES

Desplazado

GPD_tabla2 <- matrix(c(1, 12, 131, 670), nrow = 2, byrow = TRUE)
colnames(GPD_tabla2) <- c("Mortalidad 590","Otra mortalidad")
rownames(GPD_tabla2) <- c("Desplazado","No Desplazado")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_GPD2 <- epi.2by2(dat = GPD_tabla2, method = "cohort.count", conf.level = 0.95)
print(resultado_GPD2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           1          12         13       7.69 (0.19 to 36.03)
## Exposure-         131         670        801     16.35 (13.86 to 19.10)
## Total             132         682        814     16.22 (13.75 to 18.93)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.47 (0.07, 3.11)
## Inc odds ratio                                 0.43 (0.05, 3.31)
## Attrib risk in the exposed *                   -8.66 (-23.37, 6.05)
## Attrib fraction in the exposed (%)            -112.61 (-1098.23, 51.49)
## Attrib risk in the population *                -0.14 (-3.74, 3.46)
## Attrib fraction in the population (%)         -0.85 (-0.90, -0.80)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.213 Pr>chi2 = 0.645
## Fisher exact test that OR = 1: Pr>chi2 = 0.705
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

MIGRANTE

GPM_tabla2 <- matrix(c(8, 22, 124, 660), nrow = 2, byrow = TRUE)
colnames(GPM_tabla2) <- c("Mortalidad 590","Otra mortalidad")
rownames(GPM_tabla2) <- c("No migrante","Migrante")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_GPM2 <- epi.2by2(dat = GPM_tabla2, method = "cohort.count", conf.level = 0.95)
print(resultado_GPM2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           8          22         30     26.67 (12.28 to 45.89)
## Exposure-         124         660        784     15.82 (13.33 to 18.56)
## Total             132         682        814     16.22 (13.75 to 18.93)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.69 (0.91, 3.12)
## Inc odds ratio                                 1.94 (0.84, 4.45)
## Attrib risk in the exposed *                   10.85 (-5.18, 26.88)
## Attrib fraction in the exposed (%)            40.69 (-13.59, 65.47)
## Attrib risk in the population *                0.40 (-3.20, 4.00)
## Attrib fraction in the population (%)         2.47 (1.95, 3.04)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 1.769 Pr>chi2 = 0.184
## Fisher exact test that OR = 1: Pr>chi2 = 0.128
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

ICBF

GPI_tabla2 <- matrix(c(2, 13, 130, 669), nrow = 2, byrow = TRUE)
colnames(GPI_tabla2) <- c("Mortalidad 590","Otra mortalidad")
rownames(GPI_tabla2) <- c("No ICBF","ICBF")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_GPI2 <- epi.2by2(dat = GPI_tabla2, method = "cohort.count", conf.level = 0.95)
print(resultado_GPI2)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           2          13         15      13.33 (1.66 to 40.46)
## Exposure-         130         669        799     16.27 (13.78 to 19.02)
## Total             132         682        814     16.22 (13.75 to 18.93)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.82 (0.22, 3.01)
## Inc odds ratio                                 0.79 (0.18, 3.55)
## Attrib risk in the exposed *                   -2.94 (-20.33, 14.46)
## Attrib fraction in the exposed (%)            -22.03 (-338.73, 57.73)
## Attrib risk in the population *                -0.05 (-3.65, 3.55)
## Attrib fraction in the population (%)         -0.33 (-0.45, -0.20)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.000 Pr>chi2 = 1.000
## Fisher exact test that OR = 1: Pr>chi2 = 1.000
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

TIPO_CASO

TC_tabla <- matrix(c(130, 535, 2, 147), nrow = 2, byrow = TRUE)
colnames(TC_tabla) <- c("Mortalidad 590","Otra mortalidad")
rownames(TC_tabla) <- c("Clinica","laboratorio")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_TC <- epi.2by2(dat = TC_tabla, method = "cohort.count", conf.level = 0.95)
print(resultado_TC)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+         130         535        665     19.55 (16.60 to 22.77)
## Exposure-           2         147        149        1.34 (0.16 to 4.76)
## Total             132         682        814     16.22 (13.75 to 18.93)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 14.56 (3.65, 58.19)
## Inc odds ratio                                 17.86 (4.37, 73.04)
## Attrib risk in the exposed *                   18.21 (14.67, 21.74)
## Attrib fraction in the exposed (%)            93.13 (75.45, 98.13)
## Attrib risk in the population *                14.87 (11.74, 18.01)
## Attrib fraction in the population (%)         91.72 (74.83, 98.81)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 29.698 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = <0.001
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

DEPARTAMENTO DE RESIDENCIA

Otros vs Casanare

Dpto_tabla9 <- matrix(c(4, 2, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla9) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla9) <- c("Casanare","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto9 <- epi.2by2(dat = Dpto_tabla9, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto9)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           4           2          6     66.67 (22.28 to 95.67)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              89         590        679     13.11 (10.66 to 15.88)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 5.28 (2.90, 9.61)
## Inc odds ratio                                 13.84 (2.50, 76.69)
## Attrib risk in the exposed *                   54.04 (16.23, 91.84)
## Attrib fraction in the exposed (%)            81.05 (57.05, 87.21)
## Attrib risk in the population *                0.48 (-3.09, 4.05)
## Attrib fraction in the population (%)         3.64 (3.16, 4.18)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 10.871 Pr>chi2 = <0.001
## Fisher exact test that OR = 1: Pr>chi2 = 0.003
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Guainía

Dpto_tabla10 <- matrix(c(5, 5, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla10) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla10) <- c("Guainía","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto10 <- epi.2by2(dat = Dpto_tabla10, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto10)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           5           5         10     50.00 (18.71 to 81.29)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              90         593        683     13.18 (10.73 to 15.95)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 3.96 (2.06, 7.59)
## Inc odds ratio                                 6.92 (1.96, 24.39)
## Attrib risk in the exposed *                   37.37 (6.28, 68.46)
## Attrib fraction in the exposed (%)            74.74 (45.42, 84.48)
## Attrib risk in the population *                0.55 (-3.02, 4.12)
## Attrib fraction in the population (%)         4.15 (3.56, 4.81)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 8.983 Pr>chi2 = 0.003
## Fisher exact test that OR = 1: Pr>chi2 = 0.005
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Putumayo

Dpto_tabla11 <- matrix(c(1, 1, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla11) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla11) <- c("Putumayo","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto11 <- epi.2by2(dat = Dpto_tabla11, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto11)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           1           1          2      50.00 (1.26 to 98.74)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              86         589        675     12.74 (10.32 to 15.49)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 3.96 (0.98, 16.06)
## Inc odds ratio                                 6.92 (0.43, 111.63)
## Attrib risk in the exposed *                   37.37 (-31.97, 106.71)
## Attrib fraction in the exposed (%)            74.74 (-34.62, 86.94)
## Attrib risk in the population *                0.11 (-3.44, 3.66)
## Attrib fraction in the population (%)         0.87 (0.74, 1.01)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.271 Pr>chi2 = 0.603
## Fisher exact test that OR = 1: Pr>chi2 = 0.239
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Santander

Dpto_tabla12 <- matrix(c(6, 11, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla12) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla12) <- c("Santander","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto12 <- epi.2by2(dat = Dpto_tabla12, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto12)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           6          11         17     35.29 (14.21 to 61.67)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              91         599        690     13.19 (10.75 to 15.94)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.79 (1.42, 5.48)
## Inc odds ratio                                 3.77 (1.36, 10.47)
## Attrib risk in the exposed *                   22.66 (-0.19, 45.52)
## Attrib fraction in the exposed (%)            64.21 (25.27, 79.51)
## Attrib risk in the population *                0.56 (-3.00, 4.12)
## Attrib fraction in the population (%)         4.23 (3.54, 5.01)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 5.591 Pr>chi2 = 0.018
## Fisher exact test that OR = 1: Pr>chi2 = 0.016
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Cauca

Dpto_tabla13 <- matrix(c(7, 13, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla13) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla13) <- c("Cauca","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto13 <- epi.2by2(dat = Dpto_tabla13, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto13)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           7          13         20     35.00 (15.39 to 59.22)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              92         601        693     13.28 (10.84 to 16.03)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.77 (1.48, 5.20)
## Inc odds ratio                                 3.72 (1.45, 9.60)
## Attrib risk in the exposed *                   22.37 (1.32, 43.42)
## Attrib fraction in the exposed (%)            63.91 (28.45, 78.82)
## Attrib risk in the population *                0.65 (-2.92, 4.21)
## Attrib fraction in the population (%)         4.86 (4.07, 5.75)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 6.611 Pr>chi2 = 0.010
## Fisher exact test that OR = 1: Pr>chi2 = 0.010
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Risaralda

Dpto_tabla14 <- matrix(c(8, 17, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla14) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla14) <- c("Risaralda","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto14 <- epi.2by2(dat = Dpto_tabla14, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto14)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           8          17         25     32.00 (14.95 to 53.50)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              93         605        698     13.32 (10.89 to 16.07)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.53 (1.38, 4.64)
## Inc odds ratio                                 3.26 (1.36, 7.77)
## Attrib risk in the exposed *                   19.37 (0.91, 37.83)
## Attrib fraction in the exposed (%)            60.53 (24.51, 76.68)
## Attrib risk in the population *                0.69 (-2.86, 4.25)
## Attrib fraction in the population (%)         5.21 (4.31, 6.21)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 6.244 Pr>chi2 = 0.012
## Fisher exact test that OR = 1: Pr>chi2 = 0.012
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Sucre

Dpto_tabla15 <- matrix(c(3, 7, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla15) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla15) <- c("Sucre","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto15 <- epi.2by2(dat = Dpto_tabla15, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto15)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           3           7         10      30.00 (6.67 to 65.25)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              88         595        683     12.88 (10.46 to 15.63)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.38 (0.90, 6.25)
## Inc odds ratio                                 2.96 (0.75, 11.68)
## Attrib risk in the exposed *                   17.37 (-11.14, 45.88)
## Attrib fraction in the exposed (%)            57.90 (-19.03, 79.91)
## Attrib risk in the population *                0.25 (-3.30, 3.81)
## Attrib fraction in the population (%)         1.97 (1.61, 2.38)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 1.327 Pr>chi2 = 0.249
## Fisher exact test that OR = 1: Pr>chi2 = 0.127
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Exterior

Dpto_tabla16 <- matrix(c(11, 31, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla16) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla16) <- c("Exterior","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto16 <- epi.2by2(dat = Dpto_tabla16, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto16)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          11          31         42     26.19 (13.86 to 42.04)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              96         619        715     13.43 (11.01 to 16.15)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 2.07 (1.20, 3.58)
## Inc odds ratio                                 2.45 (1.19, 5.07)
## Attrib risk in the exposed *                   13.56 (0.03, 27.09)
## Attrib fraction in the exposed (%)            51.78 (14.72, 70.68)
## Attrib risk in the population *                0.80 (-2.75, 4.34)
## Attrib fraction in the population (%)         5.93 (4.76, 7.25)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 6.254 Pr>chi2 = 0.012
## Fisher exact test that OR = 1: Pr>chi2 = 0.019
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Amazonas

Dpto_tabla17 <- matrix(c(2, 7, 85, 588), nrow = 2, byrow = TRUE)
colnames(Dpto_tabla17) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_tabla17) <- c("Amazonas","Otros")
#El grupo de comparación siempre debe estar en la segunda fila (por eso Femenino están al final).

# Calcular riesgo relativo
resultado_Dpto17 <- epi.2by2(dat = Dpto_tabla17, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto17)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           2           7          9      22.22 (2.81 to 60.01)
## Exposure-          85         588        673     12.63 (10.21 to 15.38)
## Total              87         595        682     12.76 (10.35 to 15.50)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.76 (0.51, 6.07)
## Inc odds ratio                                 1.98 (0.40, 9.67)
## Attrib risk in the exposed *                   9.59 (-17.68, 36.87)
## Attrib fraction in the exposed (%)            43.16 (-102.17, 77.69)
## Attrib risk in the population *                0.13 (-3.42, 3.67)
## Attrib fraction in the population (%)         0.99 (0.75, 1.26)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.125 Pr>chi2 = 0.723
## Fisher exact test that OR = 1: Pr>chi2 = 0.322
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

ANALISIS DEPARTAMENTO OCURRENCIA

Otros vs Casanare

Dpto_o_tabla9 <- matrix(c(4, 2, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla9 ) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla9 ) <- c("Casanare","Otros")

# Calcular riesgo relativo
resultado_Dpto_o9 <- epi.2by2(dat = Dpto_o_tabla9 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o9)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           4           2          6     66.67 (22.28 to 95.67)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total              99         118        217     45.62 (38.87 to 52.50)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.48 (0.82, 2.66)
## Inc odds ratio                                 2.44 (0.44, 13.62)
## Attrib risk in the exposed *                   21.64 (-16.67, 59.96)
## Attrib fraction in the exposed (%)            32.46 (-51.77, 52.92)
## Attrib risk in the population *                0.60 (-8.83, 10.03)
## Attrib fraction in the population (%)         1.31 (0.95, 1.75)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.402 Pr>chi2 = 0.526
## Fisher exact test that OR = 1: Pr>chi2 = 0.415
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Guainia

Dpto_o_tabla10 <- matrix(c(5, 5, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla10 ) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla10 ) <- c("Guainia","Otros")

# Calcular riesgo relativo
resultado_Dpto_o10 <- epi.2by2(dat = Dpto_o_tabla10 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o10)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           5           5         10     50.00 (18.71 to 81.29)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total             100         121        221     45.25 (38.56 to 52.06)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.11 (0.59, 2.10)
## Inc odds ratio                                 1.22 (0.34, 4.34)
## Attrib risk in the exposed *                   4.98 (-26.73, 36.68)
## Attrib fraction in the exposed (%)            9.95 (-92.68, 43.29)
## Attrib risk in the population *                0.23 (-9.16, 9.61)
## Attrib fraction in the population (%)         0.50 (0.12, 0.98)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.000 Pr>chi2 = 1.000
## Fisher exact test that OR = 1: Pr>chi2 = 0.758
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Santander

Dpto_o_tabla11 <- matrix(c(6, 11, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla11 ) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla11 ) <- c("Santander","Otros")

# Calcular riesgo relativo
resultado_Dpto_o11 <- epi.2by2(dat = Dpto_o_tabla11 , method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o11)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           6          11         17     35.29 (14.21 to 61.67)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total             101         127        228     44.30 (37.74 to 51.00)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.78 (0.40, 1.52)
## Inc odds ratio                                 0.67 (0.24, 1.87)
## Attrib risk in the exposed *                   -9.73 (-33.42, 13.96)
## Attrib fraction in the exposed (%)            -27.57 (-163.63, 25.53)
## Attrib risk in the population *                -0.73 (-10.03, 8.58)
## Attrib fraction in the population (%)         -1.64 (-1.96, -1.17)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.604 Pr>chi2 = 0.437
## Fisher exact test that OR = 1: Pr>chi2 = 0.613
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Cauca

Dpto_o_tabla12 <- matrix(c(7, 13, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla12) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla12) <- c("Cauca","Otros")

# Calcular riesgo relativo
resultado_Dpto_o12 <- epi.2by2(dat = Dpto_o_tabla12, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o12)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           7          13         20     35.00 (15.39 to 59.22)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total             102         129        231     44.16 (37.65 to 50.82)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.78 (0.42, 1.44)
## Inc odds ratio                                 0.66 (0.25, 1.71)
## Attrib risk in the exposed *                   -10.02 (-31.98, 11.93)
## Attrib fraction in the exposed (%)            -28.64 (-152.15, 22.97)
## Attrib risk in the population *                -0.87 (-10.15, 8.41)
## Attrib fraction in the population (%)         -1.97 (-2.34, -1.43)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.744 Pr>chi2 = 0.388
## Fisher exact test that OR = 1: Pr>chi2 = 0.483
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Sucre

Dpto_o_tabla13 <- matrix(c(3, 6, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla13) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla13) <- c("Sucre","Otros")

# Calcular riesgo relativo
resultado_Dpto_o13 <- epi.2by2(dat = Dpto_o_tabla13, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o13)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           3           6          9      33.33 (7.49 to 70.07)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total              98         122        220     44.55 (37.86 to 51.38)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.74 (0.29, 1.89)
## Inc odds ratio                                 0.61 (0.15, 2.51)
## Attrib risk in the exposed *                   -11.69 (-43.21, 19.83)
## Attrib fraction in the exposed (%)            -35.07 (-276.71, 32.10)
## Attrib risk in the population *                -0.48 (-9.87, 8.91)
## Attrib fraction in the population (%)         -1.07 (-1.22, -0.85)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.122 Pr>chi2 = 0.727
## Fisher exact test that OR = 1: Pr>chi2 = 0.734
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Putumayo

Dpto_o_tabla14 <- matrix(c(1, 2, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla14) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla14) <- c("Putumayo","Otros")

# Calcular riesgo relativo
resultado_Dpto_o14 <- epi.2by2(dat = Dpto_o_tabla14, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o14)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           1           2          3      33.33 (0.84 to 90.57)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total              96         118        214     44.86 (38.08 to 51.79)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.74 (0.15, 3.69)
## Inc odds ratio                                 0.61 (0.05, 6.84)
## Attrib risk in the exposed *                   -11.69 (-65.45, 42.07)
## Attrib fraction in the exposed (%)            -35.07 (-635.26, 44.72)
## Attrib risk in the population *                -0.16 (-9.62, 9.29)
## Attrib fraction in the population (%)         -0.37 (-0.41, -0.29)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.000 Pr>chi2 = 1.000
## Fisher exact test that OR = 1: Pr>chi2 = 1.000
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Risaralda

Dpto_o_tabla15 <- matrix(c(8, 17, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla15) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla15) <- c("Risaralda","Otros")

# Calcular riesgo relativo
resultado_Dpto_o15 <- epi.2by2(dat = Dpto_o_tabla15, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o15)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           8          17         25     32.00 (14.95 to 53.50)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total             103         133        236     43.64 (37.22 to 50.23)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.71 (0.39, 1.28)
## Inc odds ratio                                 0.57 (0.24, 1.39)
## Attrib risk in the exposed *                   -13.02 (-32.50, 6.46)
## Attrib fraction in the exposed (%)            -40.70 (-165.82, 15.24)
## Attrib risk in the population *                -1.38 (-10.60, 7.85)
## Attrib fraction in the population (%)         -3.16 (-3.53, -2.59)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 1.541 Pr>chi2 = 0.214
## Fisher exact test that OR = 1: Pr>chi2 = 0.287
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Vaupés

Dpto_o_tabla16 <- matrix(c(1, 3, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla16) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla16) <- c("Vaupés","Otros")

# Calcular riesgo relativo
resultado_Dpto_o16 <- epi.2by2(dat = Dpto_o_tabla16, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o16)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           1           3          4      25.00 (0.63 to 80.59)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total              96         119        215     44.65 (37.89 to 51.56)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.56 (0.10, 3.05)
## Inc odds ratio                                 0.41 (0.04, 3.98)
## Attrib risk in the exposed *                   -20.02 (-62.99, 22.94)
## Attrib fraction in the exposed (%)            -80.09 (-891.74, 37.04)
## Attrib risk in the population *                -0.37 (-9.82, 9.07)
## Attrib fraction in the population (%)         -0.83 (-0.85, -0.79)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 0.084 Pr>chi2 = 0.772
## Fisher exact test that OR = 1: Pr>chi2 = 0.630
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

Otros vs Amazonas

Dpto_o_tabla17 <- matrix(c(2, 7, 95, 116), nrow = 2, byrow = TRUE)
colnames(Dpto_o_tabla17) <- c("Mortalidad 590","Otra mortalidad")
rownames(Dpto_o_tabla17) <- c("Amazonas","Otros")

# Calcular riesgo relativo
resultado_Dpto_o17 <- epi.2by2(dat = Dpto_o_tabla17, method = "cohort.count", conf.level = 0.95)
print(resultado_Dpto_o17)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+           2           7          9      22.22 (2.81 to 60.01)
## Exposure-          95         116        211     45.02 (38.19 to 52.00)
## Total              97         123        220     44.09 (37.42 to 50.92)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.49 (0.14, 1.69)
## Inc odds ratio                                 0.35 (0.07, 1.72)
## Attrib risk in the exposed *                   -22.80 (-50.78, 5.18)
## Attrib fraction in the exposed (%)            -102.61 (-616.93, 19.36)
## Attrib risk in the population *                -0.93 (-10.32, 8.45)
## Attrib fraction in the population (%)         -2.12 (-2.13, -2.04)
## -------------------------------------------------------------------
## Yates corrected chi2 test that OR = 1: chi2(1) = 1.013 Pr>chi2 = 0.314
## Fisher exact test that OR = 1: Pr>chi2 = 0.305
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

EDAD ANALISIS GRUPO POR 6 MESES

Menor de 6 meses vs mayor de 19 meses

Edad_6m_tabla4 <- matrix(c(37, 266, 25, 89), nrow = 2, byrow = TRUE)
colnames(Edad_6m_tabla4) <- c("Mortalidad 590","Otra mortalidad")
rownames(Edad_6m_tabla4) <- c("Menor de 6m","Mayor a 19m")
# Calcular riesgo relativo
resultado_edad_6m_4 <- epi.2by2(dat = Edad_6m_tabla4, method = "cohort.count", conf.level = 0.95)
print(resultado_edad_6m_4)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          37         266        303      12.21 (8.75 to 16.44)
## Exposure-          25          89        114     21.93 (14.72 to 30.65)
## Total              62         355        417     14.87 (11.59 to 18.65)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.56 (0.35, 0.88)
## Inc odds ratio                                 0.50 (0.28, 0.87)
## Attrib risk in the exposed *                   -9.72 (-18.16, -1.28)
## Attrib fraction in the exposed (%)            -79.59 (-181.50, -13.11)
## Attrib risk in the population *                -7.06 (-15.39, 1.27)
## Attrib fraction in the population (%)         -47.50 (-64.32, -27.00)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 6.181 Pr>chi2 = 0.013
## Fisher exact test that OR = 1: Pr>chi2 = 0.020
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

7-12 meses vs mayor de 19 meses

Edad_6m_tabla5 <- matrix(c(46, 157, 25, 89), nrow = 2, byrow = TRUE)
colnames(Edad_6m_tabla5) <- c("Mortalidad 590","Otra mortalidad")
rownames(Edad_6m_tabla5) <- c("7-12 meses","Mayor a 19m")
# Calcular riesgo relativo
resultado_edad_6m_5 <- epi.2by2(dat = Edad_6m_tabla5, method = "cohort.count", conf.level = 0.95)
print(resultado_edad_6m_5)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          46         157        203     22.66 (17.09 to 29.04)
## Exposure-          25          89        114     21.93 (14.72 to 30.65)
## Total              71         246        317     22.40 (17.93 to 27.39)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 1.03 (0.67, 1.59)
## Inc odds ratio                                 1.04 (0.60, 1.81)
## Attrib risk in the exposed *                   0.73 (-8.80, 10.26)
## Attrib fraction in the exposed (%)            3.22 (-47.22, 37.28)
## Attrib risk in the population *                0.47 (-8.41, 9.34)
## Attrib fraction in the population (%)         2.09 (-11.89, 17.87)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 0.022 Pr>chi2 = 0.881
## Fisher exact test that OR = 1: Pr>chi2 = 1.000
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units

13-18 meses vs mayor de 19 meses

Edad_6m_tabla6 <- matrix(c(24, 170, 25, 89), nrow = 2, byrow = TRUE)
colnames(Edad_6m_tabla6) <- c("Mortalidad 590","Otra mortalidad")
rownames(Edad_6m_tabla6) <- c("13-18 meses","Mayor a 19m")
# Calcular riesgo relativo
resultado_edad_6m_6 <- epi.2by2(dat = Edad_6m_tabla6, method = "cohort.count", conf.level = 0.95)
print(resultado_edad_6m_6)
##              Outcome+    Outcome-      Total                 Inc risk *
## Exposure+          24         170        194      12.37 (8.09 to 17.85)
## Exposure-          25          89        114     21.93 (14.72 to 30.65)
## Total              49         259        308     15.91 (12.01 to 20.48)
## 
## Point estimates and 95% CIs:
## -------------------------------------------------------------------
## Inc risk ratio                                 0.56 (0.34, 0.94)
## Inc odds ratio                                 0.50 (0.27, 0.93)
## Attrib risk in the exposed *                   -9.56 (-18.46, -0.66)
## Attrib fraction in the exposed (%)            -77.27 (-193.18, -6.69)
## Attrib risk in the population *                -6.02 (-14.64, 2.60)
## Attrib fraction in the population (%)         -37.84 (-49.64, -22.61)
## -------------------------------------------------------------------
## Uncorrected chi2 test that OR = 1: chi2(1) = 4.904 Pr>chi2 = 0.027
## Fisher exact test that OR = 1: Pr>chi2 = 0.035
##  Wald confidence limits
##  CI: confidence interval
##  * Outcomes per 100 population units