Carga de Datos

# Cargar los datos desde el archivo CSV
data <- read_csv("anemia.csv")
## Rows: 1421 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (6): Gender, Hemoglobin, MCH, MCHC, MCV, Result
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Mostrar las primeras filas del conjunto de datos
head(data)
## # A tibble: 6 × 6
##   Gender Hemoglobin   MCH  MCHC   MCV Result
##    <dbl>      <dbl> <dbl> <dbl> <dbl>  <dbl>
## 1      1       14.9  22.7  29.1  83.7      0
## 2      0       15.9  25.4  28.3  72        0
## 3      0        9    21.5  29.6  71.2      1
## 4      0       14.9  16    31.4  87.5      0
## 5      1       14.7  22    28.2  99.5      0
## 6      0       11.6  22.3  30.9  74.5      1

Análisis Exploratorio

Resumen Estadístico

# Resumen de las variables numéricas
summary(data)
##      Gender         Hemoglobin         MCH             MCHC      
##  Min.   :0.0000   Min.   : 6.60   Min.   :16.00   Min.   :27.80  
##  1st Qu.:0.0000   1st Qu.:11.70   1st Qu.:19.40   1st Qu.:29.00  
##  Median :1.0000   Median :13.20   Median :22.70   Median :30.40  
##  Mean   :0.5208   Mean   :13.41   Mean   :22.91   Mean   :30.25  
##  3rd Qu.:1.0000   3rd Qu.:15.00   3rd Qu.:26.20   3rd Qu.:31.40  
##  Max.   :1.0000   Max.   :16.90   Max.   :30.00   Max.   :32.50  
##       MCV             Result      
##  Min.   : 69.40   Min.   :0.0000  
##  1st Qu.: 77.30   1st Qu.:0.0000  
##  Median : 85.30   Median :0.0000  
##  Mean   : 85.52   Mean   :0.4363  
##  3rd Qu.: 94.20   3rd Qu.:1.0000  
##  Max.   :101.60   Max.   :1.0000

Distribución de la Hemoglobina

ggplot(data, aes(x = Hemoglobin)) +
  geom_histogram(binwidth = 1, fill = "blue", color = "black", alpha = 0.7) +
  theme_minimal() +
  labs(title = "Distribución de Hemoglobina", x = "Nivel de Hemoglobina", y = "Frecuencia")

Comparación por Género

ggplot(data, aes(x = factor(Gender), y = Hemoglobin, fill = factor(Gender))) +
  geom_boxplot() +
  theme_minimal() +
  labs(title = "Comparación de Hemoglobina por Género", x = "Género", y = "Hemoglobina") +
  scale_fill_discrete(name = "Género", labels = c("Femenino", "Masculino"))

Relación entre MCV y Hemoglobina

ggplot(data, aes(x = MCV, y = Hemoglobin, color = factor(Result))) +
  geom_point(alpha = 0.7) +
  theme_minimal() +
  labs(title = "Relación entre MCV y Hemoglobina", x = "Volumen Corpuscular Medio (MCV)", y = "Hemoglobina") +
  scale_color_discrete(name = "Resultado", labels = c("No Anemia", "Anemia"))

Conclusiones