library(tidyverse)
library(EFAtools)
library(psych)
setwd("D:/IntellijIDEA_Projects/R_Tesis_2023/Datos")
getwd()
## [1] "D:/IntellijIDEA_Projects/R_Tesis_2023/Datos"
# Cargar datos
load("Sedano_2024_Datos.RData")
# Seleccionar variables
fa_dats <- datsF %>%
select(q_17:q_18)
# correlaciones policΓ³ricas
fa_dats
## # A tibble: 174 Γ 34
## # Rowwise:
## q_17 q_7 q_26 q_28 q_30 q_9 q_25 q_2 q_11 q_4 q_13 q_6 q_31
## <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
## 1 4 2 4 4 4 4 4 5 4 4 2 2 2
## 2 5 2 4 5 5 4 5 2 4 5 2 5 5
## 3 4 5 4 4 5 5 5 2 5 2 5 1 3
## 4 1 3 3 2 4 2 2 1 3 4 1 4 4
## 5 5 4 5 5 4 4 4 5 4 4 4 4 4
## 6 3 2 5 4 4 4 5 5 4 4 2 5 4
## 7 4 4 4 4 4 5 4 4 4 4 3 3 3
## 8 5 1 2 5 5 5 5 2 4 4 1 2 1
## 9 5 1 5 5 5 5 3 5 5 5 4 1 3
## 10 5 2 5 5 4 5 2 2 4 5 2 5 5
## # βΉ 164 more rows
## # βΉ 21 more variables: q_3 <int>, q_14 <int>, q_21 <int>, q_23 <int>,
## # q_12 <int>, q_22 <int>, q_19 <int>, q_15 <int>, q_33 <int>, q_16 <int>,
## # q_34 <int>, q_5 <int>, q_8 <int>, q_29 <int>, q_10 <int>, q_27 <int>,
## # q_24 <int>, q_1 <int>, q_32 <int>, q_20 <int>, q_18 <int>
poly_matrix <- fa_dats %>%
polychoric()#utiliza psych
poly_rho <- poly_matrix$rho
EFAtools::PARALLEL(fa_dats)
## βΉ 'x' was not a correlation matrix. Correlations are found from entered raw data.
## Parallel Analysis performed using 1000 simulated random data sets
## Eigenvalues were found using PCA, SMC, and EFA
##
## Decision rule used: means
##
## ββ Number of factors to retain according to ββββββββββββββββββββββββββββββββββββ
##
## β PCA-determined eigenvalues: 4
## β SMC-determined eigenvalues: 11
## β EFA-determined eigenvalues: 7
## Requerimientos para el anΓ‘lisis
# Bartlett test
EFAtools::BARTLETT(fa_dats)
## βΉ 'x' was not a correlation matrix. Correlations are found from entered raw data.
##
## β The Bartlett's test of sphericity was significant at an alpha level of .05.
## These data are probably suitable for factor analysis.
##
## πΒ²(561) = 4303.27, p < .001
# Kaiser-Meyer-Olkin
EFAtools::KMO(fa_dats)
## βΉ 'x' was not a correlation matrix. Correlations are found from entered raw data.
##
## ββ Kaiser-Meyer-Olkin criterion (KMO) ββββββββββββββββββββββββββββββββββββββββββ
##
## β The overall KMO value for your data is meritorious.
## These data are probably suitable for factor analysis.
##
## Overall: 0.867
##
## For each variable:
## q_17 q_7 q_26 q_28 q_30 q_9 q_25 q_2 q_11 q_4 q_13 q_6 q_31
## 0.892 0.873 0.868 0.888 0.891 0.893 0.927 0.879 0.921 0.870 0.859 0.896 0.850
## q_3 q_14 q_21 q_23 q_12 q_22 q_19 q_15 q_33 q_16 q_34 q_5 q_8
## 0.841 0.853 0.781 0.873 0.826 0.804 0.857 0.847 0.902 0.864 0.881 0.833 0.837
## q_29 q_10 q_27 q_24 q_1 q_32 q_20 q_18
## 0.795 0.839 0.875 0.928 0.831 0.816 0.874 0.853