| utput: |
| html_document: |
| toc: true |
| toc_float: true |
| toc_depth: 3 |
| number_sections: true |
| theme: cosmo |
| highlight: tango |
| code_folding: show |
| df_print: paged |
| css: styles.css |
| pdf_document: |
| toc: true |
| number_sections: true |
| highlight: tango |
| word_document: |
| toc: true |
| number_sections: true |
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐
๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ๐ฏ
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐
library(readxl)
DATOS2026 <- read_excel("00. DATOS202460ULTIMOS25 (1).xlsx")
DATOS2026
## # A tibble: 74 ร 16
## CURSO ASISTENCIA2 ASISTENCIA1 `PARCIAL 1` `PARCIAL 2` NRC PROGRAMA EDAD
## <chr> <dbl> <dbl> <chr> <chr> <dbl> <chr> <dbl>
## 1 PROBABIโฆ 100 90 3.6 4.3 2314 F_NEGOCโฆ 20
## 2 ESTADISโฆ 70 75 0.9 2.5 1136 DERECHO 18
## 3 PROBABIโฆ 85 95 3.9 3.8 2314 F_NEGOCโฆ 19
## 4 PROBABIโฆ 5 5 2.9 0.5 2314 MECANICA 18
## 5 ESTADISโฆ 20 70 3.7 0.55 1009 PSICOLOโฆ 19
## 6 ESTADISโฆ 100 100 0.9 2.95 2313 PSICOLOโฆ 20
## 7 PROBABIโฆ 50 75 3.7 1.7 1010 C_DATOS 18
## 8 PROBABIโฆ 100 95 3 3.3 2314 F_NEGOCโฆ 19
## 9 ESTADISโฆ 100 100 3.8 3.3 1009 PSICOLOโฆ 18
## 10 PROBABIโฆ 95 85 3 2.9 2314 SISTEMAS 22
## # โน 64 more rows
## # โน 8 more variables: PESO <dbl>, ESTATURA <dbl>, SEXO <chr>,
## # ESTADO_CIVIL <chr>, ESTRATO <chr>, URBANO <chr>, TRANSPORTE <chr>,
## # GR_SANGUINEO <chr>
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐
#####<-========== PASO 4. =========->
table_sexo<-table(DATOS2026$SEXO)
table_sexo
##
## Femenino Masculino
## 42 32
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐
#####<-========== PASO 5.=========->
pie_1<-pie(table_sexo, col=c("lightblue","pink"),
main="Estudio de Pastel. Stephanie Banquez \n Distribuciรณn por sexos.", labels = table_sexo)
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐
#####<-========== PASO 6. =========->
barp<-barplot(table_sexo, col = rainbow(5), border = "darkred",main = "Grรกfico de Barras STEPHANIE BANQUEZ ",sub = "UTB",xlab = "SEXO", ylab = "Conteo")
text(barp, table_sexo-30, labels = table_sexo)
#####<-========== PASO 7. =========->
table_sexo2<-round(table(DATOS2026$SEXO)/74*100)
table_sexo2
##
## Femenino Masculino
## 57 43
#####<-========== PASO 8. =========->
barp2<-barplot(table_sexo2, col = rainbow(5), border = "darkred",main = "Grรกfico de Barras STEPHANIE BANQUEZ ",sub = "UTB",xlab = "SEXO", ylab = "Porcentaje")
text(barp2, table_sexo2-30, labels = table_sexo2)
###<-========== PASO 9. =========-> ### (7i)Las tablas de frecuencias y las representaciones grรกficas son dos maneras equivalentes de presentar la informaciรณn. Las dos exponen ordenadamente la informaciรณn recogida en una muestra
pie_1<-pie(table_sexo2, col=c("lightblue","pink"),
main="Estudio de Pastel.\n Distribuciรณn por sexos.", labels = table_sexo2)
#####<-========== PASO 10. =========->
### [**(8i)**]{style="color:red"}[**Usando la aplicaciรณn para hacer la tabla con dos varibles SEXO y CURSO**]{style="color:blue"}
table_3<-table(DATOS2026$SEXO, DATOS2026$CURSO)
table_3
##
## ESTADISTICAI PROBABILIDAD
## Femenino 16 26
## Masculino 10 22
#####<-========== PASO 11. =========->
barp3<-barplot(table_3,
main = "Grรกfico de barras CURSO vs SEXO",
xlab = "CURSO", ylab = "Frecuencia",
col = c("pink", "blue"),
legend.text = rownames(table_3),
beside = TRUE) # Barras agrupadas
text(barp3, table_3-5, labels = table_3)
#####<-========== PASO 12. =========->
table_4<-round(table(DATOS2026$SEXO, DATOS2026$CURSO)/74*100)
table_4
##
## ESTADISTICAI PROBABILIDAD
## Femenino 22 35
## Masculino 14 30
#####<-========== PASO 13. =========->
barp4<-barplot(table_4,
main = "Grรกfico de barras CURSO vs SEXO en porcentajes",
xlab = "CURSO", ylab = "Frecuencia",
col = c("pink", "blue"),
legend.text = rownames(table_4),
beside = TRUE) # Barras agrupadas
text(barp4, table_4-5, labels = table_4)
#####<-========== PASO 14. =========->
table_5<-table(DATOS2026$ESTRATO, DATOS2026$CURSO)
table_5
##
## ESTADISTICAI PROBABILIDAD
## I 5 10
## II 7 18
## III 9 9
## IV 5 5
## V 0 5
#####<-========== PASO 15. =========->
barp3<-barplot(table_5,
main = "Grรกfico de barras CURSO vs ESTRATO",
xlab = "CURSO", ylab = "Frecuencia",
col = rainbow(5),
legend.text = rownames(table_5),
beside = TRUE) # Barras agrupadas
text(barp3, table_5-1, labels = table_3)
#####<-========== PASO 16. =========->
table_6<-table(DATOS2026$ESTRATO, DATOS2026$SEXO)
table_6
##
## Femenino Masculino
## I 8 7
## II 17 8
## III 10 8
## IV 4 6
## V 3 2
#####<-========== PASO 17. =========->
barp3<-barplot(table_6,
main = "Grรกfico de barras CURSO vs ESTRATO",
xlab = "CURSO", ylab = "Frecuencia",
col = rainbow(5),
legend.text = rownames(table_6),
beside = TRUE) # Barras agrupadas
text(barp3, table_6-1, labels = table_6)
##### <-========== PASO 18. ==========->
if (!requireNamespace("summarytools", quietly = TRUE)) {
install.packages("summarytools", repos = "https://cloud.r-project.org")
}
## Warning in fun(libname, pkgname): couldn't connect to display ":0"
library(summarytools)
## system might not have X11 capabilities; in case of errors when using dfSummary(), set st_options(use.x11 = FALSE)
tabla_8 <- freq(DATOS2026$EDAD)
tabla_8
## Frequencies
## DATOS2026$EDAD
## Type: Numeric
##
## Freq % Valid % Valid Cum. % Total % Total Cum.
## ----------- ------ --------- -------------- --------- --------------
## 17 7 9.46 9.46 9.46 9.46
## 18 32 43.24 52.70 43.24 52.70
## 19 21 28.38 81.08 28.38 81.08
## 20 7 9.46 90.54 9.46 90.54
## 21 4 5.41 95.95 5.41 95.95
## 22 3 4.05 100.00 4.05 100.00
## <NA> 0 0.00 100.00
## Total 74 100.00 100.00 100.00 100.00
#####<-========== PASO 19. =========->
library(summarytools)
summary(DATOS2026$EDAD)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 17.0 18.0 18.0 18.7 19.0 22.0
#####<-========== PASO 20. =========->
boxplot(DATOS2026$EDAD, horizontal = TRUE, col = rainbow(3))
#####<-========== PASO 21. =========->
x = DATOS2026$EDAD
boxplot(x, notch = FALSE, horizontal = FALSE, col = rainbow(3))
#####<-========== PASO 22. =========->
x = DATOS2026$EDAD
y = DATOS2026$SEXO
boxplot(x~y, horizontal = TRUE, col = rainbow(3))
#####<-========== PASO 23. =========->
library(summarytools)
x = DATOS2026$EDAD
z = DATOS2026$ESTRATO
boxplot(x~z, horizontal = TRUE, col = rainbow(3))
####<-========== PASO 24. =========->
if (!requireNamespace("ggplot2", quietly = TRUE)) {
install.packages("ggplot2", repos = "https://cloud.r-project.org")
}
library(ggplot2)
ggplot(data = DATOS2026, aes(y = EDAD, x = ESTRATO, fill = SEXO)) +
geom_boxplot() +
scale_y_continuous(name = "EDAD") +
scale_x_discrete(labels = abbreviate, name = "ESTRATO")
####<-========== PASO 25. =========->
summary(DATOS2026$ESTATURA)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 153.0 163.0 168.0 168.4 174.0 192.0
####<-========== PASO 26. =========->
boxplot(DATOS2026$ESTATURA, horizontal = TRUE, col = rainbow(3))
####<-========== PASO 27. =========->
x = DATOS2026$ESTATURA
boxplot(x, notch = TRUE, horizontal = TRUE, col = rainbow(3))
####<-========== PASO 28. =========->
x = DATOS2026$ESTATURA
y = DATOS2026$SEXO
boxplot(x~y, horizontal = TRUE, col = rainbow(3))
####<-========== PASO 29. =========->
library(ggplot2)
x = DATOS2026$ESTATURA
z = DATOS2026$ESTRATO
boxplot(x~z, horizontal = TRUE, col = rainbow(3))
####<-========== PASO 30. =========->
library(ggplot2)
ggplot(data= DATOS2026,mapping= aes(y=ESTATURA,x = ESTRATO, fill=SEXO))+geom_boxplot()+
scale_y_continuous(name = "ESTATURA") +
scale_x_discrete(labels = abbreviate, name = "ESTRATO")
##### <-========== PASO 31. ==========->
# Instalar la librerรญa
install.packages("agricolae", repos = "https://cloud.r-project.org")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.6'
## (as 'lib' is unspecified)
# Cargar la librerรญa
library(agricolae)
# Crear el histograma
h2 <- graph.freq(DATOS2026$EDAD, col = colors()[75])
# Mostrar el resultado
h2
## $breaks
## [1] 17.0 17.7 18.4 19.1 19.8 20.5 21.2 21.9 22.6
##
## $counts
## [1] 7 32 21 0 7 4 0 3
##
## $mids
## [1] 17.35 18.05 18.75 19.45 20.15 20.85 21.55 22.25
##
## $relative
## [1] 0.0946 0.4324 0.2838 0.0000 0.0946 0.0541 0.0000 0.0405
##
## $density
## [1] 0.13514286 0.61771429 0.40542857 0.00000000 0.13514286 0.07728571 0.00000000
## [8] 0.05785714
##
## attr(,"class")
## [1] "graph.freq" "histogram"
####<-========== PASO 32. =========->
summary(h2)
## Lower Upper Main Frequency Percentage CF CPF
## 1 17.0 17.7 17.35 7 9.5 7 9.5
## 2 17.7 18.4 18.05 32 43.2 39 52.7
## 3 18.4 19.1 18.75 21 28.4 60 81.1
## 4 19.1 19.8 19.45 0 0.0 60 81.1
## 5 19.8 20.5 20.15 7 9.5 67 90.5
## 6 20.5 21.2 20.85 4 5.4 71 95.9
## 7 21.2 21.9 21.55 0 0.0 71 95.9
## 8 21.9 22.6 22.25 3 4.1 74 100.0
####<-========== PASO 33. =========->
plot(h2, col=colors()[70], frequency = 1)
polygon.freq(h2, col = "red", frequency = 1, lwd = 2)
####<-========== PASO 34. =========->
plot(h2, col=colors()[70], frequency = 2)
polygon.freq(h2, col = "red", frequency = 2, lwd = 2)
####<-========== PASO 35. =========->
fr_por_clase2<-h2$counts
fr_por_clase2
## [1] 7 32 21 0 7 4 0 3
total_n2<-sum(h2$counts)
total_n2
## [1] 74
fr_relativos2<-fr_por_clase2/total_n2
fr_porcentuales2<-100*fr_relativos2
fr_porcentuales2
## [1] 9.459459 43.243243 28.378378 0.000000 9.459459 5.405405 0.000000
## [8] 4.054054
cumsum(fr_por_clase2)
## [1] 7 39 60 60 67 71 71 74
cumsum(fr_relativos2)
## [1] 0.09459459 0.52702703 0.81081081 0.81081081 0.90540541 0.95945946 0.95945946
## [8] 1.00000000
cumsum(fr_porcentuales2)
## [1] 9.459459 52.702703 81.081081 81.081081 90.540541 95.945946 95.945946
## [8] 100.000000
####<-========== PASO 36. =========->
p4<-cumsum(fr_porcentuales2)
plot(p4, col = "red")
lines(p4, col = "red")
๐๐งช๐๐ปโจ๐ง ๐๐ฌโ๏ธ๐๐ป๐๐งช๐๐ปโจ๐ง ๐๐๐งช๐๐ปโจ๐ง ๐๐ฌโ๏ธ๐๐ป๐๐งช๐๐ปโจ๐ง ๐
####<-========== AQUI FINALIZA EL LABORATORIO 7. =========-> ๐๐งช๐๐ปโจ๐ง ๐๐ฌโ๏ธ๐๐ป๐๐งช๐๐ปโจ๐ง ๐๐๐งช๐๐ปโจ๐ง ๐๐ฌโ๏ธ๐๐ป๐๐งช๐๐ปโจ๐ง ๐