Este análisis tiene como objetivo evaluar conocimientos previos en estadística aplicada y programación en R. Se trabajará con datos de la prueba Saber 11 para un período específico.
library(dplyr)
##
## 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
library(ggplot2)
library(knitr)
library(readr)
library(saber)
data("SB11_20061")
datos <- as_tibble(SB11_20061)
ncol(datos)
## [1] 86
sum(sapply(datos, is.character))
## [1] 42
sum(sapply(datos, is.numeric))
## [1] 44
nrow(datos)
## [1] 61069
Podemos también responder algunas preguntas muy fáciles sobre la prueba Saber 11.
datos %>% filter(FISICA_PUNT == max(FISICA_PUNT, na.rm = TRUE)) %>% pull(ESTU_RESIDE_DEPT_PRESENTACION)
## [1] "BOGOTÁ" "VALLE"
datos %>% filter(FISICA_PUNT == min(FISICA_PUNT, na.rm = TRUE)) %>% pull(ESTU_RESIDE_MPIO_PRESENTACION)
## [1] "CALI" "PASTO" "PASTO" "FLORIDA" "TRUJILLO" "IPIALES"
## [7] "CALI" "VIJES" "CALI" "CALI" "TUMACO" "YOPAL"
## [13] "TORO" "CALI"
datos %>% filter(FILOSOFIA_PUNT == max(FILOSOFIA_PUNT, na.rm = TRUE)) %>% pull(ESTU_RESIDE_DEPT_PRESENTACION)
## [1] "BOGOTÁ"
Para comenzar podemos calcular algunos descriptivos univariados.
mean(datos$MATEMATICAS_PUNT, na.rm = TRUE)
## [1] 50.76749
sd(datos$MATEMATICAS_PUNT, na.rm = TRUE)
## [1] 9.638313
porcentaje_computador <- mean(datos$ECON_SN_COMPUTADOR %in% c("1", "3", "4"), na.rm = TRUE) * 100
porcentaje_computador
## [1] 2.56595
porcentaje_trabajo <- mean(datos$ESTU_TRABAJA %in% c("1", "2", "3", "4", "5", "6", "7"), na.rm = TRUE) * 100
porcentaje_trabajo
## [1] 1.313269
mean(datos$COLE_NATURALEZA == "O", na.rm = TRUE) * 100
## [1] 59.12984
quantile(datos$ESTU_EDAD, probs = 0.9, na.rm = TRUE)
## 90%
## 19
Ahora vamos a incursionar en el terreno de los gráficos. Dibujemos las siguientes figuras.
ggplot(datos, aes(x = LENGUAJE_PUNT)) +
geom_histogram(fill = "steelblue", color = "black", bins = 20) +
labs(title = "Distribución del puntaje en lenguaje", x = "Puntaje", y = "Frecuencia") +
theme_minimal()
Se filtra para no tener en cuenta los NA
datos_filtrados <- datos %>% filter(!is.na(ESTU_ESTRATO))
ggplot(datos_filtrados, aes(x = as.factor(ESTU_ESTRATO))) +
geom_bar(fill = "darkred", color = "black") +
labs(title = "Distribución de Estratos", x = "Estrato", y = "Frecuencia") +
theme_minimal()
ggplot(datos, aes(y = ESTU_EDAD)) +
geom_boxplot(fill = "orange", color = "black") +
labs(title = "Distribución de la edad", y = "Edad") +
theme_minimal()
```