D4 Tecnologia
|
N.°
|
Variable
|
Estadísticas / Valores
|
Gráfico
|
|
16
|
En el colegio se usan videos/plataformas/tecnología para enseñar temas
ambientales.
|
- Nunca 6 (30,00%)
2. Casi nunca 5 (25,00%) 3. Aveces 5
(25,00%) 4. Casi siempre 3 (15,00%) 5. Siempre 1 (5,00%)
|
|
|
17
|
En mi casa utilizo internet o dispositivos digitales para aprender sobre
el ambiente.
|
- Nunca 4 (20,00%)
2. Casi nunca 4 (20,00%) 3. Aveces 10
(50,00%) 4. Casi siempre 0 (0,00%) 5. Siempre 2 (10,00%)
|
|
|
18
|
Con mis amigos usamos redes o apps para informarnos sobre temas
ambientales.
|
- Nunca 4 (20,00%)
2. Casi nunca 8 (40,00%) 3. Aveces 6
(30,00%) 4. Casi siempre 1 (5,00%) 5. Siempre 1 (5,00%)
|
|
|
19
|
Uso redes sociales o IA para aprender sobre el cuidado del medio
ambiente.
|
- Nunca 5 (25,00%)
2. Casi nunca 4 (20,00%) 3. Aveces 5
(25,00%) 4. Casi siempre 2 (10,00%) 5. Siempre 4 (20,00%)
|
|
|
20
|
Considero que la tecnología ayuda a aprender mejor sobre el cuidado
ambiental.
|
- Nunca 0 (0,00%)
2. Casi nunca 2 (10,00%) 3. Aveces 6
(30,00%) 4. Casi siempre 4 (20,00%) 5. Siempre 8 (40,00%)
|
|
cluster
library(dplyr)
library(tibble)
library(cluster)
library(factoextra)
## Cargando paquete requerido: ggplot2
##
## Adjuntando el paquete: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(ggplot2)
# Asegurar que los ítems estén como numéricos
items <- paste0("P", 1:20)
datosn[items] <- lapply(datosn[items], as.numeric)
# Listado de ítems por dimensión
items_d1 <- codebook %>% filter(dimension == "D1_Aprendizaje") %>% pull(item)
items_d2 <- codebook %>% filter(dimension == "D2_Practicas") %>% pull(item)
items_d3 <- codebook %>% filter(dimension == "D3_Actitudes") %>% pull(item)
items_d4 <- codebook %>% filter(dimension == "D4_Tecnologia") %>% pull(item)
# Puntajes promedio por dimensión
datos_cluster <- datosn %>%
mutate(
D1_Aprendizaje = rowMeans(select(., all_of(items_d1)), na.rm = TRUE),
D2_Practicas = rowMeans(select(., all_of(items_d2)), na.rm = TRUE),
D3_Actitudes = rowMeans(select(., all_of(items_d3)), na.rm = TRUE),
D4_Tecnologia = rowMeans(select(., all_of(items_d4)), na.rm = TRUE)
) %>%
select(CURSO, D1_Aprendizaje, D2_Practicas, D3_Actitudes, D4_Tecnologia)
datos_cluster
## # A tibble: 46 × 5
## CURSO D1_Aprendizaje D2_Practicas D3_Actitudes D4_Tecnologia
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 A 2.8 3.6 4.2 3.6
## 2 A 3.4 4.4 4.8 3.6
## 3 A 2.8 2 1.6 1.8
## 4 A 2.4 3 2.8 1.8
## 5 A 2 3.2 3.2 2.6
## 6 A 3 2.2 3 2.2
## 7 A 2.6 2.8 2.6 3.2
## 8 A 3.4 2.8 2.4 2.8
## 9 A 2.2 3 2.4 2.2
## 10 A 3.2 3.4 4.2 2.8
## # ℹ 36 more rows
X <- datos_cluster %>%
select(D1_Aprendizaje, D2_Practicas, D3_Actitudes, D4_Tecnologia)
X_scaled <- scale(X)
set.seed(123)
modelo_pam <- pam(X_scaled, k = 3)
modelo_pam
## Medoids:
## ID D1_Aprendizaje D2_Practicas D3_Actitudes D4_Tecnologia
## [1,] 37 0.82217272 1.3759682 1.110949 0.7628126
## [2,] 43 -1.44702399 -1.1335068 -1.100267 -1.3286075
## [3,] 36 0.06577382 -0.2970152 -0.363195 -0.1667074
## Clustering vector:
## [1] 1 1 2 2 2 3 3 3 2 1 1 2 1 2 2 3 3 1 1 1 3 3 3 3 3 3 3 1 1 1 1 3 3 3 3 3 1 1
## [39] 3 3 3 3 2 2 1 3
## Objective function:
## build swap
## 1.260418 1.260418
##
## Available components:
## [1] "medoids" "id.med" "clustering" "objective" "isolation"
## [6] "clusinfo" "silinfo" "diss" "call" "data"
datos_cluster$cluster <- factor(modelo_pam$clustering)
perfil_cluster <- datos_cluster %>%
group_by(cluster) %>%
summarise(
n = n(),
Aprendizaje = mean(D1_Aprendizaje, na.rm = TRUE),
Practicas = mean(D2_Practicas, na.rm = TRUE),
Actitudes = mean(D3_Actitudes, na.rm = TRUE),
Tecnologia = mean(D4_Tecnologia, na.rm = TRUE)
)
perfil_cluster
## # A tibble: 3 × 6
## cluster n Aprendizaje Practicas Actitudes Tecnologia
## <fct> <int> <dbl> <dbl> <dbl> <dbl>
## 1 1 15 3.61 3.88 4.11 3.56
## 2 2 9 2.62 2.47 2.42 1.6
## 3 3 22 3.08 3.06 3.1 2.65
fviz_cluster(modelo_pam, data = X_scaled,
ellipse.type = "convex",
geom = "point",
repel = TRUE) +
labs(title = "Clúster de estudiantes según dimensiones ambientales")

cluster jerarquico
library(dplyr)
library(ggplot2)
library(tidyr)
##
## Adjuntando el paquete: 'tidyr'
## The following objects are masked from 'package:Matrix':
##
## expand, pack, unpack
library(factoextra)
# Selección de dimensiones
X <- datos_cluster %>%
select(D1_Aprendizaje, D2_Practicas, D3_Actitudes, D4_Tecnologia)
# Escalamiento
X_scaled <- scale(X)
# Distancias y clúster jerárquico
dist_mat <- dist(X_scaled, method = "euclidean")
hc <- hclust(dist_mat, method = "ward.D2")
# Dendrograma clásico
plot(hc, labels = FALSE, hang = -1,
main = "Dendrograma de clúster jerárquico",
xlab = "Casos",
ylab = "Distancia")
rect.hclust(hc, k = 3, border = c("red", "blue", "darkgreen"))

# Dendrograma mejorado
library(factoextra)
fviz_dend(hc,
k = 3,
cex = 0.6,
rect = TRUE,
main = "Dendrograma de clúster jerárquico")
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## ℹ The deprecated feature was likely used in the factoextra package.
## Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## ℹ The deprecated feature was likely used in the factoextra package.
## Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## ℹ The deprecated feature was likely used in the factoextra package.
## Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

# Asignación de grupos
datos_cluster$cluster_hc <- factor(cutree(hc, k = 3))
# Tabla resumen
perfil_hc <- datos_cluster %>%
group_by(cluster_hc) %>%
summarise(
n = n(),
Aprendizaje = mean(D1_Aprendizaje, na.rm = TRUE),
Practicas = mean(D2_Practicas, na.rm = TRUE),
Actitudes = mean(D3_Actitudes, na.rm = TRUE),
Tecnologia = mean(D4_Tecnologia, na.rm = TRUE)
)
print(perfil_hc)
## # A tibble: 3 × 6
## cluster_hc n Aprendizaje Practicas Actitudes Tecnologia
## <fct> <int> <dbl> <dbl> <dbl> <dbl>
## 1 1 26 3.14 3.32 3.38 2.96
## 2 2 7 3.8 4.26 4.46 3.71
## 3 3 13 2.88 2.43 2.49 1.78
# Perfil en formato largo
perfil_long <- perfil_hc %>%
pivot_longer(cols = c(Aprendizaje, Practicas, Actitudes, Tecnologia),
names_to = "Dimension",
values_to = "Media")
# Gráfico de perfil
ggplot(perfil_long, aes(x = Dimension, y = Media, group = cluster_hc, color = cluster_hc)) +
geom_line(linewidth = 1) +
geom_point(size = 3) +
labs(title = "Perfil promedio de los clústeres",
x = "Dimensión",
y = "Media",
color = "Clúster") +
theme_minimal()

# PCA para visualizar grupos
pca <- prcomp(X_scaled, center = TRUE, scale. = TRUE)
pca_df <- data.frame(
PC1 = pca$x[,1],
PC2 = pca$x[,2],
cluster = datos_cluster$cluster_hc
)
ggplot(pca_df, aes(x = PC1, y = PC2, color = cluster)) +
geom_point(size = 3) +
labs(title = "Distribución de clústeres en el espacio PCA",
x = "CP1",
y = "CP2",
color = "Clúster") +
theme_minimal()
correlacion: solo 10 preguntas con mayor correlacion
library(dplyr)
library(tidyr)
library(ggplot2)
library(scales)
##
## Adjuntando el paquete: 'scales'
## The following objects are masked from 'package:psych':
##
## alpha, rescale
items <- paste0("P", 1:20)
heat_curso <- datosn %>%
pivot_longer(
cols = all_of(items),
names_to = "Item",
values_to = "Valor"
) %>%
group_by(CURSO, Item) %>%
summarise(Promedio = mean(Valor, na.rm = TRUE), .groups = "drop") %>%
mutate(Item = factor(Item, levels = items))
ggplot(heat_curso, aes(x = Item, y = CURSO, fill = Promedio)) +
geom_tile(color = "white", linewidth = 0.4) +
geom_text(aes(label = round(Promedio, 2)), size = 3.5) +
scale_fill_gradient2(
low = "#d73027",
mid = "#fee08b",
high = "#1a9850",
midpoint = 3,
limits = c(1, 5),
name = "Promedio"
) +
labs(
title = "Heatmap de promedios por curso e ítem",
x = "Ítems",
y = "Curso"
) +
theme_minimal(base_size = 12) +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
panel.grid = element_blank(),
plot.title = element_text(face = "bold"))

heat_est <- datosn %>%
pivot_longer(
cols = all_of(items),
names_to = "Item",
values_to = "Valor"
) %>%
mutate(
Item = factor(Item, levels = items),
ESTUDIANTES = factor(ESTUDIANTES, levels = rev(unique(ESTUDIANTES)))
)
ggplot(heat_est, aes(x = Item, y = ESTUDIANTES, fill = Valor)) +
geom_tile(color = "white", linewidth = 0.15) +
scale_fill_gradient2(
low = "#d73027",
mid = "#fee08b",
high = "#1a9850",
midpoint = 3,
limits = c(1, 5),
name = "Valor"
) +
facet_grid(CURSO ~ ., scales = "free_y", space = "free_y") +
labs(
title = "Heatmap por estudiante e ítem",
x = "Ítems",
y = "Estudiantes"
) +
theme_minimal(base_size = 11) +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
panel.grid = element_blank(),
plot.title = element_text(face = "bold")
)

correlacion de spearma
library(dplyr)
library(tidyr)
library(ggplot2)
# Definir ítems
items <- paste0("P", 1:20)
# Seleccionar solo los ítems
matriz_items <- datosn %>%
select(all_of(items))
# Calcular matriz de correlación entre ítems
cor_items <- cor(
matriz_items,
use = "pairwise.complete.obs",
method = "spearman"
)
# Convertir a formato largo para ggplot
cor_larga <- as.data.frame(as.table(cor_items)) %>%
rename(Item1 = Var1, Item2 = Var2, Correlacion = Freq)
# Heatmap
ggplot(cor_larga, aes(x = Item1, y = Item2, fill = Correlacion)) +
geom_tile(color = "white", linewidth = 0.3) +
geom_text(aes(label = round(Correlacion, 2)), size = 3) +
scale_fill_gradient2(
low = "#b2182b",
mid = "white",
high = "#2166ac",
midpoint = 0,
limits = c(-1, 1),
name = "r Spearman"
) +
labs(
title = "Heatmap de correlación entre ítems",
x = "Ítems",
y = "Ítems"
) +
theme_minimal(base_size = 12) +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
panel.grid = element_blank(),
plot.title = element_text(face = "bold")
)

library(dplyr)
library(psych)
library(GPArotation)
##
## Adjuntando el paquete: 'GPArotation'
## The following objects are masked from 'package:psych':
##
## equamax, varimin
# =========================
# 1. Seleccionar ítems
# =========================
items <- paste0("P", 1:20)
base_afe <- datosn %>%
select(all_of(items))
# Verificar estructura
str(base_afe)
## tibble [46 × 20] (S3: tbl_df/tbl/data.frame)
## $ P1 : num [1:46] 3 5 2 3 2 2 3 4 1 3 ...
## $ P2 : num [1:46] 1 4 1 2 2 5 2 3 1 4 ...
## $ P3 : num [1:46] 2 3 3 2 1 2 1 3 2 2 ...
## $ P4 : num [1:46] 3 3 3 2 3 3 3 3 4 4 ...
## $ P5 : num [1:46] 5 2 5 3 2 3 4 4 3 3 ...
## $ P6 : num [1:46] 4 4 3 2 2 1 3 3 1 3 ...
## $ P7 : num [1:46] 5 4 2 5 5 5 3 3 5 4 ...
## $ P8 : num [1:46] 5 4 2 3 3 2 4 2 5 5 ...
## $ P9 : num [1:46] 1 5 2 2 2 1 1 3 1 3 ...
## $ P10: num [1:46] 3 5 1 3 4 2 3 3 3 2 ...
## $ P11: num [1:46] 4 5 1 2 4 2 2 3 3 5 ...
## $ P12: num [1:46] 3 5 2 2 3 5 3 3 2 4 ...
## $ P13: num [1:46] 4 5 1 3 3 1 2 2 1 4 ...
## $ P14: num [1:46] 5 5 1 2 2 2 2 2 3 4 ...
## $ P15: num [1:46] 5 4 3 5 4 5 4 2 3 4 ...
## $ P16: num [1:46] 3 4 2 1 3 2 3 2 3 2 ...
## $ P17: num [1:46] 4 4 1 2 3 2 2 2 2 3 ...
## $ P18: num [1:46] 2 3 1 1 1 2 3 3 1 3 ...
## $ P19: num [1:46] 4 4 2 2 3 3 3 3 1 3 ...
## $ P20: num [1:46] 5 3 3 3 3 2 5 4 4 3 ...
summary(base_afe)
## P1 P2 P3 P4 P5
## Min. :1.000 Min. :1.000 Min. :1.0 Min. :1.000 Min. :2.000
## 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.0 1st Qu.:3.000 1st Qu.:3.000
## Median :3.000 Median :3.000 Median :3.0 Median :3.000 Median :4.000
## Mean :3.196 Mean :3.087 Mean :2.5 Mean :3.283 Mean :3.761
## 3rd Qu.:4.000 3rd Qu.:4.000 3rd Qu.:3.0 3rd Qu.:4.000 3rd Qu.:5.000
## Max. :5.000 Max. :5.000 Max. :5.0 Max. :5.000 Max. :5.000
## P6 P7 P8 P9
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:3.000 1st Qu.:4.000 1st Qu.:2.000 1st Qu.:1.000
## Median :3.000 Median :4.000 Median :3.000 Median :2.000
## Mean :3.326 Mean :4.065 Mean :3.391 Mean :2.217
## 3rd Qu.:4.000 3rd Qu.:5.000 3rd Qu.:5.000 3rd Qu.:3.000
## Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
## P10 P11 P12 P13 P14
## Min. :1.000 Min. :1.00 Min. :2.000 Min. :1.000 Min. :1.00
## 1st Qu.:3.000 1st Qu.:3.00 1st Qu.:2.250 1st Qu.:2.000 1st Qu.:2.00
## Median :3.000 Median :3.50 Median :3.000 Median :2.000 Median :3.00
## Mean :3.065 Mean :3.37 Mean :3.435 Mean :2.522 Mean :3.13
## 3rd Qu.:3.000 3rd Qu.:4.00 3rd Qu.:4.000 3rd Qu.:3.000 3rd Qu.:4.00
## Max. :5.000 Max. :5.00 Max. :5.000 Max. :5.000 Max. :5.00
## P15 P16 P17 P18
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:3.000 1st Qu.:1.000 1st Qu.:1.250 1st Qu.:1.000
## Median :4.000 Median :2.000 Median :2.000 Median :2.000
## Mean :4.022 Mean :2.478 Mean :2.391 Mean :2.239
## 3rd Qu.:5.000 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:3.000
## Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
## P19 P20
## Min. :1.000 Min. :1.000
## 1st Qu.:2.000 1st Qu.:3.000
## Median :3.000 Median :4.000
## Mean :2.804 Mean :3.804
## 3rd Qu.:4.000 3rd Qu.:5.000
## Max. :5.000 Max. :5.000
# =========================
# 2. Revisar datos faltantes
# =========================
colSums(is.na(base_afe))
## P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P17 P18 P19 P20
## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
# =========================
# 3. Correlación policórica
# =========================
cor_poly <- psych::polychoric(base_afe)$rho
## Warning in cor.smooth(mat): Matrix was not positive definite, smoothing was
## done
# Ver matriz
round(cor_poly, 2)
## P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13
## P1 1.00 0.09 0.06 -0.01 -0.04 0.40 0.09 -0.02 0.49 0.12 0.37 0.55 0.12
## P2 0.09 1.00 0.25 -0.19 -0.06 0.24 0.00 -0.27 0.15 0.20 -0.04 0.10 0.06
## P3 0.06 0.25 1.00 -0.03 0.24 0.17 0.07 -0.12 0.22 -0.04 0.12 0.10 0.21
## P4 -0.01 -0.19 -0.03 1.00 0.10 0.31 0.14 0.29 0.39 -0.28 0.37 0.05 0.27
## P5 -0.04 -0.06 0.24 0.10 1.00 0.40 -0.04 0.18 0.17 -0.18 0.03 0.14 0.20
## P6 0.40 0.24 0.17 0.31 0.40 1.00 0.04 0.29 0.65 0.39 0.46 0.31 0.42
## P7 0.09 0.00 0.07 0.14 -0.04 0.04 1.00 -0.11 0.16 0.08 0.17 0.25 0.17
## P8 -0.02 -0.27 -0.12 0.29 0.18 0.29 -0.11 1.00 0.30 0.32 0.51 0.20 0.39
## P9 0.49 0.15 0.22 0.39 0.17 0.65 0.16 0.30 1.00 0.23 0.46 0.55 0.46
## P10 0.12 0.20 -0.04 -0.28 -0.18 0.39 0.08 0.32 0.23 1.00 0.41 0.16 0.21
## P11 0.37 -0.04 0.12 0.37 0.03 0.46 0.17 0.51 0.46 0.41 1.00 0.49 0.52
## P12 0.55 0.10 0.10 0.05 0.14 0.31 0.25 0.20 0.55 0.16 0.49 1.00 0.26
## P13 0.12 0.06 0.21 0.27 0.20 0.42 0.17 0.39 0.46 0.21 0.52 0.26 1.00
## P14 0.30 -0.04 0.20 0.42 0.17 0.39 0.25 0.28 0.43 0.21 0.58 0.43 0.75
## P15 0.07 0.21 -0.04 0.31 0.08 0.21 0.06 0.27 0.17 0.09 -0.02 -0.11 0.27
## P16 0.41 -0.01 0.34 0.31 0.26 0.33 0.51 0.11 0.50 0.08 0.45 0.38 0.31
## P17 0.24 -0.23 -0.06 0.55 0.21 0.30 0.35 0.48 0.51 0.05 0.50 0.41 0.58
## P18 0.20 -0.01 0.13 0.42 0.40 0.44 0.12 0.28 0.50 0.02 0.39 0.46 0.60
## P19 0.24 -0.09 0.25 0.27 0.16 0.46 0.30 0.25 0.31 0.25 0.63 0.34 0.41
## P20 0.28 -0.24 0.16 0.37 0.51 0.47 0.17 0.30 0.35 0.16 0.38 0.40 0.24
## P14 P15 P16 P17 P18 P19 P20
## P1 0.30 0.07 0.41 0.24 0.20 0.24 0.28
## P2 -0.04 0.21 -0.01 -0.23 -0.01 -0.09 -0.24
## P3 0.20 -0.04 0.34 -0.06 0.13 0.25 0.16
## P4 0.42 0.31 0.31 0.55 0.42 0.27 0.37
## P5 0.17 0.08 0.26 0.21 0.40 0.16 0.51
## P6 0.39 0.21 0.33 0.30 0.44 0.46 0.47
## P7 0.25 0.06 0.51 0.35 0.12 0.30 0.17
## P8 0.28 0.27 0.11 0.48 0.28 0.25 0.30
## P9 0.43 0.17 0.50 0.51 0.50 0.31 0.35
## P10 0.21 0.09 0.08 0.05 0.02 0.25 0.16
## P11 0.58 -0.02 0.45 0.50 0.39 0.63 0.38
## P12 0.43 -0.11 0.38 0.41 0.46 0.34 0.40
## P13 0.75 0.27 0.31 0.58 0.60 0.41 0.24
## P14 1.00 0.26 0.45 0.63 0.51 0.51 0.51
## P15 0.26 1.00 -0.16 0.49 0.06 -0.02 0.16
## P16 0.45 -0.16 1.00 0.45 0.58 0.43 0.49
## P17 0.63 0.49 0.45 1.00 0.64 0.33 0.50
## P18 0.51 0.06 0.58 0.64 1.00 0.35 0.44
## P19 0.51 -0.02 0.43 0.33 0.35 1.00 0.28
## P20 0.51 0.16 0.49 0.50 0.44 0.28 1.00
# =========================
# 4. KMO
# =========================
kmo_result <- KMO(cor_poly)
kmo_result
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = cor_poly)
## Overall MSA = 0.1
## MSA for each item =
## P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16
## 0.07 0.02 0.03 0.08 0.05 0.12 0.04 0.08 0.14 0.04 0.14 0.10 0.13 0.15 0.04 0.13
## P17 P18 P19 P20
## 0.16 0.14 0.10 0.11
# KMO global
kmo_result$MSA
## [1] 0.09561506
# KMO por ítem
kmo_result$MSAi
## P1 P2 P3 P4 P5 P6 P7
## 0.06800213 0.02494257 0.02826887 0.08424870 0.04927904 0.12203890 0.03951923
## P8 P9 P10 P11 P12 P13 P14
## 0.07639195 0.13588032 0.04368315 0.14298568 0.10266868 0.12847254 0.15122510
## P15 P16 P17 P18 P19 P20
## 0.03820959 0.12547505 0.15669958 0.13571692 0.10334088 0.11432759
# =========================
# 5. Bartlett
# =========================
bart_result <- cortest.bartlett(cor_poly, n = nrow(base_afe))
bart_result
## $chisq
## [1] 1334.438
##
## $p.value
## [1] 5.510717e-171
##
## $df
## [1] 190
# =========================
# 6. Determinar número de factores
# =========================
fa.parallel(cor_poly, n.obs = nrow(base_afe), fa = "fa")

## Parallel analysis suggests that the number of factors = 1 and the number of components = NA
# =========================
# 7. AFE
# Ejemplo con 2 factores
# =========================
afe_2 <- fa(
r = cor_poly,
nfactors = 2,
n.obs = nrow(base_afe),
fm = "minres",
rotate = "oblimin"
)
print(afe_2, sort = TRUE)
## Factor Analysis using method = minres
## Call: fa(r = cor_poly, nfactors = 2, n.obs = nrow(base_afe), rotate = "oblimin",
## fm = "minres")
## Standardized loadings (pattern matrix) based upon correlation matrix
## item MR1 MR2 h2 u2 com
## P12 12 0.71 -0.08 0.451 0.55 1.0
## P9 9 0.67 0.12 0.550 0.45 1.1
## P1 1 0.67 -0.22 0.343 0.66 1.2
## P16 16 0.64 0.09 0.467 0.53 1.0
## P6 6 0.63 0.08 0.457 0.54 1.0
## P11 11 0.60 0.22 0.539 0.46 1.3
## P19 19 0.54 0.12 0.374 0.63 1.1
## P14 14 0.45 0.44 0.600 0.40 2.0
## P10 10 0.42 -0.17 0.133 0.87 1.3
## P3 3 0.40 -0.20 0.119 0.88 1.5
## P7 7 0.27 0.06 0.093 0.91 1.1
## P17 17 0.10 0.86 0.838 0.16 1.0
## P4 4 -0.09 0.72 0.453 0.55 1.0
## P8 8 0.02 0.54 0.298 0.70 1.0
## P15 15 -0.15 0.44 0.151 0.85 1.2
## P18 18 0.39 0.43 0.515 0.49 2.0
## P13 13 0.36 0.43 0.471 0.53 1.9
## P2 2 0.35 -0.42 0.153 0.85 1.9
## P20 20 0.34 0.39 0.398 0.60 2.0
## P5 5 0.12 0.25 0.111 0.89 1.5
##
## MR1 MR2
## SS loadings 4.32 3.19
## Proportion Var 0.22 0.16
## Cumulative Var 0.22 0.38
## Proportion Explained 0.57 0.43
## Cumulative Proportion 0.57 1.00
##
## With factor correlations of
## MR1 MR2
## MR1 1.00 0.51
## MR2 0.51 1.00
##
## Mean item complexity = 1.4
## Test of the hypothesis that 2 factors are sufficient.
##
## df null model = 190 with the objective function = 35.59 with Chi Square = 1334.44
## df of the model are 151 and the objective function was 29.07
##
## The root mean square of the residuals (RMSR) is 0.08
## The df corrected root mean square of the residuals is 0.09
##
## The harmonic n.obs is 46 with the empirical chi square 100.57 with prob < 1
## The total n.obs was 46 with Likelihood Chi Square = 1051.49 with prob < 9.5e-135
##
## Tucker Lewis Index of factoring reliability = -0.033
## RMSEA index = 0.359 and the 90 % confidence intervals are 0.343 0.385
## BIC = 473.37
## Fit based upon off diagonal values = 0.95
## Measures of factor score adequacy
## MR1 MR2
## Correlation of (regression) scores with factors 0.87 0.87
## Multiple R square of scores with factors 0.76 0.76
## Minimum correlation of possible factor scores 0.53 0.52
fa.parallel(cor_poly, n.obs = nrow(base_afe), fa = "fa")

## Parallel analysis suggests that the number of factors = 1 and the number of components = NA
afe_1 <- fa(cor_poly, nfactors = 1, n.obs = nrow(base_afe), fm = "minres", rotate = "oblimin")
afe_2 <- fa(cor_poly, nfactors = 2, n.obs = nrow(base_afe), fm = "minres", rotate = "oblimin")
afe_3 <- fa(cor_poly, nfactors = 3, n.obs = nrow(base_afe), fm = "minres", rotate = "oblimin")
print(afe_1, sort = TRUE)
## Factor Analysis using method = minres
## Call: fa(r = cor_poly, nfactors = 1, n.obs = nrow(base_afe), rotate = "oblimin",
## fm = "minres")
## Standardized loadings (pattern matrix) based upon correlation matrix
## V MR1 h2 u2 com
## P14 14 0.77 0.60037 0.40 1
## P17 17 0.76 0.57791 0.42 1
## P11 11 0.73 0.52949 0.47 1
## P18 18 0.71 0.50983 0.49 1
## P9 9 0.71 0.50630 0.49 1
## P13 13 0.68 0.46424 0.54 1
## P16 16 0.65 0.42262 0.58 1
## P6 6 0.64 0.41430 0.59 1
## P20 20 0.63 0.39249 0.61 1
## P19 19 0.60 0.35527 0.64 1
## P12 12 0.58 0.33118 0.67 1
## P4 4 0.48 0.22958 0.77 1
## P8 8 0.45 0.20013 0.80 1
## P1 1 0.42 0.17741 0.82 1
## P5 5 0.32 0.10248 0.90 1
## P7 7 0.30 0.08852 0.91 1
## P10 10 0.25 0.06194 0.94 1
## P15 15 0.22 0.04699 0.95 1
## P3 3 0.21 0.04291 0.96 1
## P2 2 -0.02 0.00043 1.00 1
##
## MR1
## SS loadings 6.05
## Proportion Var 0.30
##
## Mean item complexity = 1
## Test of the hypothesis that 1 factor is sufficient.
##
## df null model = 190 with the objective function = 35.59 with Chi Square = 1334.44
## df of the model are 170 and the objective function was 30.06
##
## The root mean square of the residuals (RMSR) is 0.09
## The df corrected root mean square of the residuals is 0.09
##
## The harmonic n.obs is 46 with the empirical chi square 140.68 with prob < 0.95
## The total n.obs was 46 with Likelihood Chi Square = 1107.33 with prob < 3.4e-137
##
## Tucker Lewis Index of factoring reliability = 0.065
## RMSEA index = 0.346 and the 90 % confidence intervals are 0.331 0.37
## BIC = 456.46
## Fit based upon off diagonal values = 0.92
## Measures of factor score adequacy
## MR1
## Correlation of (regression) scores with factors 0.96
## Multiple R square of scores with factors 0.92
## Minimum correlation of possible factor scores 0.84
print(afe_2, sort = TRUE)
## Factor Analysis using method = minres
## Call: fa(r = cor_poly, nfactors = 2, n.obs = nrow(base_afe), rotate = "oblimin",
## fm = "minres")
## Standardized loadings (pattern matrix) based upon correlation matrix
## item MR1 MR2 h2 u2 com
## P12 12 0.71 -0.08 0.451 0.55 1.0
## P9 9 0.67 0.12 0.550 0.45 1.1
## P1 1 0.67 -0.22 0.343 0.66 1.2
## P16 16 0.64 0.09 0.467 0.53 1.0
## P6 6 0.63 0.08 0.457 0.54 1.0
## P11 11 0.60 0.22 0.539 0.46 1.3
## P19 19 0.54 0.12 0.374 0.63 1.1
## P14 14 0.45 0.44 0.600 0.40 2.0
## P10 10 0.42 -0.17 0.133 0.87 1.3
## P3 3 0.40 -0.20 0.119 0.88 1.5
## P7 7 0.27 0.06 0.093 0.91 1.1
## P17 17 0.10 0.86 0.838 0.16 1.0
## P4 4 -0.09 0.72 0.453 0.55 1.0
## P8 8 0.02 0.54 0.298 0.70 1.0
## P15 15 -0.15 0.44 0.151 0.85 1.2
## P18 18 0.39 0.43 0.515 0.49 2.0
## P13 13 0.36 0.43 0.471 0.53 1.9
## P2 2 0.35 -0.42 0.153 0.85 1.9
## P20 20 0.34 0.39 0.398 0.60 2.0
## P5 5 0.12 0.25 0.111 0.89 1.5
##
## MR1 MR2
## SS loadings 4.32 3.19
## Proportion Var 0.22 0.16
## Cumulative Var 0.22 0.38
## Proportion Explained 0.57 0.43
## Cumulative Proportion 0.57 1.00
##
## With factor correlations of
## MR1 MR2
## MR1 1.00 0.51
## MR2 0.51 1.00
##
## Mean item complexity = 1.4
## Test of the hypothesis that 2 factors are sufficient.
##
## df null model = 190 with the objective function = 35.59 with Chi Square = 1334.44
## df of the model are 151 and the objective function was 29.07
##
## The root mean square of the residuals (RMSR) is 0.08
## The df corrected root mean square of the residuals is 0.09
##
## The harmonic n.obs is 46 with the empirical chi square 100.57 with prob < 1
## The total n.obs was 46 with Likelihood Chi Square = 1051.49 with prob < 9.5e-135
##
## Tucker Lewis Index of factoring reliability = -0.033
## RMSEA index = 0.359 and the 90 % confidence intervals are 0.343 0.385
## BIC = 473.37
## Fit based upon off diagonal values = 0.95
## Measures of factor score adequacy
## MR1 MR2
## Correlation of (regression) scores with factors 0.87 0.87
## Multiple R square of scores with factors 0.76 0.76
## Minimum correlation of possible factor scores 0.53 0.52
print(afe_3, sort = TRUE)
## Factor Analysis using method = minres
## Call: fa(r = cor_poly, nfactors = 3, n.obs = nrow(base_afe), rotate = "oblimin",
## fm = "minres")
## Standardized loadings (pattern matrix) based upon correlation matrix
## item MR1 MR2 MR3 h2 u2 com
## P16 16 0.85 0.03 -0.13 0.72 0.28 1.1
## P12 12 0.59 0.00 0.21 0.44 0.56 1.3
## P1 1 0.53 -0.14 0.23 0.32 0.68 1.5
## P9 9 0.51 0.21 0.26 0.54 0.46 1.9
## P18 18 0.47 0.44 -0.09 0.57 0.43 2.1
## P3 3 0.46 -0.20 -0.02 0.17 0.83 1.4
## P19 19 0.41 0.18 0.23 0.37 0.63 2.0
## P20 20 0.39 0.39 -0.05 0.42 0.58 2.0
## P6 6 0.39 0.20 0.37 0.48 0.52 2.5
## P7 7 0.36 0.03 -0.06 0.13 0.87 1.1
## P5 5 0.26 0.23 -0.21 0.18 0.82 2.9
## P17 17 0.12 0.85 -0.05 0.81 0.19 1.0
## P4 4 0.05 0.69 -0.27 0.49 0.51 1.3
## P8 8 -0.25 0.66 0.30 0.50 0.50 1.7
## P13 13 0.19 0.51 0.24 0.50 0.50 1.7
## P15 15 -0.28 0.50 0.10 0.23 0.77 1.7
## P14 14 0.34 0.50 0.17 0.60 0.40 2.0
## P2 2 0.18 -0.35 0.28 0.16 0.84 2.4
## P10 10 -0.03 -0.07 0.81 0.63 0.37 1.0
## P11 11 0.33 0.33 0.43 0.61 0.39 2.8
##
## MR1 MR2 MR3
## SS loadings 3.56 3.55 1.75
## Proportion Var 0.18 0.18 0.09
## Cumulative Var 0.18 0.36 0.44
## Proportion Explained 0.40 0.40 0.20
## Cumulative Proportion 0.40 0.80 1.00
##
## With factor correlations of
## MR1 MR2 MR3
## MR1 1.00 0.44 0.19
## MR2 0.44 1.00 0.20
## MR3 0.19 0.20 1.00
##
## Mean item complexity = 1.8
## Test of the hypothesis that 3 factors are sufficient.
##
## df null model = 190 with the objective function = 35.59 with Chi Square = 1334.44
## df of the model are 133 and the objective function was 28.25
##
## The root mean square of the residuals (RMSR) is 0.06
## The df corrected root mean square of the residuals is 0.08
##
## The harmonic n.obs is 46 with the empirical chi square 72.77 with prob < 1
## The total n.obs was 46 with Likelihood Chi Square = 1002.88 with prob < 2.1e-133
##
## Tucker Lewis Index of factoring reliability = -0.158
## RMSEA index = 0.376 and the 90 % confidence intervals are 0.359 0.403
## BIC = 493.68
## Fit based upon off diagonal values = 0.96
## Measures of factor score adequacy
## MR1 MR2 MR3
## Correlation of (regression) scores with factors 0.88 0.89 0.87
## Multiple R square of scores with factors 0.78 0.79 0.76
## Minimum correlation of possible factor scores 0.55 0.58 0.51
GRAFICOS ENTRE VARIABLES
library(esquisse)
#esquisser(datost)
library(ggplot2)
ggplot(datost) +
aes(x = P16, fill = P18) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()

ggplot(datost) +
aes(x = P2, fill = P8) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()

ggplot(datost) +
aes(x = P1, fill = P20) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()

graficos entre de variable cruzada
ggplot(datost) +
aes(x = P7, fill = P8) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()

ggplot(datost) +
aes(x = P7, fill = CURSO) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()

ggplot(datost) +
aes(x = P5, fill = CURSO) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()

ggplot(datost) +
aes(x = P8, fill = CURSO) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()

ggplot(datost) +
aes(x = P11, fill = CURSO) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()

ggplot(datost) +
aes(x = P14, fill = P18) +
geom_bar() +
scale_fill_hue(direction = 1) +
theme_minimal()
