This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(tidyverse)
## Warning: package 'ggplot2' was built under R version 4.3.3
## Warning: package 'tidyr' was built under R version 4.3.3
## Warning: package 'dplyr' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(factoextra)
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(cluster)
library(FactoMineR)
## Warning: package 'FactoMineR' was built under R version 4.3.3
library(gridExtra)
## Warning: package 'gridExtra' was built under R version 4.3.3
##
## Attaching package: 'gridExtra'
##
## The following object is masked from 'package:dplyr':
##
## combine
library(dplyr)
library (MASS)
##
## Attaching package: 'MASS'
##
## The following object is masked from 'package:dplyr':
##
## select
library(corrplot)
## corrplot 0.92 loaded
library(ggplot2)
library(ggsignif)
library(psych)
## Warning: package 'psych' was built under R version 4.3.3
##
## Attaching package: 'psych'
##
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(purrr)
library(flextable)
## Warning: package 'flextable' was built under R version 4.3.3
##
## Attaching package: 'flextable'
##
## The following object is masked from 'package:purrr':
##
## compose
library(tables)
## Warning: package 'tables' 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 objects are masked from 'package:flextable':
##
## as_image, footnote
##
## The following object is masked from 'package:dplyr':
##
## group_rows
library(car)
## Loading required package: carData
## Warning: package 'carData' was built under R version 4.3.3
##
## Attaching package: 'car'
##
## The following object is masked from 'package:psych':
##
## logit
##
## The following object is masked from 'package:dplyr':
##
## recode
##
## The following object is masked from 'package:purrr':
##
## some
library(ROSE)
## Warning: package 'ROSE' was built under R version 4.3.3
## Loaded ROSE 0.0-4
library(caret)
## Warning: package 'caret' was built under R version 4.3.3
## Loading required package: lattice
## Warning: package 'lattice' was built under R version 4.3.3
##
## Attaching package: 'caret'
##
## The following object is masked from 'package:purrr':
##
## lift
library(pROC)
## Warning: package 'pROC' was built under R version 4.3.3
## Type 'citation("pROC")' for a citation.
##
## Attaching package: 'pROC'
##
## The following objects are masked from 'package:stats':
##
## cov, smooth, var
library(ggrepel)
require(ggpubr)
## Loading required package: ggpubr
## Warning: package 'ggpubr' was built under R version 4.3.3
##
## Attaching package: 'ggpubr'
##
## The following objects are masked from 'package:flextable':
##
## border, font, rotate
library(kableExtra)
require(table1)
## Loading required package: table1
## Warning: package 'table1' was built under R version 4.3.3
##
## Attaching package: 'table1'
##
## The following objects are masked from 'package:base':
##
## units, units<-
library(graphics)
library(inspectdf)
## Warning: package 'inspectdf' was built under R version 4.3.3
library(vcd)
## Warning: package 'vcd' was built under R version 4.3.3
## Loading required package: grid
require(CGPfunctions)
## Loading required package: 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
library(survival)
## Warning: package 'survival' was built under R version 4.3.3
##
## Attaching package: 'survival'
##
## The following object is masked from 'package:caret':
##
## cluster
library(boot)
## Warning: package 'boot' was built under R version 4.3.3
##
## Attaching package: 'boot'
##
## The following object is masked from 'package:survival':
##
## aml
##
## The following object is masked from 'package:lattice':
##
## melanoma
##
## The following object is masked from 'package:car':
##
## logit
##
## The following object is masked from 'package:psych':
##
## logit
library(KMsurv)
library(survMisc)
## Warning: package 'survMisc' was built under R version 4.3.3
##
## Attaching package: 'survMisc'
##
## The following object is masked from 'package:pROC':
##
## ci
##
## The following object is masked from 'package:ggplot2':
##
## autoplot
library(survminer)
## Warning: package 'survminer' was built under R version 4.3.3
##
## Attaching package: 'survminer'
##
## The following object is masked from 'package:survival':
##
## myeloma
#library(ggfortify)
#library(flexsurv)
#library(actuar)
library(readxl)
library(readxl)
X28072024_base_de_W_final <- read_excel("C:/Users/diana/OneDrive/Escritorio/ASESORIAS_R/28072024 base de W final.xlsx",
col_types = c("numeric", "date", "numeric",
"numeric", "numeric", "text", "text",
"text", "text", "text", "text", "text",
"text", "text", "numeric", "numeric",
"numeric", "numeric", "text", "date",
"date", "numeric", "date", "date",
"numeric", "numeric", "numeric",
"date", "text", "text", "text", "numeric",
"numeric", "numeric", "text", "numeric",
"numeric", "text", "text", "text",
"text", "text", "numeric", "numeric",
"text", "text", "numeric", "text",
"text", "numeric", "numeric", "text",
"text", "numeric", "text", "text",
"numeric", "numeric", "numeric",
"numeric", "numeric", "numeric",
"numeric", "numeric", "text", "numeric",
"numeric", "numeric", "numeric",
"numeric", "numeric", "numeric",
"numeric", "numeric", "numeric",
"numeric", "numeric", "numeric",
"numeric", "numeric", "numeric",
"numeric", "text", "text", "text",
"text", "text", "text"))
View(X28072024_base_de_W_final)
summary(X28072024_base_de_W_final)
## ID fec_not semana
## Min. : 1.0 Min. :2021-01-15 00:00:00.00 Min. : 1.00
## 1st Qu.: 68.5 1st Qu.:2022-04-12 12:00:00.00 1st Qu.:20.00
## Median :130.0 Median :2022-08-19 00:00:00.00 Median :27.00
## Mean :128.0 Mean :2022-08-05 22:25:34.43 Mean :28.85
## 3rd Qu.:184.5 3rd Qu.:2022-12-24 00:00:00.00 3rd Qu.:40.00
## Max. :248.0 Max. :2023-12-15 00:00:00.00 Max. :52.00
##
## ano edad_ uni_med_ grupo_edad
## Min. :2021 Min. : 1.000 Length:183 Length:183
## 1st Qu.:2022 1st Qu.: 1.500 Class :character Class :character
## Median :2022 Median : 3.000 Mode :character Mode :character
## Mean :2022 Mean : 4.191
## 3rd Qu.:2022 3rd Qu.: 5.500
## Max. :2023 Max. :25.000
##
## nombre_nacionalidad sexo_ dir_res_ tip_ss_
## Length:183 Length:183 Length:183 Length:183
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## cod_ase_ per_etn_ nom_grupo estrato_
## Length:183 Length:183 Length:183 Min. :1.000
## Class :character Class :character Class :character 1st Qu.:2.000
## Mode :character Mode :character Mode :character Median :2.000
## Mean :2.126
## 3rd Qu.:3.000
## Max. :5.000
##
## gp_discapa gp_desplaz gp_migrant fuente_
## Min. :1.000 Min. :1.000 Min. :1.000 Length:183
## 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000 Class :character
## Median :2.000 Median :2.000 Median :2.000 Mode :character
## Mean :1.995 Mean :1.978 Mean :1.967
## 3rd Qu.:2.000 3rd Qu.:2.000 3rd Qu.:2.000
## Max. :2.000 Max. :2.000 Max. :2.000
##
## fec_con_ ini_sin_
## Min. :2021-01-12 00:00:00.00 Min. :2021-01-10 00:00:00.00
## 1st Qu.:2022-04-11 00:00:00.00 1st Qu.:2022-04-05 00:00:00.00
## Median :2022-07-23 00:00:00.00 Median :2022-07-13 00:00:00.00
## Mean :2022-07-18 13:46:13.76 Mean :2022-07-10 06:01:58.02
## 3rd Qu.:2022-12-07 12:00:00.00 3rd Qu.:2022-12-07 00:00:00.00
## Max. :2023-12-14 00:00:00.00 Max. :2023-12-14 00:00:00.00
##
## pac_hos_ fec_hos_
## Min. :1.000 Min. :2021-01-12 00:00:00.00
## 1st Qu.:1.000 1st Qu.:2022-04-13 00:00:00.00
## Median :1.000 Median :2022-07-13 00:00:00.00
## Mean :1.202 Mean :2022-07-08 13:21:03.57
## 3rd Qu.:1.000 3rd Qu.:2022-11-27 00:00:00.00
## Max. :2.000 Max. :2023-12-14 00:00:00.00
## NA's :32
## fec_def_ dif_def_sin dif_def_hos
## Min. :2021-01-15 00:00:00.00 Min. : 0.00 Min. : 0.00
## 1st Qu.:2022-04-12 00:00:00.00 1st Qu.: 3.00 1st Qu.: 0.00
## Median :2022-08-12 00:00:00.00 Median : 8.00 Median : 2.00
## Mean :2022-07-26 21:06:53.10 Mean : 16.63 Mean : 10.61
## 3rd Qu.:2022-12-22 00:00:00.00 3rd Qu.: 20.00 3rd Qu.: 12.00
## Max. :2023-12-14 00:00:00.00 Max. :337.00 Max. :260.00
## NA's :32
## df_con_sin fecha_nto_ sit_defunc
## Min. : 0.000 Min. :2016-05-11 00:00:00.00 Length:183
## 1st Qu.: 0.500 1st Qu.:2020-07-13 12:00:00.00 Class :character
## Median : 3.000 Median :2021-07-28 00:00:00.00 Mode :character
## Mean : 8.322 Mean :2021-05-08 23:52:07.86
## 3rd Qu.: 9.500 3rd Qu.:2022-04-07 12:00:00.00
## Max. :90.000 Max. :2023-10-16 00:00:00.00
##
## tip_ide_ma num_ide_ma edad_madre_siv num_hi_viv
## Length:183 Length:183 Min. :10.00 Min. : 0.000
## Class :character Class :character 1st Qu.:21.50 1st Qu.: 0.000
## Mode :character Mode :character Median :26.00 Median : 1.000
## Mean :27.08 Mean : 1.251
## 3rd Qu.:32.00 3rd Qu.: 2.000
## Max. :46.00 Max. :11.000
##
## num_hi_mue est_conyug ult_año_es asis_medic
## Min. : 1.000 Length:183 Min. : 0.000 Min. :1.000
## 1st Qu.: 1.000 Class :character 1st Qu.: 6.000 1st Qu.:1.000
## Median : 1.000 Mode :character Median :11.000 Median :1.000
## Mean : 1.148 Mean : 8.437 Mean :1.262
## 3rd Qu.: 1.000 3rd Qu.:11.000 3rd Qu.:1.000
## Max. :11.000 Max. :11.000 Max. :3.000
##
## Causa_basica_ant_originaria Descrip_sivigila Código_CIE_10
## Length:183 Length:183 Length:183
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
##
## descrip_CIE10 lista_6_67 edad_gestacional_nacer Peso_al_nacer
## Length:183 Length:183 Min. : 1.00 Min. : 860
## Class :character Class :character 1st Qu.:33.75 1st Qu.:2322
## Mode :character Mode :character Median :37.00 Median :2800
## Mean :32.95 Mean :2733
## 3rd Qu.:39.00 3rd Qu.:3130
## Max. :40.00 Max. :4800
## NA's :95 NA's :95
## direccion localidad edad_madre_RUAF tipo_parto
## Length:183 Length:183 Min. :16.00 Length:183
## Class :character Class :character 1st Qu.:22.00 Class :character
## Mode :character Mode :character Median :26.00 Mode :character
## Mean :27.34
## 3rd Qu.:32.00
## Max. :46.00
## NA's :103
## tipo_embarazo hijos_vivos hijos_muertos estado_civil
## Length:183 Min. :1.000 Min. :0.0000 Length:183
## Class :character 1st Qu.:1.000 1st Qu.:0.0000 Class :character
## Mode :character Median :2.000 Median :0.0000 Mode :character
## Mean :2.026 Mean :0.3265
## 3rd Qu.:2.000 3rd Qu.:0.0000
## Max. :7.000 Max. :9.0000
## NA's :105 NA's :85
## nivel_educativo ultimo_ano_estudios ndep_proce nmun_resi
## Length:183 Min. : 0.000 Length:183 Length:183
## Class :character 1st Qu.: 5.000 Class :character Class :character
## Mode :character Median : 6.000 Mode :character Mode :character
## Mean : 6.685
## 3rd Qu.: 9.000
## Max. :11.000
## NA's :110
## Adenovirus Influenza Influenza B Sincitial parainfluenza 3
## Min. :1 Min. :1 Min. :1 Min. :1 Min. :1
## 1st Qu.:1 1st Qu.:1 1st Qu.:1 1st Qu.:1 1st Qu.:1
## Median :1 Median :1 Median :1 Median :1 Median :1
## Mean :1 Mean :1 Mean :1 Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1 Max. :1 Max. :1 Max. :1
## NA's :119 NA's :177 NA's :181 NA's :135 NA's :161
## hemofilus influenza Rinovirus Enterovirus S. Aureus
## Min. :1 Min. :1 Min. :1 Length:183
## 1st Qu.:1 1st Qu.:1 1st Qu.:1 Class :character
## Median :1 Median :1 Median :1 Mode :character
## Mean :1 Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1 Max. :1
## NA's :166 NA's :152 NA's :155
## Streptococcus pneumoniae. Enterobacter Klepsiela Neumonie
## Min. :1 Min. :1 Min. :1
## 1st Qu.:1 1st Qu.:1 1st Qu.:1
## Median :1 Median :1 Median :1
## Mean :1 Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1 Max. :1
## NA's :165 NA's :182 NA's :177
## streptococcus piogeno Coronavirus HK Micoplasma Neumonie moraxella catarrhalis
## Min. :1 Min. :1 Min. :1 Min. :1
## 1st Qu.:1 1st Qu.:1 1st Qu.:1 1st Qu.:1
## Median :1 Median :1 Median :1 Median :1
## Mean :1 Mean :1 Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1 Max. :1 Max. :1
## NA's :182 NA's :182 NA's :182 NA's :182
## Moraxella sp Acinetobacter Candida P Auriginosa Metaneumovirus
## Min. :1 Min. :1 Min. : NA Min. :1 Min. :1
## 1st Qu.:1 1st Qu.:1 1st Qu.: NA 1st Qu.:1 1st Qu.:1
## Median :1 Median :1 Median : NA Median :1 Median :1
## Mean :1 Mean :1 Mean :NaN Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1 3rd Qu.: NA 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1 Max. : NA Max. :1 Max. :1
## NA's :178 NA's :181 NA's :183 NA's :180 NA's :171
## Neumococo E coli covid 19 Citomegalovirus
## Min. : NA Min. :1 Min. :1 Min. :1
## 1st Qu.: NA 1st Qu.:1 1st Qu.:1 1st Qu.:1
## Median : NA Median :1 Median :1 Median :1
## Mean :NaN Mean :1 Mean :1 Mean :1
## 3rd Qu.: NA 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1
## Max. : NA Max. :1 Max. :1 Max. :1
## NA's :183 NA's :177 NA's :169 NA's :182
## Total_agentes_coinfeccion tipo_infeccion estado_vacunacion
## Min. :0.000 Length:183 Length:183
## 1st Qu.:0.000 Class :character Class :character
## Median :1.000 Mode :character Mode :character
## Mean :1.634
## 3rd Qu.:3.000
## Max. :6.000
##
## Riesgo_materno Mortalidad_IRA_rev DEMORAS_ASOCIADAS_ATENCION
## Length:183 Length:183 Length:183
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
##
## TIPO_FINAL_cruce
## Length:183
## Class :character
## Mode :character
##
##
##
##
X28072024_base_de_W_final$grupo_edad<- str_replace(X28072024_base_de_W_final$grupo_edad, "De 1 a 6 meses","1 a 6 meses")
X28072024_base_de_W_final$grupo_edad<- str_replace(X28072024_base_de_W_final$grupo_edad, "De 1 a 2 años","1 a 2 años")
X28072024_base_de_W_final$grupo_edad<- str_replace(X28072024_base_de_W_final$grupo_edad, "De 3 a 4 años","3 a 4 años")
X28072024_base_de_W_final$grupo_edad<- str_replace(X28072024_base_de_W_final$grupo_edad, "De 7 a 11 meses","7 a 11 meses")
X28072024_base_de_W_final$tipo_infeccion<- str_replace(X28072024_base_de_W_final$tipo_infeccion, "Viral","viral")
t1 <- table1::table1(~grupo_edad + dif_def_sin + num_hi_viv + Total_agentes_coinfeccion + tipo_infeccion + Riesgo_materno + estado_vacunacion + edad_madre_siv |Mortalidad_IRA_rev, data = X28072024_base_de_W_final)
t1
| Confirmada COVID-19 (N=22) |
Confirmado IRA (N=83) |
Confirmado Neumonia (N=78) |
Overall (N=183) |
|
|---|---|---|---|---|
| grupo_edad | ||||
| 1 a 2 años | 3 (13.6%) | 25 (30.1%) | 24 (30.8%) | 52 (28.4%) |
| 1 a 6 meses | 13 (59.1%) | 36 (43.4%) | 21 (26.9%) | 70 (38.3%) |
| 7 a 11 meses | 5 (22.7%) | 11 (13.3%) | 17 (21.8%) | 33 (18.0%) |
| Menor 1 mes | 1 (4.5%) | 4 (4.8%) | 0 (0%) | 5 (2.7%) |
| 3 a 4 años | 0 (0%) | 7 (8.4%) | 16 (20.5%) | 23 (12.6%) |
| dif_def_sin | ||||
| Mean (SD) | 10.0 (9.57) | 20.6 (41.3) | 14.3 (19.2) | 16.6 (30.8) |
| Median [Min, Max] | 7.00 [0, 31.0] | 8.00 [0, 337] | 8.00 [0, 90.0] | 8.00 [0, 337] |
| num_hi_viv | ||||
| Mean (SD) | 1.50 (1.54) | 1.34 (1.55) | 1.09 (0.956) | 1.25 (1.33) |
| Median [Min, Max] | 1.00 [0, 7.00] | 1.00 [0, 11.0] | 1.00 [0, 4.00] | 1.00 [0, 11.0] |
| Total_agentes_coinfeccion | ||||
| Mean (SD) | 0.773 (1.11) | 1.95 (1.72) | 1.54 (1.76) | 1.63 (1.71) |
| Median [Min, Max] | 0 [0, 4.00] | 1.00 [0, 6.00] | 1.00 [0, 6.00] | 1.00 [0, 6.00] |
| tipo_infeccion | ||||
| Mixto | 2 (9.1%) | 25 (30.1%) | 15 (19.2%) | 42 (23.0%) |
| sin agente | 12 (54.5%) | 19 (22.9%) | 32 (41.0%) | 63 (34.4%) |
| viral | 8 (36.4%) | 38 (45.8%) | 27 (34.6%) | 73 (39.9%) |
| Bacteriano | 0 (0%) | 1 (1.2%) | 4 (5.1%) | 5 (2.7%) |
| Riesgo_materno | ||||
| con riesgo | 3 (13.6%) | 31 (37.3%) | 19 (24.4%) | 53 (29.0%) |
| sin dato | 16 (72.7%) | 45 (54.2%) | 54 (69.2%) | 115 (62.8%) |
| sin riesgo | 3 (13.6%) | 7 (8.4%) | 5 (6.4%) | 15 (8.2%) |
| estado_vacunacion | ||||
| completo | 5 (22.7%) | 66 (79.5%) | 40 (51.3%) | 111 (60.7%) |
| desconocido | 16 (72.7%) | 14 (16.9%) | 29 (37.2%) | 59 (32.2%) |
| incompleto | 1 (4.5%) | 3 (3.6%) | 9 (11.5%) | 13 (7.1%) |
| edad_madre_siv | ||||
| Mean (SD) | 27.8 (7.85) | 27.5 (7.19) | 26.4 (7.19) | 27.1 (7.25) |
| Median [Min, Max] | 27.0 [17.0, 46.0] | 28.0 [14.0, 42.0] | 25.0 [10.0, 41.0] | 26.0 [10.0, 46.0] |
PlotXTabs2(data=X28072024_base_de_W_final,x=grupo_edad,y=Mortalidad_IRA_rev)
tabla=table(X28072024_base_de_W_final$grupo_edad, X28072024_base_de_W_final$sexo_)
tabla
##
## F M
## 1 a 2 años 29 23
## 1 a 6 meses 25 45
## 3 a 4 años 13 10
## 7 a 11 meses 16 17
## Menor 1 mes 0 5
prop.table(tabla)*100
##
## F M
## 1 a 2 años 15.846995 12.568306
## 1 a 6 meses 13.661202 24.590164
## 3 a 4 años 7.103825 5.464481
## 7 a 11 meses 8.743169 9.289617
## Menor 1 mes 0.000000 2.732240
chi <-chisq.test(tabla) #Guardamos los resultados del test en un objeto
## Warning in chisq.test(tabla): Chi-squared approximation may be incorrect
chi
##
## Pearson's Chi-squared test
##
## data: tabla
## X-squared = 10.338, df = 4, p-value = 0.0351
fisher.test(tabla)
##
## Fisher's Exact Test for Count Data
##
## data: tabla
## p-value = 0.03247
## alternative hypothesis: two.sided
prop.test(tabla, 183, p=NULL,
alternative=c("two.sided", "less", "greater"),
conf.level=0.95, correct=TRUE)
##
## 5-sample test for equality of proportions without continuity correction
##
## data: tabla
## X-squared = 10.338, df = 4, p-value = 0.0351
## alternative hypothesis: two.sided
## sample estimates:
## prop 1 prop 2 prop 3 prop 4 prop 5
## 0.5576923 0.3571429 0.5652174 0.4848485 0.0000000
v6 = table(X28072024_base_de_W_final$Mortalidad_IRA_rev, X28072024_base_de_W_final$grupo_edad)
rownames(v6) <- c("Confirmado Neumonia", "Confirmado IRA", "Confirmada COVID-19")
colnames(v6) <- c("Menor 1 mes", "1 a 6 meses", "7 a 11 meses", "1 a 2 años", "3 a 4 años")
addmargins(v6)
##
## Menor 1 mes 1 a 6 meses 7 a 11 meses 1 a 2 años
## Confirmado Neumonia 3 13 0 5
## Confirmado IRA 25 36 7 11
## Confirmada COVID-19 24 21 16 17
## Sum 52 70 23 33
##
## 3 a 4 años Sum
## Confirmado Neumonia 1 22
## Confirmado IRA 4 83
## Confirmada COVID-19 0 78
## Sum 5 183
chisq.test(v6)
##
## Pearson's Chi-squared test
##
## data: v6
## X-squared = 21.075, df = 8, p-value = 0.006952
#fisher.test(v6)
assocstats(v6)
## X^2 df P(> X^2)
## Likelihood Ratio 25.564 8 0.0012467
## Pearson 21.075 8 0.0069519
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.321
## Cramer's V : 0.24
PlotXTabs2(data=X28072024_base_de_W_final,x=grupo_edad,y=sexo_)
v20 = table(X28072024_base_de_W_final$grupo_edad, X28072024_base_de_W_final$sexo_)
rownames(v20) <- c("Menor 1 mes", "1 a 6 meses", "7 a 11 meses", "1 a 2 años", "3 a 4 años")
colnames(v20) <- c ("M", "F")
addmargins(v20)
##
## M F Sum
## Menor 1 mes 29 23 52
## 1 a 6 meses 25 45 70
## 7 a 11 meses 13 10 23
## 1 a 2 años 16 17 33
## 3 a 4 años 0 5 5
## Sum 83 100 183
chisq.test(v20)
##
## Pearson's Chi-squared test
##
## data: v20
## X-squared = 10.338, df = 4, p-value = 0.0351
fisher.test(v20)
##
## Fisher's Exact Test for Count Data
##
## data: v20
## p-value = 0.03247
## alternative hypothesis: two.sided
assocstats(v20)
## X^2 df P(> X^2)
## Likelihood Ratio 12.261 4 0.015511
## Pearson 10.338 4 0.035101
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.231
## Cramer's V : 0.238
PlotXTabs2(data=X28072024_base_de_W_final,x=grupo_edad, y=tipo_infeccion)
v21 = table(X28072024_base_de_W_final$grupo_edad, X28072024_base_de_W_final$tipo_infeccion)
rownames(v21) <- c("Menor 1 mes", "1 a 6 meses", "7 a 11 meses", "1 a 2 años", "3 a 4 años")
colnames(v21) <- c ("viral", "sin agente", "Mixto", "Bacteriano")
addmargins(v21)
##
## viral sin agente Mixto Bacteriano Sum
## Menor 1 mes 1 17 13 21 52
## 1 a 6 meses 1 12 30 27 70
## 7 a 11 meses 3 7 4 9 23
## 1 a 2 años 0 6 14 13 33
## 3 a 4 años 0 0 2 3 5
## Sum 5 42 63 73 183
chisq.test(v21)
## Warning in chisq.test(v21): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v21
## X-squared = 21.694, df = 12, p-value = 0.0411
#fisher.test(v21)
assocstats(v21)
## X^2 df P(> X^2)
## Likelihood Ratio 19.851 12 0.069955
## Pearson 21.694 12 0.041100
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.326
## Cramer's V : 0.199
PlotXTabs2(data=X28072024_base_de_W_final,x=estado_vacunacion, y=Total_agentes_coinfeccion)
v22 = table(X28072024_base_de_W_final$estado_vacunacion, X28072024_base_de_W_final$Total_agentes_coinfeccion)
rownames(v22) <- c ("Completo", "desconocido", "incompleto")
colnames(v22) <- c ("0", "1", "2", "3", "4", "5", "6")
addmargins(v22)
##
## 0 1 2 3 4 5 6 Sum
## Completo 18 27 19 23 10 7 7 111
## desconocido 38 17 1 3 0 0 0 59
## incompleto 7 1 1 0 3 1 0 13
## Sum 63 45 21 26 13 8 7 183
chisq.test(v22)
## Warning in chisq.test(v22): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v22
## X-squared = 64.063, df = 12, p-value = 4.06e-09
#fisher.test(v22)
assocstats(v22)
## X^2 df P(> X^2)
## Likelihood Ratio 76.089 12 2.2860e-11
## Pearson 64.063 12 4.0604e-09
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.509
## Cramer's V : 0.418
PlotXTabs2(data=X28072024_base_de_W_final,x=estado_vacunacion, y=tip_ss_)
v23 = table(X28072024_base_de_W_final$estado_vacunacion, X28072024_base_de_W_final$tip_ss_)
rownames(v23) <- c ("Completo", "desconocido", "incompleto")
colnames(v23) <- c ("S", "P", "N", "C", "I")
addmargins(v23)
##
## S P N C I Sum
## Completo 76 1 1 1 32 111
## desconocido 24 1 6 0 28 59
## incompleto 6 0 1 0 6 13
## Sum 106 2 8 1 66 183
chisq.test(v23)
## Warning in chisq.test(v23): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v23
## X-squared = 18.52, df = 8, p-value = 0.01765
#fisher.test(v23)
assocstats(v23)
## X^2 df P(> X^2)
## Likelihood Ratio 19.323 8 0.013225
## Pearson 18.520 8 0.017648
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.303
## Cramer's V : 0.225
g1=ggplot(data = X28072024_base_de_W_final, aes(x = grupo_edad, y = dif_def_hos)) +
geom_boxplot(fill = "#D0D1E6", colour = "black")+geom_jitter(width = 0.3, size = 0.5)
ggarrange(g1, labels = c("A"),ncol = 2, nrow = 1)
## Warning: Removed 32 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 32 rows containing missing values or values outside the scale range
## (`geom_point()`).
g2=ggplot(data = X28072024_base_de_W_final, aes(x = grupo_edad, y = dif_def_sin)) +
geom_boxplot(fill = "#D0D1E6", colour = "black")+geom_jitter(width = 0.3, size = 0.5)
ggarrange(g1, labels = c("B"),ncol = 2, nrow = 1)
## Warning: Removed 32 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 32 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggarrange(g1, g2, labels = c("A", "B"),ncol = 2, nrow = 1)
## Warning: Removed 32 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Removed 32 rows containing missing values or values outside the scale range
## (`geom_point()`).
#DIFERENCIA FECHA DEFUNCION Y HOSPITALZACION (DIAS)
X28072024_base_de_W_final|> summarise(media_df_hx = mean(dif_def_hos, na.rm = TRUE),
varianza_df_hx = var(dif_def_hos, na.rm = TRUE),
desvi_df_hx = sd(dif_def_hos, na.rm = TRUE),
mediana_df_hx = median(dif_def_hos, na.rm = TRUE),
Q1_df_hx = quantile(dif_def_hos, na.rm = TRUE, probs=0.25),
D4_df_hx = quantile(dif_def_hos, na.rm = TRUE, probs=0.40),
P90_df_hx = quantile(dif_def_hos, na.rm = TRUE, probs=0.90))
## # A tibble: 1 × 7
## media_df_hx varianza_df_hx desvi_df_hx mediana_df_hx Q1_df_hx D4_df_hx
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 10.6 712. 26.7 2 0 1
## # ℹ 1 more variable: P90_df_hx <dbl>
#DIFERENCIA FECHA DEFUNCION E INICIO DE SINTOMAS (DIAS)
X28072024_base_de_W_final|> summarise(media_df_isin = mean(dif_def_sin, na.rm = TRUE),
varianza_df_isin = var(dif_def_sin, na.rm = TRUE),
desvi_df_isin = sd(dif_def_sin, na.rm = TRUE),
mediana_df_isin = median(dif_def_sin, na.rm = TRUE),
Q1_df_isin = quantile(dif_def_sin, na.rm = TRUE, probs=0.25),
Q4_df_isin= quantile(dif_def_sin, na.rm = TRUE, probs=0.40),
P90_df_isin = quantile(dif_def_sin, na.rm = TRUE, probs=0.90))
## # A tibble: 1 × 7
## media_df_isin varianza_df_isin desvi_df_isin mediana_df_isin Q1_df_isin
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 16.6 949. 30.8 8 3
## # ℹ 2 more variables: Q4_df_isin <dbl>, P90_df_isin <dbl>
PlotXTabs2(data=X28072024_base_de_W_final,x=grupo_edad,y=Riesgo_materno)
v40 = table(X28072024_base_de_W_final$grupo_edad, X28072024_base_de_W_final$Riesgo_materno)
rownames(v40) <- c ("Menor 1 mes", "1 a 6 meses", "7 a 11 meses", "1 a 2 años", "3 a 4 años")
colnames(v40) <- c ("sin riesgo", "sin dato", "con riesgo")
addmargins(v40)
##
## sin riesgo sin dato con riesgo Sum
## Menor 1 mes 15 31 6 52
## 1 a 6 meses 15 47 8 70
## 7 a 11 meses 8 14 1 23
## 1 a 2 años 13 20 0 33
## 3 a 4 años 2 3 0 5
## Sum 53 115 15 183
chisq.test(v40)
## Warning in chisq.test(v40): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v40
## X-squared = 8.5613, df = 8, p-value = 0.3806
fisher.test(v40)
##
## Fisher's Exact Test for Count Data
##
## data: v40
## p-value = 0.3374
## alternative hypothesis: two.sided
assocstats(v40)
## X^2 df P(> X^2)
## Likelihood Ratio 11.5530 8 0.17229
## Pearson 8.5613 8 0.38064
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.211
## Cramer's V : 0.153
PlotXTabs2(data=X28072024_base_de_W_final,x=Riesgo_materno,y=Mortalidad_IRA_rev)
v41 = table(X28072024_base_de_W_final$Riesgo_materno, X28072024_base_de_W_final$Mortalidad_IRA_rev)
rownames(v41) <- c ("con riesgo", "sin dato", "sin riesgo")
colnames(v41) <- c ("Confirmada COVID-19", "Confirmado IRA", "Confirmado Neumonia")
addmargins(v41)
##
## Confirmada COVID-19 Confirmado IRA Confirmado Neumonia Sum
## con riesgo 3 31 19 53
## sin dato 16 45 54 115
## sin riesgo 3 7 5 15
## Sum 22 83 78 183
chisq.test(v41)
## Warning in chisq.test(v41): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v41
## X-squared = 7.3057, df = 4, p-value = 0.1206
fisher.test(v41)
##
## Fisher's Exact Test for Count Data
##
## data: v41
## p-value = 0.1031
## alternative hypothesis: two.sided
assocstats(v41)
## X^2 df P(> X^2)
## Likelihood Ratio 7.5142 4 0.11108
## Pearson 7.3057 4 0.12059
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.196
## Cramer's V : 0.141
X28072024_base_de_W_final$tipo_parto<- str_replace(X28072024_base_de_W_final$tipo_parto, "Espontaneo","Vaginal")
PlotXTabs2(data=X28072024_base_de_W_final,x=tipo_parto, y=Riesgo_materno)
v44 = table(X28072024_base_de_W_final$Riesgo_materno, X28072024_base_de_W_final$tipo_parto)
rownames(v44) <- c ("sin riesgo", "sin dato", "con riesgo")
colnames(v44) <- c ("Cesárea", "Ignorado", "Sin Dato", "Vaginal")
addmargins(v44)
##
## Cesárea Ignorado Sin Dato Vaginal Sum
## sin riesgo 10 7 23 13 53
## sin dato 20 20 48 27 115
## con riesgo 0 1 7 7 15
## Sum 30 28 78 47 183
chisq.test(v44)
## Warning in chisq.test(v44): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v44
## X-squared = 6.8408, df = 6, p-value = 0.3358
fisher.test(v44)
##
## Fisher's Exact Test for Count Data
##
## data: v44
## p-value = 0.3689
## alternative hypothesis: two.sided
assocstats(v44)
## X^2 df P(> X^2)
## Likelihood Ratio 8.9798 6 0.17472
## Pearson 6.8408 6 0.33583
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.19
## Cramer's V : 0.137
Mort_IRA =subset(X28072024_base_de_W_final, X28072024_base_de_W_final$Mortalidad_IRA_rev=="Confirmado IRA")
Mort_IRA
## # A tibble: 83 × 88
## ID fec_not semana ano edad_ uni_med_ grupo_edad
## <dbl> <dttm> <dbl> <dbl> <dbl> <chr> <chr>
## 1 11 2021-03-29 00:00:00 13 2021 2 Meses 1 a 6 meses
## 2 27 2021-07-09 00:00:00 26 2021 3 Meses 1 a 6 meses
## 3 28 2021-07-09 00:00:00 27 2021 1 Meses 1 a 6 meses
## 4 30 2021-07-12 00:00:00 28 2021 2 Meses 1 a 6 meses
## 5 35 2021-08-29 00:00:00 34 2021 2 Meses 1 a 6 meses
## 6 40 2021-09-28 00:00:00 39 2021 23 dias Menor 1 mes
## 7 43 2021-10-29 00:00:00 43 2021 1 Meses 1 a 6 meses
## 8 49 2021-11-13 00:00:00 45 2021 1 Años 1 a 2 años
## 9 68 2022-04-11 00:00:00 15 2022 7 Meses 7 a 11 meses
## 10 71 2022-04-20 00:00:00 16 2022 2 Años 1 a 2 años
## # ℹ 73 more rows
## # ℹ 81 more variables: nombre_nacionalidad <chr>, sexo_ <chr>, dir_res_ <chr>,
## # tip_ss_ <chr>, cod_ase_ <chr>, per_etn_ <chr>, nom_grupo <chr>,
## # estrato_ <dbl>, gp_discapa <dbl>, gp_desplaz <dbl>, gp_migrant <dbl>,
## # fuente_ <chr>, fec_con_ <dttm>, ini_sin_ <dttm>, pac_hos_ <dbl>,
## # fec_hos_ <dttm>, fec_def_ <dttm>, dif_def_sin <dbl>, dif_def_hos <dbl>,
## # df_con_sin <dbl>, fecha_nto_ <dttm>, sit_defunc <chr>, tip_ide_ma <chr>, …
PlotXTabs2(data=Mort_IRA,x=grupo_edad,y=sexo_)
v5 = table(Mort_IRA$grupo_edad, Mort_IRA$sexo_)
rownames(v5) <- c("Menor 1 mes", "1 a 6 meses", "7 a 11 meses", "1 a 2 años", "3 a 4 años")
colnames(v5) <- c ("M", "F")
addmargins(v5)
##
## M F Sum
## Menor 1 mes 15 10 25
## 1 a 6 meses 13 23 36
## 7 a 11 meses 4 3 7
## 1 a 2 años 2 9 11
## 3 a 4 años 0 4 4
## Sum 34 49 83
chisq.test(v5)
## Warning in chisq.test(v5): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v5
## X-squared = 9.9906, df = 4, p-value = 0.04059
fisher.test(v5)
##
## Fisher's Exact Test for Count Data
##
## data: v5
## p-value = 0.03968
## alternative hypothesis: two.sided
assocstats(v5)
## X^2 df P(> X^2)
## Likelihood Ratio 11.6023 4 0.020567
## Pearson 9.9906 4 0.040586
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.328
## Cramer's V : 0.347
v4 = table(Mort_IRA$grupo_edad, Mort_IRA$tipo_infeccion)
rownames(v4) <- c("Menor 1 mes", "1 a 6 meses", "7 a 11 meses", "1 a 2 años", "3 a 4 años")
colnames(v4) <- c ("viral", "sin agente", "Mixto", "Bacteriano")
addmargins(v4)
##
## viral sin agente Mixto Bacteriano Sum
## Menor 1 mes 0 11 2 12 25
## 1 a 6 meses 1 9 12 14 36
## 7 a 11 meses 0 2 2 3 7
## 1 a 2 años 0 3 2 6 11
## 3 a 4 años 0 0 1 3 4
## Sum 1 25 19 38 83
chisq.test(v4)
## Warning in chisq.test(v4): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v4
## X-squared = 10.151, df = 12, p-value = 0.6027
fisher.test(v4)
##
## Fisher's Exact Test for Count Data
##
## data: v4
## p-value = 0.4342
## alternative hypothesis: two.sided
assocstats(v4)
## X^2 df P(> X^2)
## Likelihood Ratio 12.034 12 0.44296
## Pearson 10.151 12 0.60269
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.33
## Cramer's V : 0.202
PlotXTabs2(data=Mort_IRA,x=grupo_edad, y=tipo_infeccion)
PlotXTabs2(data=Mort_IRA,x=estado_vacunacion, y=Total_agentes_coinfeccion)
#PlotXTabs2(data = Mort_IRA, x=Total_Agentes_coinfeccion, y=estado_vacunacion)
v3 = table(Mort_IRA$estado_vacunacion, Mort_IRA$Total_agentes_coinfeccion)
rownames(v3) <- c ("Completo", "desconocido", "incompleto")
colnames(v3) <- c ("0", "1", "2", "3", "4", "5", "6")
addmargins(v3)
##
## 0 1 2 3 4 5 6 Sum
## Completo 10 18 8 16 6 4 4 66
## desconocido 7 6 1 0 0 0 0 14
## incompleto 2 0 0 0 1 0 0 3
## Sum 19 24 9 16 7 4 4 83
chisq.test(v3)
## Warning in chisq.test(v3): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v3
## X-squared = 20.806, df = 12, p-value = 0.05329
fisher.test(v3)
##
## Fisher's Exact Test for Count Data
##
## data: v3
## p-value = 0.03223
## alternative hypothesis: two.sided
assocstats(v3)
## X^2 df P(> X^2)
## Likelihood Ratio 25.173 12 0.014022
## Pearson 20.806 12 0.053291
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.448
## Cramer's V : 0.354
PlotXTabs2(data=X28072024_base_de_W_final,x=tip_ss_, y= Mortalidad_IRA_rev)
#PlotXTabs2(data=Mort_IRA,x=estado_vacunacion, y=Total_agentes_coinfeccion)
v2 = table(X28072024_base_de_W_final$tip_ss_, X28072024_base_de_W_final$Mortalidad_IRA_rev)
rownames(v2) <- c ("C", "I", "N", "P", "S")
colnames(v2) <- c ("Confirmado Neumonia", "Confirmado IRA", "Confirmada COVID-19")
addmargins(v2)
##
## Confirmado Neumonia Confirmado IRA Confirmada COVID-19 Sum
## C 9 52 45 106
## I 1 0 1 2
## N 0 3 5 8
## P 0 1 0 1
## S 12 27 27 66
## Sum 22 83 78 183
chisq.test(v2)
## Warning in chisq.test(v2): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v2
## X-squared = 10.186, df = 8, p-value = 0.2522
fisher.test(v2)
##
## Fisher's Exact Test for Count Data
##
## data: v2
## p-value = 0.206
## alternative hypothesis: two.sided
assocstats(v2)
## X^2 df P(> X^2)
## Likelihood Ratio 11.118 8 0.19510
## Pearson 10.186 8 0.25222
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.23
## Cramer's V : 0.167
PlotXTabs2(data=Mort_IRA,x=estado_vacunacion, y=tip_ss_)
v1 = table(Mort_IRA$estado_vacunacion, Mort_IRA$tip_ss_)
rownames(v1) <- c ("Completo", "desconocido", "incompleto")
colnames(v1) <- c ("S", "P", "N", "C")
addmargins(v1)
##
## S P N C Sum
## Completo 47 1 1 17 66
## desconocido 4 2 0 8 14
## incompleto 1 0 0 2 3
## Sum 52 3 1 27 83
chisq.test(v1)
## Warning in chisq.test(v1): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v1
## X-squared = 13.973, df = 6, p-value = 0.02994
fisher.test(v1)
##
## Fisher's Exact Test for Count Data
##
## data: v1
## p-value = 0.01028
## alternative hypothesis: two.sided
assocstats(v1)
## X^2 df P(> X^2)
## Likelihood Ratio 12.661 6 0.04874
## Pearson 13.973 6 0.02994
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.38
## Cramer's V : 0.29
Mort_NEU =subset(X28072024_base_de_W_final, X28072024_base_de_W_final$Mortalidad_IRA_rev=="Confirmado Neumonia")
Mort_NEU
## # A tibble: 78 × 88
## ID fec_not semana ano edad_ uni_med_ grupo_edad
## <dbl> <dttm> <dbl> <dbl> <dbl> <chr> <chr>
## 1 8 2021-03-16 00:00:00 11 2021 4 Meses 1 a 6 meses
## 2 15 2021-10-12 00:00:00 33 2021 6 Meses 1 a 6 meses
## 3 16 2021-05-04 00:00:00 18 2021 4 Años 3 a 4 años
## 4 33 2021-07-27 00:00:00 30 2021 1 Meses 1 a 6 meses
## 5 34 2021-08-02 00:00:00 31 2021 2 Años 1 a 2 años
## 6 36 2021-09-01 00:00:00 35 2021 2 Meses 1 a 6 meses
## 7 37 2021-09-15 00:00:00 37 2021 2 Años 1 a 2 años
## 8 39 2021-09-28 00:00:00 39 2021 3 Años 3 a 4 años
## 9 42 2021-10-27 00:00:00 43 2021 1 Años 1 a 2 años
## 10 46 2021-11-04 00:00:00 39 2021 1 Años 1 a 2 años
## # ℹ 68 more rows
## # ℹ 81 more variables: nombre_nacionalidad <chr>, sexo_ <chr>, dir_res_ <chr>,
## # tip_ss_ <chr>, cod_ase_ <chr>, per_etn_ <chr>, nom_grupo <chr>,
## # estrato_ <dbl>, gp_discapa <dbl>, gp_desplaz <dbl>, gp_migrant <dbl>,
## # fuente_ <chr>, fec_con_ <dttm>, ini_sin_ <dttm>, pac_hos_ <dbl>,
## # fec_hos_ <dttm>, fec_def_ <dttm>, dif_def_sin <dbl>, dif_def_hos <dbl>,
## # df_con_sin <dbl>, fecha_nto_ <dttm>, sit_defunc <chr>, tip_ide_ma <chr>, …
PlotXTabs2(data=Mort_NEU,x=grupo_edad,y=sexo_)
v10 = table(Mort_NEU$grupo_edad, Mort_NEU$sexo_)
rownames(v10) <- c("1 a 6 meses", "7 a 11 meses", "1 a 2 años", "3 a 4 años")
colnames(v10) <- c ("M", "F")
addmargins(v10)
##
## M F Sum
## 1 a 6 meses 13 11 24
## 7 a 11 meses 6 15 21
## 1 a 2 años 9 7 16
## 3 a 4 años 12 5 17
## Sum 40 38 78
chisq.test(v10)
##
## Pearson's Chi-squared test
##
## data: v10
## X-squared = 7.1096, df = 3, p-value = 0.06849
fisher.test(v10)
##
## Fisher's Exact Test for Count Data
##
## data: v10
## p-value = 0.06928
## alternative hypothesis: two.sided
assocstats(v10)
## X^2 df P(> X^2)
## Likelihood Ratio 7.3210 3 0.062341
## Pearson 7.1096 3 0.068487
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.289
## Cramer's V : 0.302
v11 = table(Mort_NEU$grupo_edad, Mort_NEU$tipo_infeccion)
rownames(v11) <- c("1 a 6 meses", "7 a 11 meses", "1 a 2 años", "3 a 4 años")
colnames(v11) <- c ("viral", "sin agente", "Mixto", "Bacteriano")
addmargins(v11)
##
## viral sin agente Mixto Bacteriano Sum
## 1 a 6 meses 1 5 9 9 24
## 7 a 11 meses 0 2 11 8 21
## 1 a 2 años 3 5 2 6 16
## 3 a 4 años 0 3 10 4 17
## Sum 4 15 32 27 78
chisq.test(v11)
## Warning in chisq.test(v11): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v11
## X-squared = 16.058, df = 9, p-value = 0.06567
fisher.test(v11)
##
## Fisher's Exact Test for Count Data
##
## data: v11
## p-value = 0.08622
## alternative hypothesis: two.sided
assocstats(v11)
## X^2 df P(> X^2)
## Likelihood Ratio 16.749 9 0.052793
## Pearson 16.058 9 0.065673
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.413
## Cramer's V : 0.262
PlotXTabs2(data=Mort_NEU,x=grupo_edad, y=tipo_infeccion)
PlotXTabs2(data=Mort_NEU,x=estado_vacunacion, y=Total_agentes_coinfeccion)
v12 = table(Mort_NEU$estado_vacunacion, Mort_NEU$Total_agentes_coinfeccion)
rownames(v12) <- c ("Completo", "desconocido", "incompleto")
colnames(v12) <- c ("0", "1", "2", "3", "4", "5", "6" )
addmargins(v12)
##
## 0 1 2 3 4 5 6 Sum
## Completo 8 8 9 6 3 3 3 40
## desconocido 19 7 0 3 0 0 0 29
## incompleto 5 0 1 0 2 1 0 9
## Sum 32 15 10 9 5 4 3 78
chisq.test(v12)
## Warning in chisq.test(v12): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v12
## X-squared = 30.119, df = 12, p-value = 0.00268
#fisher.test(v12)
assocstats(v12)
## X^2 df P(> X^2)
## Likelihood Ratio 39.215 12 9.6998e-05
## Pearson 30.119 12 2.6799e-03
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.528
## Cramer's V : 0.439
v13 = table(Mort_NEU$estado_vacunacion, Mort_NEU$tip_ss_)
rownames(v13) <- c ("Completo", "desconocido", "incompleto")
colnames(v13) <- c ("S", "P", "N", "C")
addmargins(v13)
##
## S P N C Sum
## Completo 26 0 0 14 40
## desconocido 15 1 4 9 29
## incompleto 4 0 1 4 9
## Sum 45 1 5 27 78
chisq.test(v13)
## Warning in chisq.test(v13): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v13
## X-squared = 8.2133, df = 6, p-value = 0.2229
fisher.test(v13)
##
## Fisher's Exact Test for Count Data
##
## data: v13
## p-value = 0.111
## alternative hypothesis: two.sided
assocstats(v13)
## X^2 df P(> X^2)
## Likelihood Ratio 10.3911 6 0.10912
## Pearson 8.2133 6 0.22289
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.309
## Cramer's V : 0.229
Mort_COVID =subset(X28072024_base_de_W_final, X28072024_base_de_W_final$Mortalidad_IRA_rev=="Confirmada COVID-19")
Mort_COVID
## # A tibble: 22 × 88
## ID fec_not semana ano edad_ uni_med_ grupo_edad
## <dbl> <dttm> <dbl> <dbl> <dbl> <chr> <chr>
## 1 1 2021-01-15 00:00:00 2 2021 1 Meses 1 a 6 meses
## 2 2 2021-01-27 00:00:00 4 2021 1 Años 1 a 2 años
## 3 3 2021-02-13 00:00:00 5 2021 6 Meses 1 a 6 meses
## 4 4 2021-02-10 00:00:00 6 2021 2 Meses 1 a 6 meses
## 5 17 2021-05-07 00:00:00 18 2021 2 Meses 1 a 6 meses
## 6 18 2021-05-11 00:00:00 19 2021 4 Meses 1 a 6 meses
## 7 19 2021-06-04 00:00:00 22 2021 10 Meses 7 a 11 meses
## 8 20 2021-09-02 00:00:00 23 2021 10 Meses 7 a 11 meses
## 9 22 2021-09-10 00:00:00 25 2021 4 Meses 1 a 6 meses
## 10 23 2021-06-16 00:00:00 18 2021 4 Meses 1 a 6 meses
## # ℹ 12 more rows
## # ℹ 81 more variables: nombre_nacionalidad <chr>, sexo_ <chr>, dir_res_ <chr>,
## # tip_ss_ <chr>, cod_ase_ <chr>, per_etn_ <chr>, nom_grupo <chr>,
## # estrato_ <dbl>, gp_discapa <dbl>, gp_desplaz <dbl>, gp_migrant <dbl>,
## # fuente_ <chr>, fec_con_ <dttm>, ini_sin_ <dttm>, pac_hos_ <dbl>,
## # fec_hos_ <dttm>, fec_def_ <dttm>, dif_def_sin <dbl>, dif_def_hos <dbl>,
## # df_con_sin <dbl>, fecha_nto_ <dttm>, sit_defunc <chr>, tip_ide_ma <chr>, …
PlotXTabs2(data=Mort_COVID,x=grupo_edad,y=sexo_)
v14 = table(Mort_COVID$grupo_edad, Mort_COVID$sexo_)
rownames(v14) <- c("Menor 1 mes", "1 a 6 meses", "7 a 11 meses", "1 a 2 años")
colnames(v14) <- c ("M", "F")
addmargins(v14)
##
## M F Sum
## Menor 1 mes 1 2 3
## 1 a 6 meses 6 7 13
## 7 a 11 meses 2 3 5
## 1 a 2 años 0 1 1
## Sum 9 13 22
chisq.test(v14)
## Warning in chisq.test(v14): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v14
## X-squared = 0.91317, df = 3, p-value = 0.8222
fisher.test(v14)
##
## Fisher's Exact Test for Count Data
##
## data: v14
## p-value = 1
## alternative hypothesis: two.sided
assocstats(v14)
## X^2 df P(> X^2)
## Likelihood Ratio 1.27311 3 0.73553
## Pearson 0.91317 3 0.82225
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.2
## Cramer's V : 0.204
v15 = table(Mort_COVID$grupo_edad, Mort_COVID$tipo_infeccion)
rownames(v15) <- c("Menor 1 mes", "1 a 6 meses", "7 a 11 meses", "1 a 2 años")
colnames(v15) <- c ("viral", "sin agente", "Mixto")
addmargins(v15)
##
## viral sin agente Mixto Sum
## Menor 1 mes 1 2 0 3
## 1 a 6 meses 1 7 5 13
## 7 a 11 meses 0 2 3 5
## 1 a 2 años 0 1 0 1
## Sum 2 12 8 22
chisq.test(v15)
## Warning in chisq.test(v15): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v15
## X-squared = 5.406, df = 6, p-value = 0.4929
fisher.test(v15)
##
## Fisher's Exact Test for Count Data
##
## data: v15
## p-value = 0.487
## alternative hypothesis: two.sided
assocstats(v15)
## X^2 df P(> X^2)
## Likelihood Ratio 6.4237 6 0.37744
## Pearson 5.4060 6 0.49289
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.444
## Cramer's V : 0.351
PlotXTabs2(data=Mort_COVID,x=grupo_edad, y=tipo_infeccion)
PlotXTabs2(data=Mort_COVID,x=estado_vacunacion, y=Total_agentes_coinfeccion)
v16 = table(Mort_COVID$estado_vacunacion, Mort_COVID$Total_agentes_coinfeccion)
rownames(v16) <- c ("Completo", "desconocido", "incompleto")
colnames(v16) <- c ("0", "1", "2", "3", "4")
addmargins(v16)
##
## 0 1 2 3 4 Sum
## Completo 0 1 2 1 1 5
## desconocido 12 4 0 0 0 16
## incompleto 0 1 0 0 0 1
## Sum 12 6 2 1 1 22
chisq.test(v16)
## Warning in chisq.test(v16): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v16
## X-squared = 20.167, df = 8, p-value = 0.009724
fisher.test(v16)
##
## Fisher's Exact Test for Count Data
##
## data: v16
## p-value = 0.0008935
## alternative hypothesis: two.sided
assocstats(v16)
## X^2 df P(> X^2)
## Likelihood Ratio 20.778 8 0.0077614
## Pearson 20.167 8 0.0097236
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.692
## Cramer's V : 0.677
v17 = table(Mort_COVID$estado_vacunacion, Mort_COVID$tip_ss_)
rownames(v17) <- c ("Completo", "desconocido", "incompleto")
colnames(v17) <- c ("S", "I", "C")
addmargins(v17)
##
## S I C Sum
## Completo 3 1 1 5
## desconocido 5 0 11 16
## incompleto 1 0 0 1
## Sum 9 1 12 22
chisq.test(v17)
## Warning in chisq.test(v17): Chi-squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: v17
## X-squared = 7.2951, df = 4, p-value = 0.1211
fisher.test(v17)
##
## Fisher's Exact Test for Count Data
##
## data: v17
## p-value = 0.08174
## alternative hypothesis: two.sided
assocstats(v17)
## X^2 df P(> X^2)
## Likelihood Ratio 7.4406 4 0.11436
## Pearson 7.2951 4 0.12109
##
## Phi-Coefficient : NA
## Contingency Coeff.: 0.499
## Cramer's V : 0.407
library(readxl)
grafica_long <- read_excel("C:/Users/diana/OneDrive/Escritorio/ASESORIAS_R/grafica_long.xlsx",
col_types = c("text", "numeric", "numeric"))
## Warning: Coercing text to numeric in B2 / R2C2: '01'
## Warning: Coercing text to numeric in B3 / R3C2: '02'
## Warning: Coercing text to numeric in B4 / R4C2: '03'
## Warning: Coercing text to numeric in B5 / R5C2: '04'
## Warning: Coercing text to numeric in B6 / R6C2: '05'
## Warning: Coercing text to numeric in B7 / R7C2: '06'
## Warning: Coercing text to numeric in B8 / R8C2: '07'
## Warning: Coercing text to numeric in B9 / R9C2: '08'
## Warning: Coercing text to numeric in B10 / R10C2: '09'
## Warning: Coercing text to numeric in B11 / R11C2: '11'
## Warning: Coercing text to numeric in B12 / R12C2: '12'
## Warning: Coercing text to numeric in B13 / R13C2: '13'
## Warning: Coercing text to numeric in B14 / R14C2: '14'
## Warning: Coercing text to numeric in B15 / R15C2: '15'
## Warning: Coercing text to numeric in B16 / R16C2: '16'
## Warning: Coercing text to numeric in B17 / R17C2: '17'
## Warning: Coercing text to numeric in B18 / R18C2: '18'
## Warning: Coercing text to numeric in B19 / R19C2: '19'
## Warning: Coercing text to numeric in B20 / R20C2: '20'
## Warning: Coercing text to numeric in B21 / R21C2: '21'
## Warning: Coercing text to numeric in B22 / R22C2: '22'
## Warning: Coercing text to numeric in B23 / R23C2: '23'
## Warning: Coercing text to numeric in B24 / R24C2: '24'
## Warning: Coercing text to numeric in B25 / R25C2: '25'
## Warning: Coercing text to numeric in B26 / R26C2: '26'
## Warning: Coercing text to numeric in B27 / R27C2: '27'
## Warning: Coercing text to numeric in B28 / R28C2: '28'
## Warning: Coercing text to numeric in B29 / R29C2: '29'
## Warning: Coercing text to numeric in B30 / R30C2: '30'
## Warning: Coercing text to numeric in B31 / R31C2: '31'
## Warning: Coercing text to numeric in B32 / R32C2: '32'
## Warning: Coercing text to numeric in B33 / R33C2: '33'
## Warning: Coercing text to numeric in B34 / R34C2: '34'
## Warning: Coercing text to numeric in B35 / R35C2: '35'
## Warning: Coercing text to numeric in B36 / R36C2: '36'
## Warning: Coercing text to numeric in B37 / R37C2: '37'
## Warning: Coercing text to numeric in B38 / R38C2: '38'
## Warning: Coercing text to numeric in B39 / R39C2: '39'
## Warning: Coercing text to numeric in B40 / R40C2: '40'
## Warning: Coercing text to numeric in B41 / R41C2: '41'
## Warning: Coercing text to numeric in B42 / R42C2: '42'
## Warning: Coercing text to numeric in B43 / R43C2: '43'
## Warning: Coercing text to numeric in B44 / R44C2: '44'
## Warning: Coercing text to numeric in B45 / R45C2: '45'
## Warning: Coercing text to numeric in B46 / R46C2: '46'
## Warning: Coercing text to numeric in B47 / R47C2: '47'
## Warning: Coercing text to numeric in B48 / R48C2: '48'
## Warning: Coercing text to numeric in B49 / R49C2: '49'
## Warning: Coercing text to numeric in B50 / R50C2: '50'
## Warning: Coercing text to numeric in B51 / R51C2: '51'
## Warning: Coercing text to numeric in B52 / R52C2: '52'
## Warning: Coercing text to numeric in B53 / R53C2: '01'
## Warning: Coercing text to numeric in B54 / R54C2: '02'
## Warning: Coercing text to numeric in B55 / R55C2: '03'
## Warning: Coercing text to numeric in B56 / R56C2: '04'
## Warning: Coercing text to numeric in B57 / R57C2: '05'
## Warning: Coercing text to numeric in B58 / R58C2: '06'
## Warning: Coercing text to numeric in B59 / R59C2: '07'
## Warning: Coercing text to numeric in B60 / R60C2: '08'
## Warning: Coercing text to numeric in B61 / R61C2: '09'
## Warning: Coercing text to numeric in B62 / R62C2: '11'
## Warning: Coercing text to numeric in B63 / R63C2: '12'
## Warning: Coercing text to numeric in B64 / R64C2: '13'
## Warning: Coercing text to numeric in B65 / R65C2: '14'
## Warning: Coercing text to numeric in B66 / R66C2: '15'
## Warning: Coercing text to numeric in B67 / R67C2: '16'
## Warning: Coercing text to numeric in B68 / R68C2: '17'
## Warning: Coercing text to numeric in B69 / R69C2: '18'
## Warning: Coercing text to numeric in B70 / R70C2: '19'
## Warning: Coercing text to numeric in B71 / R71C2: '20'
## Warning: Coercing text to numeric in B72 / R72C2: '21'
## Warning: Coercing text to numeric in B73 / R73C2: '22'
## Warning: Coercing text to numeric in B74 / R74C2: '23'
## Warning: Coercing text to numeric in B75 / R75C2: '24'
## Warning: Coercing text to numeric in B76 / R76C2: '25'
## Warning: Coercing text to numeric in B77 / R77C2: '26'
## Warning: Coercing text to numeric in B78 / R78C2: '27'
## Warning: Coercing text to numeric in B79 / R79C2: '28'
## Warning: Coercing text to numeric in B80 / R80C2: '29'
## Warning: Coercing text to numeric in B81 / R81C2: '30'
## Warning: Coercing text to numeric in B82 / R82C2: '31'
## Warning: Coercing text to numeric in B83 / R83C2: '32'
## Warning: Coercing text to numeric in B84 / R84C2: '33'
## Warning: Coercing text to numeric in B85 / R85C2: '34'
## Warning: Coercing text to numeric in B86 / R86C2: '35'
## Warning: Coercing text to numeric in B87 / R87C2: '36'
## Warning: Coercing text to numeric in B88 / R88C2: '37'
## Warning: Coercing text to numeric in B89 / R89C2: '38'
## Warning: Coercing text to numeric in B90 / R90C2: '39'
## Warning: Coercing text to numeric in B91 / R91C2: '40'
## Warning: Coercing text to numeric in B92 / R92C2: '41'
## Warning: Coercing text to numeric in B93 / R93C2: '42'
## Warning: Coercing text to numeric in B94 / R94C2: '43'
## Warning: Coercing text to numeric in B95 / R95C2: '44'
## Warning: Coercing text to numeric in B96 / R96C2: '45'
## Warning: Coercing text to numeric in B97 / R97C2: '46'
## Warning: Coercing text to numeric in B98 / R98C2: '47'
## Warning: Coercing text to numeric in B99 / R99C2: '48'
## Warning: Coercing text to numeric in B100 / R100C2: '49'
## Warning: Coercing text to numeric in B101 / R101C2: '50'
## Warning: Coercing text to numeric in B102 / R102C2: '51'
## Warning: Coercing text to numeric in B103 / R103C2: '52'
## Warning: Coercing text to numeric in B104 / R104C2: '01'
## Warning: Coercing text to numeric in B105 / R105C2: '02'
## Warning: Coercing text to numeric in B106 / R106C2: '03'
## Warning: Coercing text to numeric in B107 / R107C2: '04'
## Warning: Coercing text to numeric in B108 / R108C2: '05'
## Warning: Coercing text to numeric in B109 / R109C2: '06'
## Warning: Coercing text to numeric in B110 / R110C2: '07'
## Warning: Coercing text to numeric in B111 / R111C2: '08'
## Warning: Coercing text to numeric in B112 / R112C2: '09'
## Warning: Coercing text to numeric in B113 / R113C2: '11'
## Warning: Coercing text to numeric in B114 / R114C2: '12'
## Warning: Coercing text to numeric in B115 / R115C2: '13'
## Warning: Coercing text to numeric in B116 / R116C2: '14'
## Warning: Coercing text to numeric in B117 / R117C2: '15'
## Warning: Coercing text to numeric in B118 / R118C2: '16'
## Warning: Coercing text to numeric in B119 / R119C2: '17'
## Warning: Coercing text to numeric in B120 / R120C2: '18'
## Warning: Coercing text to numeric in B121 / R121C2: '19'
## Warning: Coercing text to numeric in B122 / R122C2: '20'
## Warning: Coercing text to numeric in B123 / R123C2: '21'
## Warning: Coercing text to numeric in B124 / R124C2: '22'
## Warning: Coercing text to numeric in B125 / R125C2: '23'
## Warning: Coercing text to numeric in B126 / R126C2: '24'
## Warning: Coercing text to numeric in B127 / R127C2: '25'
## Warning: Coercing text to numeric in B128 / R128C2: '26'
## Warning: Coercing text to numeric in B129 / R129C2: '27'
## Warning: Coercing text to numeric in B130 / R130C2: '28'
## Warning: Coercing text to numeric in B131 / R131C2: '29'
## Warning: Coercing text to numeric in B132 / R132C2: '30'
## Warning: Coercing text to numeric in B133 / R133C2: '31'
## Warning: Coercing text to numeric in B134 / R134C2: '32'
## Warning: Coercing text to numeric in B135 / R135C2: '33'
## Warning: Coercing text to numeric in B136 / R136C2: '34'
## Warning: Coercing text to numeric in B137 / R137C2: '35'
## Warning: Coercing text to numeric in B138 / R138C2: '36'
## Warning: Coercing text to numeric in B139 / R139C2: '37'
## Warning: Coercing text to numeric in B140 / R140C2: '38'
## Warning: Coercing text to numeric in B141 / R141C2: '39'
## Warning: Coercing text to numeric in B142 / R142C2: '40'
## Warning: Coercing text to numeric in B143 / R143C2: '41'
## Warning: Coercing text to numeric in B144 / R144C2: '42'
## Warning: Coercing text to numeric in B145 / R145C2: '43'
## Warning: Coercing text to numeric in B146 / R146C2: '44'
## Warning: Coercing text to numeric in B147 / R147C2: '45'
## Warning: Coercing text to numeric in B148 / R148C2: '46'
## Warning: Coercing text to numeric in B149 / R149C2: '47'
## Warning: Coercing text to numeric in B150 / R150C2: '48'
## Warning: Coercing text to numeric in B151 / R151C2: '49'
## Warning: Coercing text to numeric in B152 / R152C2: '50'
## Warning: Coercing text to numeric in B153 / R153C2: '51'
## Warning: Coercing text to numeric in B154 / R154C2: '52'
View(grafica_long)
library(ggplot2)
ggplot(grafica_long, aes(x = semana, y = Total, color = ano))+geom_line()+geom_point()