Base_Estadistica_Descriptiva_2_ <- read_excel("C:/Users/maria/Downloads/Base_Estadistica_Descriptiva (2).xlsx")
set.seed(83)
datos_b <- sample_n(Base_Estadistica_Descriptiva_2_, size = 160, replace = FALSE)
is.data.frame(datos_b)
## [1] TRUE
Pregunta 1
Determine el porcentaje de hombres que tienen estudios universitarios
y muestre cuál es la cantidad total de mujeres participantes.
tabla_genero <- table(datos_b$Genero, datos_b$NivelEducativo)
tabla_genero <- addmargins(tabla_genero)
tabla_genero
##
## Primaria Secundaria Técnico Universitario Sum
## Femenino 10 17 13 10 50
## Masculino 13 18 12 15 58
## Otro 12 17 9 14 52
## Sum 35 52 34 39 160
En la muestra participaron 52 mujeres, mientras que el porcentaje de
hombres con estudios universitarios corresponde al 6,25%.(se uso la
calculadora)
#### Pregunta 2
boxplot(datos_b$Estatura ~ datos_b$Genero, horizontal = TRUE,
xlab= "Estatura" , ylab= "Género",
main="Funcion de genero", col=c("pink",
"blue", "red") )
#### Pregumta 3a
tabla_hermanos <- table (datos_b$Hermanos)
tabla_hermanos
##
## 0 1 2 3 4 5 6
## 31 27 15 24 23 21 19
is.data.frame(tabla_hermanos)
## [1] FALSE
df_hermanos <- as.data.frame(tabla_hermanos)
is.data.frame(df_hermanos)
## [1] TRUE
df_hermanos
## Var1 Freq
## 1 0 31
## 2 1 27
## 3 2 15
## 4 3 24
## 5 4 23
## 6 5 21
## 7 6 19
df_hermanos <- rename(df_hermanos, Hermanos = Var1, Frecuencia= Freq)
kable(df_hermanos)
0 |
31 |
1 |
27 |
2 |
15 |
3 |
24 |
4 |
23 |
5 |
21 |
6 |
19 |
diag_barras <- ggplot(df_hermanos, aes(x = Hermanos , y=Frecuencia, fill = Hermanos)) +
geom_bar(stat = "identity", color = "blue") +
scale_fill_manual(values = c("green", "red", "pink", "skyblue", "yellow","purple", "grey" ))+
geom_text(aes(label = Hermanos), vjust = -1, colour = "orange") +
ylim(c(0,50))
diag_barras
6 hermanos
pregunta 3b
tabla_nivel_educativo <- table (datos_b$NivelEducativo)
tabla_nivel_educativo
##
## Primaria Secundaria Técnico Universitario
## 35 52 34 39
is.data.frame(tabla_nivel_educativo)
## [1] FALSE
df_nivel_educativo <- as.data.frame(tabla_nivel_educativo)
is.data.frame(df_nivel_educativo)
## [1] TRUE
df_nivel_educativo
## Var1 Freq
## 1 Primaria 35
## 2 Secundaria 52
## 3 Técnico 34
## 4 Universitario 39
df_nivel_educativo <- rename(df_nivel_educativo, Nivel_Educativo = Var1, Frecuencia= Freq)
kable(df_nivel_educativo)
Primaria |
35 |
Secundaria |
52 |
Técnico |
34 |
Universitario |
39 |
pie3D(tabla_nivel_educativo, radius = 1.1, theta = pi/4, explode=0.2, labels = c("Primaria", "Secundaria", "Técnico", "Universitario"),col= c("orange", "red", "yellow", "green"),
border = "blue", main= "Grafica torta 3D", )

Pregunta 3c
tabla_horast <- fdt(x =datos_b$HorasDeTrabajo,k =10)
kable(tabla_horast)
[7.326,13.744) |
1 |
0.00625 |
0.625 |
1 |
0.625 |
[13.744,20.162) |
3 |
0.01875 |
1.875 |
4 |
2.500 |
[20.162,26.581) |
10 |
0.06250 |
6.250 |
14 |
8.750 |
[26.581,32.999) |
25 |
0.15625 |
15.625 |
39 |
24.375 |
[32.999,39.417) |
32 |
0.20000 |
20.000 |
71 |
44.375 |
[39.417,45.835) |
44 |
0.27500 |
27.500 |
115 |
71.875 |
[45.835,52.253) |
27 |
0.16875 |
16.875 |
142 |
88.750 |
[52.253,58.672) |
10 |
0.06250 |
6.250 |
152 |
95.000 |
[58.672,65.09) |
5 |
0.03125 |
3.125 |
157 |
98.125 |
[65.09,71.508) |
3 |
0.01875 |
1.875 |
160 |
100.000 |
|
start |
7.3260 |
end |
71.5080 |
h |
6.4182 |
right |
0.0000 |
|
plot(tabla_horast, col=c("red","orange","yellow","green", "blue",
"purple","pink", "gray",
"hotpink", "royalblue4"),
type = "fh", main = "Histograma horas t")

plot(tabla_horast, col=c("red","orange","yellow","green", "blue",
"purple","pink", "gray",
"hotpink", "royalblue4"),
type = "fp", main = "poligono de frecuencias horas t")
#### Pregunta 3d
media_i <- mean(datos_b$IngresoMensual)
mediana_i <- median(datos_b$IngresoMensual)
moda_i <- mlv1(datos_b$IngresoMensual)
df_tc <- data.frame (media_i, mediana_i, moda_i)
kable(df_tc, caption = "Medidas tendencia central")
Medidas tendencia central
2019.806 |
2055.715 |
1836.513 |
rango_i <- max(datos_b$IngresoMensual) -min(datos_b$IngresoMensual)
varianza_i <- var(datos_b$IngresoMensual)
ds_i <- sqrt(var(datos_b$IngresoMensual))
CV_i <- (sd(datos_b$IngresoMensual) / mean(datos_b$IngresoMensual))*100
df_v <- data.frame (rango_i, varianza_i, ds_i, CV_i)
kable(df_v, caption = "Medidas Variabilidad")
Medidas Variabilidad
4441.96 |
633594.7 |
795.9866 |
39.40906 |
percentil_i <- quantile(datos_b$IngresoMensual,
probs = c(0.25, 0.75), type= 6)
percentil_i
## 25% 75%
## 1478.530 2549.993
asim_i <- ds_skewness(datos_b$IngresoMensual)
curt_i <- ds_kurtosis(datos_b$IngresoMensual)
df_f <- data.frame (asim_i, curt_i)
kable(df_f, caption = "Medidas Forma")
Medidas Forma
-0.2669729 |
0.3473592 |
resumen_i <- ds_tidy_stats(datos_b, IngresoMensual)
kable(resumen_i)
IngresoMensual |
-509.91 |
3932.05 |
2019.806 |
2038.484 |
2055.715 |
-509.91 |
4441.96 |
633594.7 |
795.9866 |
-0.2669729 |
0.3473592 |
39.40906 |
1484.93 |
2537.718 |
1052.787 |