library(tidyverse); library(lubridate); library(epiDisplay)
## Warning: package 'forcats' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ 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
## Warning: package 'epiDisplay' was built under R version 4.3.3
## Loading required package: foreign
## Loading required package: survival
## Loading required package: MASS
##
## Attaching package: 'MASS'
##
## The following object is masked from 'package:dplyr':
##
## select
##
## Loading required package: nnet
##
## Attaching package: 'epiDisplay'
##
## The following object is masked from 'package:ggplot2':
##
## alpha
library(dplyr);library(sjmisc); library(ResourceSelection)
##
## Attaching package: 'sjmisc'
##
## The following object is masked from 'package:purrr':
##
## is_empty
##
## The following object is masked from 'package:tidyr':
##
## replace_na
##
## The following object is masked from 'package:tibble':
##
## add_case
## Warning: package 'ResourceSelection' was built under R version 4.3.3
## ResourceSelection 0.3-6 2023-06-27
library(modEvA); library(lubridate)
## Warning: package 'modEvA' was built under R version 4.3.3
#WD
setwd("C:/Users/alfredo.acosta/OneDrive - SVA/Papers/HPAI-Ecuador/case-control/Code-case-control/HPAI-risk-factors/")
v <- readxl::read_excel("db.27.02.25.xlsx")
str(v)
## tibble [157 × 29] (S3: tbl_df/tbl/data.frame)
## $ orden : num [1:157] 116 117 118 119 120 121 122 123 124 125 ...
## $ caso_o_notifi : num [1:157] 0 0 0 0 0 0 0 0 0 1 ...
## $ provincia : chr [1:157] "LOJA" "ZAMORA CHINCHIPE" "LOJA" "LOJA" ...
## $ cantón : chr [1:157] "GONZANAMA" "ZAMORA" "OLMEDO" "LOJA" ...
## $ parroquia : chr [1:157] "GONZANAMA" "CUMBARATZA" "LA TINGUE" "VALLE" ...
## $ predio : chr [1:157] "EL GUATO" "San Agustin" "Tambara" "CC de Fauna Silvestre Orillas del Zamora" ...
## $ t_explotación : chr [1:157] "Incubación" "Aves de Traspatio" "Aves de Traspatio" "Aves Silvestres" ...
## $ Nuevo_bioseguridad : chr [1:157] "no" "no" "no" "si" ...
## $ Nuevo_tipo : chr [1:157] "TRASPATIO" "TRASPATIO" "TRASPATIO" "SILVESTRES" ...
## $ notificador : chr [1:157] "PROPIETARIO" "PROPIETARIO" "PROPIETARIO" "PROPIETARIO" ...
## $ f_1_ave_enferma : POSIXct[1:157], format: "2022-01-15" "2022-04-28" ...
## $ f_notificación : POSIXct[1:157], format: "2022-03-07" "2022-05-09" ...
## $ Nuevo_dias_entre_enf_notifi : num [1:157] 51 11 4 16 7 6 5 5 102 11 ...
## $ Nuevo_fecha 1raenf_notifi : chr [1:157] "> 1 semana" "> 1 semana" "1 semana" "> 1 semana" ...
## $ f_1_visita : POSIXct[1:157], format: "2022-03-07" "2022-05-09" ...
## $ Nuevo_dias_entre_notifi_visita: num [1:157] 0 0 1 0 0 0 1 0 0 0 ...
## $ síndrome_presuntivo : chr [1:157] "Respiratorio Agudo" "Respiratorio Crónico" "Respiratorio Crónico" "Gastroentérico" ...
## $ patología : chr [1:157] "ENFERMEDADES RESPIRATORIAS" "Enfermedad Respiratoria" "Respiratoria" "Digestiva" ...
## $ especie_final : chr [1:157] "NA" "PATOS" "NA" "AVES SILVESTRES" ...
## $ f_elaboración : POSIXct[1:157], format: "2022-03-08" "2022-05-09" ...
## $ f_ingreso_sizse : POSIXct[1:157], format: "2022-03-08 08:48:21" "2022-05-09 16:11:00" ...
## $ f_cierre : POSIXct[1:157], format: "2022-04-12" "2022-06-07" ...
## $ Nuevo_fecha_enf_cierre : num [1:157] 87 40 25 44 30 56 39 38 205 219 ...
## $ det_diagnóstico : chr [1:157] "Infección por Virus de Influenza Aviar" "Infección por Virus de Influenza Aviar" "Infección por Virus de Influenza Aviar" "Infección por Virus de Influenza Aviar" ...
## $ poblacion : num [1:157] 70 33 40 1 15 ...
## $ Log_poblacion : chr [1:157] "2" "2" "2" "0" ...
## $ Nuevo_tipo_comercio : chr [1:157] "TRASPATIO <500" "TRASPATIO <500" "TRASPATIO <500" "SILVESTRE" ...
## $ ano : num [1:157] 2022 2022 2022 2022 2022 ...
## $ definitivo2 : chr [1:157] "notifi" "notifi" "notifi" "notifi" ...
table(v$caso_o_notifi)
##
## 0 1
## 124 33
table(v$provincia, v$caso_o_notifi)
##
## 0 1
## AZUAY 1 1
## BOLIVAR 13 2
## CAÑAR 14 1
## CHIMBORAZO 17 0
## COTOPAXI 8 11
## GUAYAS 5 1
## IMBABURA 4 1
## LOJA 10 0
## LOS RIOS 2 0
## MANABI 7 0
## MORONA SANTIAGO 1 1
## NAPO 6 2
## ORELLANA 4 0
## PASTAZA 8 2
## PICHINCHA 3 2
## SANTO DOMINGO DE LOS TSACHILAS 4 0
## SUCUMBIOS 3 0
## TUNGURAHUA 7 9
## ZAMORA CHINCHIPE 7 0
table(v$t_explotación, v$caso_o_notifi)
##
## 0 1
## Aves de Reproduccion 0 1
## Aves de Riña 4 0
## Aves de Traspatio 81 13
## Aves Silvestres 2 0
## Crianza y Levante 3 0
## Engorde 16 0
## Gansos 0 1
## Incubación 1 0
## Patos 1 3
## Pollos adultos 1 0
## Ponedora Comercial 12 15
## Producción 3 0
table(v$Nuevo_tipo, v$caso_o_notifi)
##
## 0 1
## ENGORDE 17 0
## PONEDORA 12 15
## SILVESTRES 2 0
## TRASPATIO 93 18
table(v$Nuevo_bioseguridad, v$caso_o_notifi)
##
## 0 1
## no 104 26
## si 20 7
table(v$notificador, v$caso_o_notifi)
##
## 0 1
## AGROCALIDAD 11 7
## OTROS 20 7
## PROPIETARIO 93 19
table(v$Nuevo_dias_entre_enf_notifi, v$caso_o_notifi)
##
## 0 1
## -5 1 0
## 0 14 2
## 1 10 4
## 2 10 6
## 3 13 4
## 4 13 2
## 5 13 1
## 6 4 3
## 7 7 1
## 8 4 1
## 9 4 0
## 10 2 1
## 11 2 3
## 12 2 1
## 13 3 1
## 14 5 0
## 15 2 1
## 16 2 0
## 20 1 0
## 23 2 1
## 27 1 0
## 28 1 0
## 30 1 0
## 32 0 1
## 36 1 0
## 51 1 0
## 52 1 0
## 62 1 0
## 71 2 0
## 102 1 0
table(v$`Nuevo_fecha 1raenf_notifi`, v$caso_o_notifi)
##
## 0 1
## > 1 semana 39 10
## 1 semana 50 11
## 48 horas 35 12
table(v$Nuevo_dias_entre_notifi_visita, v$caso_o_notifi)
##
## 0 1
## 0 83 23
## 1 33 9
## 2 2 1
## 3 3 0
## 5 1 0
## 8 1 0
## 12 1 0
table(v$síndrome_presuntivo, v$caso_o_notifi)
##
## 0 1
## De Cabeza Inchada 1 0
## De Muerte Súbita 13 9
## Gastroentérico 8 0
## Respiratorio Agudo 72 18
## Respiratorio Crónico 30 6
table(v$patología, v$caso_o_notifi)
##
## 0
## AVES PRESENTA LETARGO, PLUMAS ERIZADAS INAPETENCIA. 1
## AVES PRESENTAN LETARGO, DEBILIDAD E INAPETENCIA 1
## BRONQUITIS INFECCIOSA 1
## Complejo respiratoria 1
## Digestiva 1
## DIGESTIVA 1
## Digestivas 1
## ENF. RESPIRATORIAS 0
## enfermedad respiratoria 1
## Enfermedad respiratoria 1
## Enfermedad Respiratoria 7
## ENFERMEDAD RESPIRATORIA 9
## ENFERMEDADES RESPIRATORIA 1
## enfermedades respiratorias 2
## Enfermedades Respiratorias 2
## ENFERMEDADES RESPIRATORIAS 12
## ENFERMEDADES RESPIRATORIAS EN AVES 2
## ENFERMEDADES RESPITARORIAS 1
## FALTA DE APETITO Y DECAIMIENTO DE LAS AVES 1
## Gumboro 1
## Influenza 1
## influenza aviar 0
## Influenza aviar 1
## Influenza Aviar 5
## Influenza AViar 1
## INFLUENZA AVIAR 36
## INFLUENZA AVIAR DE ALTA PATOGENICIDAD 0
## INFLUENZA AVIAR DE ALTA PATOGENISIDAD 1
## INFLUENZA AVIAR, LARINGO TRAQUITIS, NEW CASTLE, MYCOPLASMA G, MYCOPLASMA S, BRONQUITIS INFECCIOSA, G 1
## LARINGOTRAQUEITIS INFECCIOSA AVIAR 1
## MORTALIDAD DE AVES 1
## MUERTE EN AVES 2
## MUERTE SUBITA 1
## Muerte Súbita 2
## MUERTE SÚBITA 1
## MYCOPLASMA 2
## MYCOPLASMA SINOVIAE 1
## PRESENCIA DE SINTOMATOLOGIA RESPIRATORIA 0
## Problema respiratorio 1
## PROBLEMAS REPIRATORIOS 0
## Problemas Respiratorio 1
## Problemas respiratorios 3
## Problemas Respiratorios 1
## PROBLEMAS RESPIRATORIOS 4
## PROBLEMAS RESPIRATORIOS Y MORTALIDAD 0
## respiratoria 1
## Respiratoria 2
## RESPIRATORIA 2
## SINDROME RESPIRATORIO 1
## SÍNDROME RESPIRATORIO 1
## SINTOMAS RESPIRATORIOS 3
##
## 1
## AVES PRESENTA LETARGO, PLUMAS ERIZADAS INAPETENCIA. 0
## AVES PRESENTAN LETARGO, DEBILIDAD E INAPETENCIA 0
## BRONQUITIS INFECCIOSA 0
## Complejo respiratoria 0
## Digestiva 0
## DIGESTIVA 0
## Digestivas 0
## ENF. RESPIRATORIAS 1
## enfermedad respiratoria 0
## Enfermedad respiratoria 1
## Enfermedad Respiratoria 1
## ENFERMEDAD RESPIRATORIA 6
## ENFERMEDADES RESPIRATORIA 0
## enfermedades respiratorias 0
## Enfermedades Respiratorias 0
## ENFERMEDADES RESPIRATORIAS 0
## ENFERMEDADES RESPIRATORIAS EN AVES 0
## ENFERMEDADES RESPITARORIAS 0
## FALTA DE APETITO Y DECAIMIENTO DE LAS AVES 0
## Gumboro 0
## Influenza 0
## influenza aviar 1
## Influenza aviar 0
## Influenza Aviar 1
## Influenza AViar 0
## INFLUENZA AVIAR 16
## INFLUENZA AVIAR DE ALTA PATOGENICIDAD 1
## INFLUENZA AVIAR DE ALTA PATOGENISIDAD 0
## INFLUENZA AVIAR, LARINGO TRAQUITIS, NEW CASTLE, MYCOPLASMA G, MYCOPLASMA S, BRONQUITIS INFECCIOSA, G 0
## LARINGOTRAQUEITIS INFECCIOSA AVIAR 0
## MORTALIDAD DE AVES 0
## MUERTE EN AVES 0
## MUERTE SUBITA 0
## Muerte Súbita 0
## MUERTE SÚBITA 1
## MYCOPLASMA 0
## MYCOPLASMA SINOVIAE 0
## PRESENCIA DE SINTOMATOLOGIA RESPIRATORIA 1
## Problema respiratorio 0
## PROBLEMAS REPIRATORIOS 1
## Problemas Respiratorio 0
## Problemas respiratorios 0
## Problemas Respiratorios 0
## PROBLEMAS RESPIRATORIOS 0
## PROBLEMAS RESPIRATORIOS Y MORTALIDAD 1
## respiratoria 0
## Respiratoria 0
## RESPIRATORIA 0
## SINDROME RESPIRATORIO 1
## SÍNDROME RESPIRATORIO 0
## SINTOMAS RESPIRATORIOS 0
table(v$especie_final, v$caso_o_notifi)
##
## 0 1
## AVES DE RIÑA 4 0
## AVES ENGORDE 12 0
## AVES PONEDORAS 11 5
## AVES REPRODUCCION 5 4
## AVES SILVESTRES 2 0
## GALLINAS POSTURA 15 1
## GALLINAS REPRODUCCIÓN 8 0
## GANSOS 1 1
## NA 35 17
## NINGUNA 2 0
## PATOS 4 2
## POLLOS ADULTOS 23 3
## POLLOS BEBÉS 2 0
table(v$det_diagnóstico, v$caso_o_notifi)
##
## 0 1
## Bronquitis Infecciosa Aviar 24 0
## Bursitis Infecciosa (Enfermedad de Gumboro) 2 0
## Infección por Virus de Enfermedad de Newcastle 5 0
## Infección por Virus de Influenza Aviar 76 33
## Laringotraqueítis Infecciosa Aviar 1 0
## Micoplasmosis Aviar (Mycoplasma Synoviae) 7 0
## MORTALIDAD DE AVES 1 0
## MUERTE SUBITA 1 0
## Muerte Súbita 1 0
## Problema respiratorio 1 0
## Pulorosis 1 0
table(v$poblacion, v$caso_o_notifi)
##
## 0 1
## 0 3 0
## 1 2 0
## 3 3 1
## 4 3 0
## 5 10 0
## 6 1 1
## 8 5 1
## 9 5 0
## 10 7 2
## 11 2 1
## 12 2 1
## 13 2 0
## 14 0 1
## 15 8 0
## 16 1 0
## 17 1 0
## 18 1 0
## 20 6 0
## 21 1 0
## 22 2 1
## 23 1 0
## 25 3 1
## 26 0 1
## 27 0 1
## 30 5 0
## 31 1 0
## 33 1 0
## 35 1 0
## 40 3 0
## 50 4 1
## 51 0 1
## 58 0 2
## 64 1 0
## 68 1 0
## 70 1 0
## 75 1 0
## 83 1 0
## 86 1 0
## 91 0 1
## 110 1 0
## 120 1 0
## 134 0 1
## 150 2 0
## 154 1 0
## 157 1 0
## 178 1 0
## 187 1 0
## 200 2 0
## 300 1 0
## 400 1 0
## 500 1 0
## 750 1 0
## 835 0 1
## 965 1 0
## 1000 1 0
## 1600 1 0
## 3080 0 1
## 4000 1 0
## 4500 1 0
## 5400 0 1
## 5980 1 0
## 6000 1 0
## 7023 1 0
## 7100 0 1
## 7464 0 1
## 8000 1 0
## 9500 1 0
## 9850 0 1
## 10000 0 1
## 15840 0 1
## 16862 0 1
## 19954 1 0
## 20000 1 0
## 22000 1 0
## 23718 1 0
## 28000 1 0
## 33000 1 0
## 40000 0 1
## 41010 0 1
## 50039 1 0
## 60000 0 1
## 120000 1 0
## 155389 0 1
## 189000 1 0
## 207330 1 0
## 330000 0 1
## 536910 0 1
table(round(log(v$poblacion),0), v$caso_o_notifi)
##
## 0 1
## -Inf 3 0
## 0 2 0
## 1 6 1
## 2 32 6
## 3 33 5
## 4 14 4
## 5 10 2
## 6 3 0
## 7 4 1
## 8 2 1
## 9 5 5
## 10 6 2
## 11 1 3
## 12 3 1
## 13 0 2
table(v$Nuevo_tipo_comercio, v$caso_o_notifi)
##
## 0 1
## COMERCIAL >500 22 15
## SILVESTRE 2 0
## TRASPATIO <500 100 18
table(v$ano, v$caso_o_notifi)
##
## 0 1
## 2022 24 6
## 2023 83 26
## 2024 17 1
v$fcaso <- factor(v$caso_o_notifi, levels = c(0,1), labels = c("Control","Caso"))
table(v$fcaso)
##
## Control Caso
## 124 33
table(v$caso_o_notifi)
##
## 0 1
## 124 33
table(v$provincia, v$caso_o_notifi)
##
## 0 1
## AZUAY 1 1
## BOLIVAR 13 2
## CAÑAR 14 1
## CHIMBORAZO 17 0
## COTOPAXI 8 11
## GUAYAS 5 1
## IMBABURA 4 1
## LOJA 10 0
## LOS RIOS 2 0
## MANABI 7 0
## MORONA SANTIAGO 1 1
## NAPO 6 2
## ORELLANA 4 0
## PASTAZA 8 2
## PICHINCHA 3 2
## SANTO DOMINGO DE LOS TSACHILAS 4 0
## SUCUMBIOS 3 0
## TUNGURAHUA 7 9
## ZAMORA CHINCHIPE 7 0
table(v$t_explotación, v$caso_o_notifi)
##
## 0 1
## Aves de Reproduccion 0 1
## Aves de Riña 4 0
## Aves de Traspatio 81 13
## Aves Silvestres 2 0
## Crianza y Levante 3 0
## Engorde 16 0
## Gansos 0 1
## Incubación 1 0
## Patos 1 3
## Pollos adultos 1 0
## Ponedora Comercial 12 15
## Producción 3 0
table(v$Nuevo_tipo, v$caso_o_notifi)
##
## 0 1
## ENGORDE 17 0
## PONEDORA 12 15
## SILVESTRES 2 0
## TRASPATIO 93 18
table(v$Nuevo_bioseguridad, v$caso_o_notifi)
##
## 0 1
## no 104 26
## si 20 7
table(v$notificador, v$caso_o_notifi)
##
## 0 1
## AGROCALIDAD 11 7
## OTROS 20 7
## PROPIETARIO 93 19
table(v$Nuevo_dias_entre_enf_notifi, v$caso_o_notifi)
##
## 0 1
## -5 1 0
## 0 14 2
## 1 10 4
## 2 10 6
## 3 13 4
## 4 13 2
## 5 13 1
## 6 4 3
## 7 7 1
## 8 4 1
## 9 4 0
## 10 2 1
## 11 2 3
## 12 2 1
## 13 3 1
## 14 5 0
## 15 2 1
## 16 2 0
## 20 1 0
## 23 2 1
## 27 1 0
## 28 1 0
## 30 1 0
## 32 0 1
## 36 1 0
## 51 1 0
## 52 1 0
## 62 1 0
## 71 2 0
## 102 1 0
table(v$`Nuevo_fecha 1raenf_notifi`, v$caso_o_notifi)
##
## 0 1
## > 1 semana 39 10
## 1 semana 50 11
## 48 horas 35 12
table(v$Nuevo_dias_entre_notifi_visita, v$caso_o_notifi)
##
## 0 1
## 0 83 23
## 1 33 9
## 2 2 1
## 3 3 0
## 5 1 0
## 8 1 0
## 12 1 0
table(v$síndrome_presuntivo, v$caso_o_notifi)
##
## 0 1
## De Cabeza Inchada 1 0
## De Muerte Súbita 13 9
## Gastroentérico 8 0
## Respiratorio Agudo 72 18
## Respiratorio Crónico 30 6
table(v$patología, v$caso_o_notifi)
##
## 0
## AVES PRESENTA LETARGO, PLUMAS ERIZADAS INAPETENCIA. 1
## AVES PRESENTAN LETARGO, DEBILIDAD E INAPETENCIA 1
## BRONQUITIS INFECCIOSA 1
## Complejo respiratoria 1
## Digestiva 1
## DIGESTIVA 1
## Digestivas 1
## ENF. RESPIRATORIAS 0
## enfermedad respiratoria 1
## Enfermedad respiratoria 1
## Enfermedad Respiratoria 7
## ENFERMEDAD RESPIRATORIA 9
## ENFERMEDADES RESPIRATORIA 1
## enfermedades respiratorias 2
## Enfermedades Respiratorias 2
## ENFERMEDADES RESPIRATORIAS 12
## ENFERMEDADES RESPIRATORIAS EN AVES 2
## ENFERMEDADES RESPITARORIAS 1
## FALTA DE APETITO Y DECAIMIENTO DE LAS AVES 1
## Gumboro 1
## Influenza 1
## influenza aviar 0
## Influenza aviar 1
## Influenza Aviar 5
## Influenza AViar 1
## INFLUENZA AVIAR 36
## INFLUENZA AVIAR DE ALTA PATOGENICIDAD 0
## INFLUENZA AVIAR DE ALTA PATOGENISIDAD 1
## INFLUENZA AVIAR, LARINGO TRAQUITIS, NEW CASTLE, MYCOPLASMA G, MYCOPLASMA S, BRONQUITIS INFECCIOSA, G 1
## LARINGOTRAQUEITIS INFECCIOSA AVIAR 1
## MORTALIDAD DE AVES 1
## MUERTE EN AVES 2
## MUERTE SUBITA 1
## Muerte Súbita 2
## MUERTE SÚBITA 1
## MYCOPLASMA 2
## MYCOPLASMA SINOVIAE 1
## PRESENCIA DE SINTOMATOLOGIA RESPIRATORIA 0
## Problema respiratorio 1
## PROBLEMAS REPIRATORIOS 0
## Problemas Respiratorio 1
## Problemas respiratorios 3
## Problemas Respiratorios 1
## PROBLEMAS RESPIRATORIOS 4
## PROBLEMAS RESPIRATORIOS Y MORTALIDAD 0
## respiratoria 1
## Respiratoria 2
## RESPIRATORIA 2
## SINDROME RESPIRATORIO 1
## SÍNDROME RESPIRATORIO 1
## SINTOMAS RESPIRATORIOS 3
##
## 1
## AVES PRESENTA LETARGO, PLUMAS ERIZADAS INAPETENCIA. 0
## AVES PRESENTAN LETARGO, DEBILIDAD E INAPETENCIA 0
## BRONQUITIS INFECCIOSA 0
## Complejo respiratoria 0
## Digestiva 0
## DIGESTIVA 0
## Digestivas 0
## ENF. RESPIRATORIAS 1
## enfermedad respiratoria 0
## Enfermedad respiratoria 1
## Enfermedad Respiratoria 1
## ENFERMEDAD RESPIRATORIA 6
## ENFERMEDADES RESPIRATORIA 0
## enfermedades respiratorias 0
## Enfermedades Respiratorias 0
## ENFERMEDADES RESPIRATORIAS 0
## ENFERMEDADES RESPIRATORIAS EN AVES 0
## ENFERMEDADES RESPITARORIAS 0
## FALTA DE APETITO Y DECAIMIENTO DE LAS AVES 0
## Gumboro 0
## Influenza 0
## influenza aviar 1
## Influenza aviar 0
## Influenza Aviar 1
## Influenza AViar 0
## INFLUENZA AVIAR 16
## INFLUENZA AVIAR DE ALTA PATOGENICIDAD 1
## INFLUENZA AVIAR DE ALTA PATOGENISIDAD 0
## INFLUENZA AVIAR, LARINGO TRAQUITIS, NEW CASTLE, MYCOPLASMA G, MYCOPLASMA S, BRONQUITIS INFECCIOSA, G 0
## LARINGOTRAQUEITIS INFECCIOSA AVIAR 0
## MORTALIDAD DE AVES 0
## MUERTE EN AVES 0
## MUERTE SUBITA 0
## Muerte Súbita 0
## MUERTE SÚBITA 1
## MYCOPLASMA 0
## MYCOPLASMA SINOVIAE 0
## PRESENCIA DE SINTOMATOLOGIA RESPIRATORIA 1
## Problema respiratorio 0
## PROBLEMAS REPIRATORIOS 1
## Problemas Respiratorio 0
## Problemas respiratorios 0
## Problemas Respiratorios 0
## PROBLEMAS RESPIRATORIOS 0
## PROBLEMAS RESPIRATORIOS Y MORTALIDAD 1
## respiratoria 0
## Respiratoria 0
## RESPIRATORIA 0
## SINDROME RESPIRATORIO 1
## SÍNDROME RESPIRATORIO 0
## SINTOMAS RESPIRATORIOS 0
table(v$especie_final, v$caso_o_notifi)
##
## 0 1
## AVES DE RIÑA 4 0
## AVES ENGORDE 12 0
## AVES PONEDORAS 11 5
## AVES REPRODUCCION 5 4
## AVES SILVESTRES 2 0
## GALLINAS POSTURA 15 1
## GALLINAS REPRODUCCIÓN 8 0
## GANSOS 1 1
## NA 35 17
## NINGUNA 2 0
## PATOS 4 2
## POLLOS ADULTOS 23 3
## POLLOS BEBÉS 2 0
table(v$det_diagnóstico, v$caso_o_notifi)
##
## 0 1
## Bronquitis Infecciosa Aviar 24 0
## Bursitis Infecciosa (Enfermedad de Gumboro) 2 0
## Infección por Virus de Enfermedad de Newcastle 5 0
## Infección por Virus de Influenza Aviar 76 33
## Laringotraqueítis Infecciosa Aviar 1 0
## Micoplasmosis Aviar (Mycoplasma Synoviae) 7 0
## MORTALIDAD DE AVES 1 0
## MUERTE SUBITA 1 0
## Muerte Súbita 1 0
## Problema respiratorio 1 0
## Pulorosis 1 0
table(v$poblacion, v$caso_o_notifi)
##
## 0 1
## 0 3 0
## 1 2 0
## 3 3 1
## 4 3 0
## 5 10 0
## 6 1 1
## 8 5 1
## 9 5 0
## 10 7 2
## 11 2 1
## 12 2 1
## 13 2 0
## 14 0 1
## 15 8 0
## 16 1 0
## 17 1 0
## 18 1 0
## 20 6 0
## 21 1 0
## 22 2 1
## 23 1 0
## 25 3 1
## 26 0 1
## 27 0 1
## 30 5 0
## 31 1 0
## 33 1 0
## 35 1 0
## 40 3 0
## 50 4 1
## 51 0 1
## 58 0 2
## 64 1 0
## 68 1 0
## 70 1 0
## 75 1 0
## 83 1 0
## 86 1 0
## 91 0 1
## 110 1 0
## 120 1 0
## 134 0 1
## 150 2 0
## 154 1 0
## 157 1 0
## 178 1 0
## 187 1 0
## 200 2 0
## 300 1 0
## 400 1 0
## 500 1 0
## 750 1 0
## 835 0 1
## 965 1 0
## 1000 1 0
## 1600 1 0
## 3080 0 1
## 4000 1 0
## 4500 1 0
## 5400 0 1
## 5980 1 0
## 6000 1 0
## 7023 1 0
## 7100 0 1
## 7464 0 1
## 8000 1 0
## 9500 1 0
## 9850 0 1
## 10000 0 1
## 15840 0 1
## 16862 0 1
## 19954 1 0
## 20000 1 0
## 22000 1 0
## 23718 1 0
## 28000 1 0
## 33000 1 0
## 40000 0 1
## 41010 0 1
## 50039 1 0
## 60000 0 1
## 120000 1 0
## 155389 0 1
## 189000 1 0
## 207330 1 0
## 330000 0 1
## 536910 0 1
table(round(log(v$poblacion),0), v$caso_o_notifi)
##
## 0 1
## -Inf 3 0
## 0 2 0
## 1 6 1
## 2 32 6
## 3 33 5
## 4 14 4
## 5 10 2
## 6 3 0
## 7 4 1
## 8 2 1
## 9 5 5
## 10 6 2
## 11 1 3
## 12 3 1
## 13 0 2
table(v$Nuevo_tipo_comercio, v$caso_o_notifi)
##
## 0 1
## COMERCIAL >500 22 15
## SILVESTRE 2 0
## TRASPATIO <500 100 18
table(v$ano, v$caso_o_notifi)
##
## 0 1
## 2022 24 6
## 2023 83 26
## 2024 17 1
library(PerformanceAnalytics)
## Warning: package 'PerformanceAnalytics' was built under R version 4.3.3
## Loading required package: xts
## Warning: package 'xts' was built under R version 4.3.3
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## ######################### Warning from 'xts' package ##########################
## # #
## # The dplyr lag() function breaks how base R's lag() function is supposed to #
## # work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or #
## # source() into this session won't work correctly. #
## # #
## # Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
## # conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop #
## # dplyr from breaking base R's lag() function. #
## # #
## # Code in packages is not affected. It's protected by R's namespace mechanism #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning. #
## # #
## ###############################################################################
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
##
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
##
## legend
chart.Correlation(v[,c(13,16,25)])
colnames(v)
## [1] "orden" "caso_o_notifi"
## [3] "provincia" "cantón"
## [5] "parroquia" "predio"
## [7] "t_explotación" "Nuevo_bioseguridad"
## [9] "Nuevo_tipo" "notificador"
## [11] "f_1_ave_enferma" "f_notificación"
## [13] "Nuevo_dias_entre_enf_notifi" "Nuevo_fecha 1raenf_notifi"
## [15] "f_1_visita" "Nuevo_dias_entre_notifi_visita"
## [17] "síndrome_presuntivo" "patología"
## [19] "especie_final" "f_elaboración"
## [21] "f_ingreso_sizse" "f_cierre"
## [23] "Nuevo_fecha_enf_cierre" "det_diagnóstico"
## [25] "poblacion" "Log_poblacion"
## [27] "Nuevo_tipo_comercio" "ano"
## [29] "definitivo2" "fcaso"
str(v)
## tibble [157 × 30] (S3: tbl_df/tbl/data.frame)
## $ orden : num [1:157] 116 117 118 119 120 121 122 123 124 125 ...
## $ caso_o_notifi : num [1:157] 0 0 0 0 0 0 0 0 0 1 ...
## $ provincia : chr [1:157] "LOJA" "ZAMORA CHINCHIPE" "LOJA" "LOJA" ...
## $ cantón : chr [1:157] "GONZANAMA" "ZAMORA" "OLMEDO" "LOJA" ...
## $ parroquia : chr [1:157] "GONZANAMA" "CUMBARATZA" "LA TINGUE" "VALLE" ...
## $ predio : chr [1:157] "EL GUATO" "San Agustin" "Tambara" "CC de Fauna Silvestre Orillas del Zamora" ...
## $ t_explotación : chr [1:157] "Incubación" "Aves de Traspatio" "Aves de Traspatio" "Aves Silvestres" ...
## $ Nuevo_bioseguridad : chr [1:157] "no" "no" "no" "si" ...
## $ Nuevo_tipo : chr [1:157] "TRASPATIO" "TRASPATIO" "TRASPATIO" "SILVESTRES" ...
## $ notificador : chr [1:157] "PROPIETARIO" "PROPIETARIO" "PROPIETARIO" "PROPIETARIO" ...
## $ f_1_ave_enferma : POSIXct[1:157], format: "2022-01-15" "2022-04-28" ...
## $ f_notificación : POSIXct[1:157], format: "2022-03-07" "2022-05-09" ...
## $ Nuevo_dias_entre_enf_notifi : num [1:157] 51 11 4 16 7 6 5 5 102 11 ...
## $ Nuevo_fecha 1raenf_notifi : chr [1:157] "> 1 semana" "> 1 semana" "1 semana" "> 1 semana" ...
## $ f_1_visita : POSIXct[1:157], format: "2022-03-07" "2022-05-09" ...
## $ Nuevo_dias_entre_notifi_visita: num [1:157] 0 0 1 0 0 0 1 0 0 0 ...
## $ síndrome_presuntivo : chr [1:157] "Respiratorio Agudo" "Respiratorio Crónico" "Respiratorio Crónico" "Gastroentérico" ...
## $ patología : chr [1:157] "ENFERMEDADES RESPIRATORIAS" "Enfermedad Respiratoria" "Respiratoria" "Digestiva" ...
## $ especie_final : chr [1:157] "NA" "PATOS" "NA" "AVES SILVESTRES" ...
## $ f_elaboración : POSIXct[1:157], format: "2022-03-08" "2022-05-09" ...
## $ f_ingreso_sizse : POSIXct[1:157], format: "2022-03-08 08:48:21" "2022-05-09 16:11:00" ...
## $ f_cierre : POSIXct[1:157], format: "2022-04-12" "2022-06-07" ...
## $ Nuevo_fecha_enf_cierre : num [1:157] 87 40 25 44 30 56 39 38 205 219 ...
## $ det_diagnóstico : chr [1:157] "Infección por Virus de Influenza Aviar" "Infección por Virus de Influenza Aviar" "Infección por Virus de Influenza Aviar" "Infección por Virus de Influenza Aviar" ...
## $ poblacion : num [1:157] 70 33 40 1 15 ...
## $ Log_poblacion : chr [1:157] "2" "2" "2" "0" ...
## $ Nuevo_tipo_comercio : chr [1:157] "TRASPATIO <500" "TRASPATIO <500" "TRASPATIO <500" "SILVESTRE" ...
## $ ano : num [1:157] 2022 2022 2022 2022 2022 ...
## $ definitivo2 : chr [1:157] "notifi" "notifi" "notifi" "notifi" ...
## $ fcaso : Factor w/ 2 levels "Control","Caso": 1 1 1 1 1 1 1 1 1 2 ...
v %>% group_by(ano) %>%
dplyr::select(Nuevo_dias_entre_notifi_visita,
Nuevo_dias_entre_enf_notifi,
poblacion,
Log_poblacion) %>%
descr()
## Adding missing grouping variables: `ano`
##
## ## Basic descriptive statistics
##
##
## Grouped by: 2022
##
## var type label n
## Nuevo_dias_entre_notifi_visita numeric Nuevo_dias_entre_notifi_visita 30
## Nuevo_dias_entre_enf_notifi numeric Nuevo_dias_entre_enf_notifi 30
## poblacion numeric poblacion 30
## NA.prc mean sd se md trimmed range iqr skew
## 0 0.43 0.50 0.09 0 0.42 1 (0-1) 1.00 0.28
## 0 17.43 23.10 4.22 8 12.25 101 (1-102) 16.25 2.40
## 0 15579.93 60570.68 11058.64 45 1972.88 329999 (1-330000) 751.50 5.16
##
##
## Grouped by: 2023
##
## var type label n
## Nuevo_dias_entre_notifi_visita numeric Nuevo_dias_entre_notifi_visita 109
## Nuevo_dias_entre_enf_notifi numeric Nuevo_dias_entre_enf_notifi 109
## poblacion numeric poblacion 109
## NA.prc mean sd se md trimmed range iqr skew
## 0 0.59 1.55 0.15 0 0.26 12 (0-12) 1 5.14
## 0 5.96 8.03 0.77 4 4.56 62 (0-62) 5 3.95
## 0 11848.33 57383.74 5496.37 20 1095.07 536910 (0-536910) 145 7.71
##
##
## Grouped by: 2024
##
## var type label n
## Nuevo_dias_entre_notifi_visita numeric Nuevo_dias_entre_notifi_visita 18
## Nuevo_dias_entre_enf_notifi numeric Nuevo_dias_entre_enf_notifi 18
## poblacion numeric poblacion 18
## NA.prc mean sd se md trimmed range iqr skew
## 0 0.28 0.46 0.11 0.0 0.25 1 (0-1) 0.75 1.08
## 0 10.78 17.39 4.10 4.5 8.00 76 (-5-71) 9.25 2.84
## 0 13801.67 48919.50 11530.44 50.5 2568.75 207330 (0-207330) 463.00 4.08
table(v$Nuevo_tipo, v$caso_o_notifi)
##
## 0 1
## ENGORDE 17 0
## PONEDORA 12 15
## SILVESTRES 2 0
## TRASPATIO 93 18
v$Nuevo_tipo <- gsub("SILVESTRES", "TRASPATIO", v$Nuevo_tipo)
v$ftipo <- as.factor(v$Nuevo_tipo)
tabela <- xtabs(~ v$ftipo + v$fcaso)
addmargins(tabela)
## v$fcaso
## v$ftipo Control Caso Sum
## ENGORDE 17 0 17
## PONEDORA 12 15 27
## TRASPATIO 95 18 113
## Sum 124 33 157
round(prop.table(tabela, 1),2)
## v$fcaso
## v$ftipo Control Caso
## ENGORDE 1.00 0.00
## PONEDORA 0.44 0.56
## TRASPATIO 0.84 0.16
fit.tipo <- glm(v$fcaso ~ v$ftipo, family = binomial(logit))
summary(fit.tipo)
##
## Call:
## glm(formula = v$fcaso ~ v$ftipo, family = binomial(logit))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -18.57 1581.97 -0.012 0.991
## v$ftipoPONEDORA 18.79 1581.97 0.012 0.991
## v$ftipoTRASPATIO 16.90 1581.97 0.011 0.991
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 161.46 on 156 degrees of freedom
## Residual deviance: 136.20 on 154 degrees of freedom
## AIC: 142.2
##
## Number of Fisher Scoring iterations: 17
cc(v$fcaso, v$ftipo)
##
## v$ftipo
## v$fcaso ENGORDE PONEDORA TRASPATIO
## Control 17 12 95
## Caso 0 15 18
##
## Odds ratio 1 Inf Inf
## lower 95% CI 3.9 0.7
## upper 95% CI Inf Inf
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable, correct = FALSE): Chi-squared approximation may
## be incorrect
## Chi-squared = 25.687 , 2 d.f., P value = 0
## Fisher's exact test (2-sided) P value = 0
##
## Cell counts too small - graph not shown
##
chisq.test(tabela, correct = F)
## Warning in chisq.test(tabela, correct = F): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: tabela
## X-squared = 25.687, df = 2, p-value = 2.644e-06
ftipo <- v %>% group_by(fcaso, ftipo) %>%
summarise(Number_of_events=n()) %>%
ggplot() +
geom_col(aes(ftipo, Number_of_events, fill=fcaso)) +
scale_fill_brewer(palette = "Set2") +
# scale_fill_viridis_d(option = "C", direction = -1) +
xlab("Tipo de produccion") +
ylab("N eventos sanitarios")
## `summarise()` has grouped output by 'fcaso'. You can override using the
## `.groups` argument.
cc(v$fcaso, v$Nuevo_tipo)
##
## v$Nuevo_tipo
## v$fcaso ENGORDE PONEDORA TRASPATIO
## Control 17 12 95
## Caso 0 15 18
##
## Odds ratio 1 Inf Inf
## lower 95% CI 3.9 0.7
## upper 95% CI Inf Inf
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable, correct = FALSE): Chi-squared approximation may
## be incorrect
## Chi-squared = 25.687 , 2 d.f., P value = 0
## Fisher's exact test (2-sided) P value = 0
##
## Cell counts too small - graph not shown
##
table(v$Nuevo_tipo, v$Nuevo_bioseguridad)
##
## no si
## ENGORDE 11 6
## PONEDORA 13 14
## TRASPATIO 106 7
v$fbio <- as.factor(v$Nuevo_bioseguridad)
tabela <- xtabs(~ v$fbio + v$fcaso)
addmargins(tabela)
## v$fcaso
## v$fbio Control Caso Sum
## no 104 26 130
## si 20 7 27
## Sum 124 33 157
round(prop.table(tabela, 1),2)
## v$fcaso
## v$fbio Control Caso
## no 0.80 0.20
## si 0.74 0.26
fit.bio <- glm(v$fcaso ~ v$fbio, family = binomial(logit))
summary(fit.bio)
##
## Call:
## glm(formula = v$fcaso ~ v$fbio, family = binomial(logit))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.3863 0.2193 -6.322 2.57e-10 ***
## v$fbiosi 0.3365 0.4908 0.685 0.493
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 161.46 on 156 degrees of freedom
## Residual deviance: 161.01 on 155 degrees of freedom
## AIC: 165.01
##
## Number of Fisher Scoring iterations: 4
cc(v$fcaso, v$fbio)
##
## v$fbio
## v$fcaso no si Total
## Control 104 20 124
## Caso 26 7 33
## Total 130 27 157
##
## OR = 1.4
## 95% CI = 0.53, 3.66
## Chi-squared = 0.47, 1 d.f., P value = 0.492
## Fisher's exact test (2-sided) P value = 0.603
exp(coef(fit.bio))
## (Intercept) v$fbiosi
## 0.25 1.40
chisq.test(tabela, correct = F)
##
## Pearson's Chi-squared test
##
## data: tabela
## X-squared = 0.47292, df = 1, p-value = 0.4916
fbio <- v %>% group_by(fcaso, fbio) %>%
summarise(Number_of_events=n()) %>%
ggplot() +
geom_col(aes(fbio, Number_of_events, fill=fcaso)) +
scale_fill_brewer(palette = "Set2") +
# scale_fill_viridis_d(option = "C", direction = -1) +
xlab("Bioseguridad") +
ylab("N eventos sanitarios")
## `summarise()` has grouped output by 'fcaso'. You can override using the
## `.groups` argument.
table(v$fcaso, v$notificador)
##
## AGROCALIDAD OTROS PROPIETARIO
## Control 11 20 93
## Caso 7 7 19
v$fnot <- as.factor(v$notificador)
# Reordering reference value
v$fnot <- gsub("PROPIETARIO", "1PROPIETARIO", v$fnot)
tabela <- xtabs(~ v$fnot + v$fcaso)
addmargins(tabela)
## v$fcaso
## v$fnot Control Caso Sum
## 1PROPIETARIO 93 19 112
## AGROCALIDAD 11 7 18
## OTROS 20 7 27
## Sum 124 33 157
round(prop.table(tabela, 1),2)
## v$fcaso
## v$fnot Control Caso
## 1PROPIETARIO 0.83 0.17
## AGROCALIDAD 0.61 0.39
## OTROS 0.74 0.26
fit.not <- glm(v$fcaso ~ v$fnot, family = binomial(logit))
summary(fit.not)
##
## Call:
## glm(formula = v$fcaso ~ v$fnot, family = binomial(logit))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.5882 0.2518 -6.308 2.82e-10 ***
## v$fnotAGROCALIDAD 1.1362 0.5451 2.084 0.0371 *
## v$fnotOTROS 0.5383 0.5062 1.063 0.2876
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 161.46 on 156 degrees of freedom
## Residual deviance: 156.95 on 154 degrees of freedom
## AIC: 162.95
##
## Number of Fisher Scoring iterations: 4
cc(v$fcaso, v$fnot)
##
## v$fnot
## v$fcaso 1PROPIETARIO AGROCALIDAD OTROS
## Control 93 11 20
## Caso 19 7 7
##
## Odds ratio 1 3.08 1.71
## lower 95% CI 0.89 0.53
## upper 95% CI 10.1 4.99
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable, correct = FALSE): Chi-squared approximation may
## be incorrect
## Chi-squared = 4.963 , 2 d.f., P value = 0.084
## Fisher's exact test (2-sided) P value = 0.085
exp(coef(fit.not))
## (Intercept) v$fnotAGROCALIDAD v$fnotOTROS
## 0.2043011 3.1148325 1.7131579
chisq.test(tabela, correct = F)
## Warning in chisq.test(tabela, correct = F): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: tabela
## X-squared = 4.9632, df = 2, p-value = 0.08361
fnot <- v %>% group_by(fcaso, fnot) %>%
summarise(Number_of_events=n()) %>%
ggplot() +
geom_col(aes(fnot, Number_of_events, fill=fcaso)) +
scale_fill_brewer(palette = "Set2") +
# scale_fill_viridis_d(option = "C", direction = -1) +
xlab("Notificador") +
ylab("N eventos sanitarios")
## `summarise()` has grouped output by 'fcaso'. You can override using the
## `.groups` argument.
table(v$fcaso, v$síndrome_presuntivo)
##
## De Cabeza Inchada De Muerte Súbita Gastroentérico Respiratorio Agudo
## Control 1 13 8 72
## Caso 0 9 0 18
##
## Respiratorio Crónico
## Control 30
## Caso 6
v$fsin <- as.factor(v$síndrome_presuntivo)
# Reordering reference value
v$fsin <- gsub("Respiratorio Crónico", "Respiratorio", v$fsin)
v$fsin <- gsub("Respiratorio Agudo", "Respiratorio", v$fsin)
v$fsin <- gsub("De Cabeza Inchada", "De Muerte Súbita", v$fsin)
v$fsin <- gsub("Respiratorio", "1Respiratorio", v$fsin)
tabela <- xtabs(~ v$fsin + v$fcaso)
addmargins(tabela)
## v$fcaso
## v$fsin Control Caso Sum
## 1Respiratorio 102 24 126
## De Muerte Súbita 14 9 23
## Gastroentérico 8 0 8
## Sum 124 33 157
round(prop.table(tabela, 1),2)
## v$fcaso
## v$fsin Control Caso
## 1Respiratorio 0.81 0.19
## De Muerte Súbita 0.61 0.39
## Gastroentérico 1.00 0.00
fit.sin <- glm(v$fcaso ~ v$fsin, family = binomial(logit))
summary(fit.sin)
##
## Call:
## glm(formula = v$fcaso ~ v$fsin, family = binomial(logit))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.4469 0.2269 -6.378 1.8e-10 ***
## v$fsinDe Muerte Súbita 1.0051 0.4837 2.078 0.0377 *
## v$fsinGastroentérico -16.1191 1398.7210 -0.012 0.9908
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 161.46 on 156 degrees of freedom
## Residual deviance: 153.49 on 154 degrees of freedom
## AIC: 159.49
##
## Number of Fisher Scoring iterations: 16
cc(v$fcaso, v$fsin)
##
## v$fsin
## v$fcaso 1Respiratorio De Muerte Súbita Gastroentérico
## Control 102 14 8
## Caso 24 9 0
##
## Odds ratio 1 2.71 0
## lower 95% CI 0.92 0
## upper 95% CI 7.69 2.69
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable, correct = FALSE): Chi-squared approximation may
## be incorrect
## Chi-squared = 6.969 , 2 d.f., P value = 0.031
## Fisher's exact test (2-sided) P value = 0.032
##
## Cell counts too small - graph not shown
##
exp(coef(fit.sin))
## (Intercept) v$fsinDe Muerte Súbita v$fsinGastroentérico
## 2.352941e-01 2.732143e+00 9.989467e-08
chisq.test(tabela, correct = F)
## Warning in chisq.test(tabela, correct = F): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: tabela
## X-squared = 6.9686, df = 2, p-value = 0.03068
fsin <- v %>% group_by(fcaso, fsin) %>%
summarise(Number_of_events=n()) %>%
ggplot() +
geom_col(aes(fsin, Number_of_events, fill=fcaso)) +
scale_fill_brewer(palette = "Set2") +
# scale_fill_viridis_d(option = "C", direction = -1) +
xlab("Sindrome presuntivo") +
ylab("N eventos sanitarios")
## `summarise()` has grouped output by 'fcaso'. You can override using the
## `.groups` argument.
table(v$fcaso, v$Nuevo_tipo_comercio)
##
## COMERCIAL >500 SILVESTRE TRASPATIO <500
## Control 22 2 100
## Caso 15 0 18
v$fprod <- as.factor(v$Nuevo_tipo_comercio)
tabela <- xtabs(~ v$fprod + v$fcaso)
addmargins(tabela)
## v$fcaso
## v$fprod Control Caso Sum
## COMERCIAL >500 22 15 37
## SILVESTRE 2 0 2
## TRASPATIO <500 100 18 118
## Sum 124 33 157
round(prop.table(tabela, 1),2)
## v$fcaso
## v$fprod Control Caso
## COMERCIAL >500 0.59 0.41
## SILVESTRE 1.00 0.00
## TRASPATIO <500 0.85 0.15
fit.not <- glm(v$fcaso ~ v$fprod, family = binomial(logit))
summary(fit.not)
##
## Call:
## glm(formula = v$fcaso ~ v$fprod, family = binomial(logit))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.3830 0.3348 -1.144 0.25271
## v$fprodSILVESTRE -15.1831 1029.1215 -0.015 0.98823
## v$fprodTRASPATIO <500 -1.3318 0.4215 -3.160 0.00158 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 161.46 on 156 degrees of freedom
## Residual deviance: 150.75 on 154 degrees of freedom
## AIC: 156.75
##
## Number of Fisher Scoring iterations: 14
cc(v$fcaso, v$fprod)
##
## v$fprod
## v$fcaso COMERCIAL >500 SILVESTRE TRASPATIO <500
## Control 22 2 100
## Caso 15 0 18
##
## Odds ratio 1 0 0.27
## lower 95% CI 0 0.11
## upper 95% CI 8.55 0.66
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable): Chi-squared approximation may be incorrect
## Warning in chisq.test(cctable, correct = FALSE): Chi-squared approximation may
## be incorrect
## Chi-squared = 11.388 , 2 d.f., P value = 0.003
## Fisher's exact test (2-sided) P value = 0.003
##
## Cell counts too small - graph not shown
##
exp(coef(fit.not))
## (Intercept) v$fprodSILVESTRE v$fprodTRASPATIO <500
## 6.818182e-01 2.547264e-07 2.640000e-01
chisq.test(tabela, correct = F)
## Warning in chisq.test(tabela, correct = F): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: tabela
## X-squared = 11.388, df = 2, p-value = 0.003366
fprod <- v %>% group_by(fcaso, fprod) %>%
summarise(Number_of_events=n()) %>%
ggplot() +
geom_col(aes(fprod, Number_of_events, fill=fcaso)) +
scale_fill_brewer(palette = "Set2") +
# scale_fill_viridis_d(option = "C", direction = -1) +
xlab("Tipo de produccion") +
ylab("N eventos sanitarios")
## `summarise()` has grouped output by 'fcaso'. You can override using the
## `.groups` argument.
ymd(v$f_1_ave_enferma) - ymd(v$f_notificación)
## Time differences in days
## [1] -51 -11 -4 -16 -7 -6 -5 -5 -102 -11 -13 -1 -30 -5 -6
## [16] -23 -12 -1 -3 -8 -12 -5 -4 -3 -8 -2 -4 -23 -23 -2
## [31] -3 -1 -15 -2 -1 0 -10 -71 -3 -2 -7 0 -4 -4 -2
## [46] -14 -2 -3 -20 -1 -5 -11 -14 -4 -1 -52 -6 -1 -4 -9
## [61] -5 -3 -2 -2 -3 -28 -4 -2 -8 -6 -3 -4 -32 -5 -9
## [76] -11 -15 -3 -4 0 -1 -1 -5 -2 -14 -7 -1 -16 0 -2
## [91] -27 -3 0 -6 -7 -4 -15 0 0 0 -7 -3 -14 -13 -9
## [106] -4 -2 0 0 0 -12 -11 -6 -5 -5 -5 -1 -5 -1 -62
## [121] 0 0 -7 -4 -6 -7 -2 -2 -2 -3 -3 -7 0 0 -8
## [136] -3 -1 -10 -5 -4 -3 -71 0 -1 -9 -5 -2 -3 -10 -14
## [151] -13 -4 5 -13 -3 -36 -8
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.3.3
arr <- ggarrange(fbio,
fnot,
fsin,
ftipo,
fprod,
nrow = 3,
ncol = 2,
common.legend = TRUE,
font.label = list(size = 6, color = "black", family = NULL),
font.text = list(size = 6, color = "black", family = NULL),
legend = "bottom")
arr
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:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.