Análisis descriptivo de datos
##
## 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
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
Se usó “dplyr”, “jaitor” y “ggplo2”
Despliegue de la estructura del dataframe
Verificación de la correcta asignación del tipo de datos
## id age sex dataset cp trestbps chol fbs restecg thalch
## 1 1 63 M CLE typical_angina 145 233 TRUE lv_hypertrophy 150
## 2 2 67 M CLE asymptomatic 160 286 FALSE lv_hypertrophy 108
## 3 3 67 M CLE asymptomatic 120 229 FALSE lv_hypertrophy 129
## 4 4 37 M CLE non_anginal 130 250 FALSE normal 187
## 5 5 41 F CLE atypical_angina 130 204 FALSE lv_hypertrophy 172
## 6 6 56 M CLE atypical_angina 120 236 FALSE normal 178
## exang oldpeak slope ca thal num
## 1 FALSE 2.3 downsloping 0 fixed_defect 0
## 2 TRUE 1.5 flat 3 normal 2
## 3 TRUE 2.6 flat 2 reversable_defect 1
## 4 FALSE 3.5 downsloping 0 normal 0
## 5 FALSE 1.4 upsloping 0 normal 0
## 6 FALSE 0.8 upsloping 0 normal 0
## 'data.frame': 299 obs. of 16 variables:
## $ id : int 1 2 3 4 5 6 7 8 9 10 ...
## $ age : int 63 67 67 37 41 56 62 57 63 53 ...
## $ sex : chr "M" "M" "M" "M" ...
## $ dataset : chr "CLE" "CLE" "CLE" "CLE" ...
## $ cp : chr "typical_angina" "asymptomatic" "asymptomatic" "non_anginal" ...
## $ trestbps: int 145 160 120 130 130 120 140 120 130 140 ...
## $ chol : int 233 286 229 250 204 236 268 354 254 203 ...
## $ fbs : logi TRUE FALSE FALSE FALSE FALSE FALSE ...
## $ restecg : chr "lv_hypertrophy" "lv_hypertrophy" "lv_hypertrophy" "normal" ...
## $ thalch : int 150 108 129 187 172 178 160 163 147 155 ...
## $ exang : logi FALSE TRUE TRUE FALSE FALSE FALSE ...
## $ oldpeak : num 2.3 1.5 2.6 3.5 1.4 0.8 3.6 0.6 1.4 3.1 ...
## $ slope : chr "downsloping" "flat" "flat" "downsloping" ...
## $ ca : int 0 3 2 0 0 0 2 0 1 0 ...
## $ thal : chr "fixed_defect" "normal" "reversable_defect" "normal" ...
## $ num : int 0 2 1 0 0 0 3 0 2 1 ...
## - attr(*, "na.action")= 'omit' Named int [1:621] 88 167 193 267 288 303 304 305 306 307 ...
## ..- attr(*, "names")= chr [1:621] "88" "167" "193" "267" ...
## id age sex dataset
## Min. : 1.0 Min. :29.00 Length:299 Length:299
## 1st Qu.: 75.5 1st Qu.:48.00 Class :character Class :character
## Median :151.0 Median :56.00 Mode :character Mode :character
## Mean :153.9 Mean :54.52
## 3rd Qu.:227.5 3rd Qu.:61.00
## Max. :749.0 Max. :77.00
## cp trestbps chol fbs
## Length:299 Min. : 94.0 Min. :100.0 Mode :logical
## Class :character 1st Qu.:120.0 1st Qu.:211.0 FALSE:256
## Mode :character Median :130.0 Median :242.0 TRUE :43
## Mean :131.7 Mean :246.8
## 3rd Qu.:140.0 3rd Qu.:275.5
## Max. :200.0 Max. :564.0
## restecg thalch exang oldpeak
## Length:299 Min. : 71.0 Mode :logical Min. :0.000
## Class :character 1st Qu.:132.5 FALSE:200 1st Qu.:0.000
## Mode :character Median :152.0 TRUE :99 Median :0.800
## Mean :149.3 Mean :1.059
## 3rd Qu.:165.5 3rd Qu.:1.600
## Max. :202.0 Max. :6.200
## slope ca thal num
## Length:299 Min. :0.0000 Length:299 Min. :0.0000
## Class :character 1st Qu.:0.0000 Class :character 1st Qu.:0.0000
## Mode :character Median :0.0000 Mode :character Median :0.0000
## Mean :0.6722 Mean :0.9465
## 3rd Qu.:1.0000 3rd Qu.:2.0000
## Max. :3.0000 Max. :4.0000
## id age sex dataset cp trestbps chol fbs restecg thalch
## 1 1 63 M CLE typical_angina 145 233 TRUE lv_hypertrophy 150
## 2 2 67 M CLE asymptomatic 160 286 FALSE lv_hypertrophy 108
## 3 3 67 M CLE asymptomatic 120 229 FALSE lv_hypertrophy 129
## 4 4 37 M CLE non_anginal 130 250 FALSE normal 187
## 5 5 41 F CLE atypical_angina 130 204 FALSE lv_hypertrophy 172
## 6 6 56 M CLE atypical_angina 120 236 FALSE normal 178
## exang oldpeak slope ca thal num
## 1 FALSE 2.3 downsloping 0 fixed_defect 0
## 2 TRUE 1.5 flat 3 normal 2
## 3 TRUE 2.6 flat 2 reversable_defect 1
## 4 FALSE 3.5 downsloping 0 normal 0
## 5 FALSE 1.4 upsloping 0 normal 0
## 6 FALSE 0.8 upsloping 0 normal 0
Resúmenes de las variables numéricas
## # A tibble: 2 × 3
## sex trestbps count
## <chr> <dbl> <int>
## 1 M 131. 203
## 2 F 133. 96
## # A tibble: 4 × 3
## cp chol count
## <chr> <dbl> <int>
## 1 asymptomatic 250. 144
## 2 non_anginal 245. 83
## 3 atypical_angina 245. 49
## 4 typical_angina 237. 23
Tablas de frecuencia para las variables categóricas
## dataset n percent
## CLE 297 99.33%
## HU 1 0.33%
## LBC 1 0.33%
## Total 299 100.00%
## cp n percent
## asymptomatic 144 48.16%
## atypical_angina 49 16.39%
## non_anginal 83 27.76%
## typical_angina 23 7.69%
## Total 299 100.00%
Agrupaciones de sexo por Ciudad y PSR por Tipo de dolor de
pecho
## sex CLE HU LBC
## F 96 0 0
## M 201 1 1
## Total 297 1 1
## trestbps asymptomatic atypical_angina non_anginal typical_angina Total
## 94 0 0 2 0 2
## 100 3 0 1 0 4
## 101 0 1 0 0 1
## 102 1 0 1 0 2
## 104 1 0 0 0 1
## 105 0 2 1 0 3
## 106 1 0 0 0 1
## 108 2 1 3 0 6
## 110 12 2 3 2 19
## 112 5 1 3 0 9
## 114 1 0 0 0 1
## 115 2 0 1 0 3
## 117 1 0 0 0 1
## 118 1 1 3 2 7
## 120 14 11 11 2 38
## 122 2 1 1 0 4
## 123 1 0 0 0 1
## 124 4 1 1 0 6
## 125 6 0 3 1 10
## 126 1 1 1 0 3
## 128 6 3 1 0 10
## 129 0 0 1 0 1
## 130 14 9 13 0 36
## 132 4 2 1 0 7
## 134 1 2 0 2 5
## 135 2 2 2 0 6
## 136 1 1 1 0 3
## 138 7 0 2 1 10
## 140 16 3 11 2 32
## 142 2 0 1 0 3
## 144 2 0 0 0 2
## 145 4 0 0 1 5
## 146 1 0 1 0 2
## 148 1 0 0 1 2
## 150 9 0 6 3 18
## 152 2 0 2 1 5
## 154 0 1 0 0 1
## 155 0 0 1 0 1
## 156 0 1 0 0 1
## 158 1 0 0 0 1
## 160 4 2 3 2 11
## 164 1 0 0 0 1
## 165 1 0 0 0 1
## 170 2 0 0 2 4
## 172 0 0 1 0 1
## 174 1 0 0 0 1
## 178 1 0 0 1 2
## 180 2 0 1 0 3
## 192 0 1 0 0 1
## 200 1 0 0 0 1
Gráficos descriptivos
Histograma de Presión sanguínea en reposo

Gráfico de barras con el colesterol total por sexo

Boxplot para analizar la dispersión de la PSR por edad

Gráfico de Tipo de dolor de pecho

Gráfico de Presión sanguínea e reposo vs Colesterol total

Interpretaciones exploratorias
Como se observa e el histograma de PSR, la distribución es normal;
con un ligero sezgo a ka derecha. También hay un sesgo en los datos e
cuanto al sexo, se tomaron más datos para hombres (más del doble). Se
cuenta con más datos para edades entre 55 y 70 años. Hay una muestra
equilibrada entre los pasientes asintomáticos y los que padecen algún
tipo de dolor. No parece haber una relación entre Colesterol total y
PSR.