Ejemplo “Estudio de Holzinger y Swineford (1939)”

Cargamos librerías

library(lavaan)
## Warning: package 'lavaan' was built under R version 4.3.2
## This is lavaan 0.6-17
## lavaan is FREE software! Please report any bugs.
library(lavaanPlot)
## Warning: package 'lavaanPlot' was built under R version 4.3.2
library(readxl)

Importar la base de Datos

df1 <- HolzingerSwineford1939

Exoloración base de datos

str(df1)
## 'data.frame':    301 obs. of  15 variables:
##  $ id    : int  1 2 3 4 5 6 7 8 9 11 ...
##  $ sex   : int  1 2 2 1 2 2 1 2 2 2 ...
##  $ ageyr : int  13 13 13 13 12 14 12 12 13 12 ...
##  $ agemo : int  1 7 1 2 2 1 1 2 0 5 ...
##  $ school: Factor w/ 2 levels "Grant-White",..: 2 2 2 2 2 2 2 2 2 2 ...
##  $ grade : int  7 7 7 7 7 7 7 7 7 7 ...
##  $ x1    : num  3.33 5.33 4.5 5.33 4.83 ...
##  $ x2    : num  7.75 5.25 5.25 7.75 4.75 5 6 6.25 5.75 5.25 ...
##  $ x3    : num  0.375 2.125 1.875 3 0.875 ...
##  $ x4    : num  2.33 1.67 1 2.67 2.67 ...
##  $ x5    : num  5.75 3 1.75 4.5 4 3 6 4.25 5.75 5 ...
##  $ x6    : num  1.286 1.286 0.429 2.429 2.571 ...
##  $ x7    : num  3.39 3.78 3.26 3 3.7 ...
##  $ x8    : num  5.75 6.25 3.9 5.3 6.3 6.65 6.2 5.15 4.65 4.55 ...
##  $ x9    : num  6.36 7.92 4.42 4.86 5.92 ...

Tipos de formulas

  1. Regresion (~) variable que depende de otras
  2. Variables latentes (=~) No se observa, se infiere 3.Analisis de varianza y covarianza (~~) Relaciones entre variables latentes y observadas (varianza entre si misma, Covarianza,entre otras)
  3. Intercepto (~1) Valor esperado cuando las demas variables son cero.

Estructura del Modelo

modelo1 <- ' # Regresiones
           # Variables latentes
           visual =~ x1+ x2 + x3
           textual =~ x4 + x5 + x6
           velocidad =~ x7 + x8 + x9
           # Varianzas y Covarianzas
           # Intercepto
           '

Análisis Factorial Confirmatorio

fit <- cfa(modelo1, data= df1)
summary(fit)
## lavaan 0.6.17 ended normally after 35 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        21
## 
##   Number of observations                           301
## 
## Model Test User Model:
##                                                       
##   Test statistic                                85.306
##   Degrees of freedom                                24
##   P-value (Chi-square)                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   visual =~                                           
##     x1                1.000                           
##     x2                0.554    0.100    5.554    0.000
##     x3                0.729    0.109    6.685    0.000
##   textual =~                                          
##     x4                1.000                           
##     x5                1.113    0.065   17.014    0.000
##     x6                0.926    0.055   16.703    0.000
##   velocidad =~                                        
##     x7                1.000                           
##     x8                1.180    0.165    7.152    0.000
##     x9                1.082    0.151    7.155    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   visual ~~                                           
##     textual           0.408    0.074    5.552    0.000
##     velocidad         0.262    0.056    4.660    0.000
##   textual ~~                                          
##     velocidad         0.173    0.049    3.518    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .x1                0.549    0.114    4.833    0.000
##    .x2                1.134    0.102   11.146    0.000
##    .x3                0.844    0.091    9.317    0.000
##    .x4                0.371    0.048    7.779    0.000
##    .x5                0.446    0.058    7.642    0.000
##    .x6                0.356    0.043    8.277    0.000
##    .x7                0.799    0.081    9.823    0.000
##    .x8                0.488    0.074    6.573    0.000
##    .x9                0.566    0.071    8.003    0.000
##     visual            0.809    0.145    5.564    0.000
##     textual           0.979    0.112    8.737    0.000
##     velocidad         0.384    0.086    4.451    0.000
lavaanPlot(fit, coef = TRUE, cov = TRUE)

Ejercicio “Democracia Política e Industrialización”

## Contexto

La base de datos contiene distintas mediciones sobre la democracia política e industralización en paises en desarrollo durante 1960 y 1965.

La tabla inluye los siguientes datos:

y1: calificaciones de libertad en 1960

y2: libertad de la oposcion política 1960

y3: imparcialidad de elecciones 1960

y4: eficacia de la legislatura en 1960

y5: calificaciones de libertad en 1965

y6: libertad de la oposcion política 1965

y7: imparcialidad de elecciones 1965

y8: eficacia de la legislatura en 1965

x1: PIB per cápita en 1960

x2: consumo de energia inanimada per cápita 1960

x3: porcentaje de la fuerza laboral en la industria 1960

Importar base de datos

df2 <- PoliticalDemocracy

Estructura del Modelo

modelo2 <- ' # Regresiones
           Industrial60 ~ Democracia60
           # Variables latentes
           Democracia60 =~ y1 + y2 + y3 + y4
           Democracia65 =~ y5 + y6 + y7 + y8
           Industrial60 =~ x1 + x2 + x3
           Industrial65 =~ Democracia65
           # Varianzas y Covarianzas
           # Intercepto
           '

Análisis Factorial Confirmatorio

fit2 <- cfa(modelo2, df2)
summary(fit2)
## lavaan 0.6.17 ended normally after 45 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        24
## 
##   Number of observations                            75
## 
## Model Test User Model:
##                                                       
##   Test statistic                                76.467
##   Degrees of freedom                                42
##   P-value (Chi-square)                           0.001
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   Democracia60 =~                                     
##     y1                1.000                           
##     y2                1.354    0.179    7.548    0.000
##     y3                1.049    0.153    6.840    0.000
##     y4                1.320    0.141    9.334    0.000
##   Democracia65 =~                                     
##     y5                1.000                           
##     y6                1.289    0.170    7.570    0.000
##     y7                1.308    0.164    7.983    0.000
##     y8                1.335    0.160    8.342    0.000
##   Industrial60 =~                                     
##     x1                1.000                           
##     x2                2.179    0.139   15.685    0.000
##     x3                1.818    0.152   11.968    0.000
##   Industrial65 =~                                     
##     Democracia65      1.000                           
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   Industrial60 ~                                      
##     Democracia60      0.155    0.036    4.330    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   Democracia60 ~~                                     
##     Industrial65      4.405    0.904    4.872    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .y1                2.053    0.405    5.064    0.000
##    .y2                6.694    1.207    5.546    0.000
##    .y3                5.414    0.950    5.699    0.000
##    .y4                2.817    0.593    4.749    0.000
##    .y5                2.519    0.469    5.377    0.000
##    .y6                4.216    0.783    5.382    0.000
##    .y7                3.443    0.665    5.178    0.000
##    .y8                2.880    0.584    4.928    0.000
##    .x1                0.081    0.020    4.138    0.000
##    .x2                0.121    0.071    1.701    0.089
##    .x3                0.467    0.090    5.163    0.000
##     Democracia60      4.734    1.081    4.381    0.000
##    .Democracia65      0.000                           
##    .Industrial60      0.336    0.067    5.045    0.000
##     Industrial65      4.216    1.044    4.037    0.000
lavaanPlot(fit2, coef=TRUE, cov=TRUE)

Actividad “Bienestar de los Colaboradores”

Contexto

Uno de los retos más importantes de las organizaciones es entender el estado y bienestar de los colaboradores, ya que puede impactar directamente en el desempeño y el logro de los objetivos.

Parte 1 Experiencias de recuperación

Cargar librería

library(lavaan)
library(lavaanPlot)

Importar base de datos

library(readxl)
library(readxl)
Datos_SEM_Eng <- read_excel("Datos_SEM_Eng.xlsx")
View(Datos_SEM_Eng)
df1 <- read_excel("Datos_SEM_Eng.xlsx")

Entender la base

summary(df1)
##        ID             GEN             EXPER            EDAD      
##  Min.   :  1.0   Min.   :0.0000   Min.   : 0.00   Min.   :22.00  
##  1st Qu.: 56.5   1st Qu.:0.0000   1st Qu.:15.00   1st Qu.:37.50  
##  Median :112.0   Median :1.0000   Median :20.00   Median :44.00  
##  Mean   :112.0   Mean   :0.5919   Mean   :21.05   Mean   :43.95  
##  3rd Qu.:167.5   3rd Qu.:1.0000   3rd Qu.:27.50   3rd Qu.:51.00  
##  Max.   :223.0   Max.   :1.0000   Max.   :50.00   Max.   :72.00  
##      RPD01           RPD02          RPD03           RPD05           RPD06      
##  Min.   :1.000   Min.   :1.00   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:3.00   1st Qu.:3.000   1st Qu.:3.000   1st Qu.:3.000  
##  Median :5.000   Median :4.00   Median :5.000   Median :5.000   Median :5.000  
##  Mean   :4.596   Mean   :4.09   Mean   :4.789   Mean   :4.327   Mean   :4.798  
##  3rd Qu.:6.000   3rd Qu.:6.00   3rd Qu.:7.000   3rd Qu.:6.000   3rd Qu.:7.000  
##  Max.   :7.000   Max.   :7.00   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##      RPD07           RPD08           RPD09           RPD10      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:3.000   1st Qu.:3.000   1st Qu.:2.500  
##  Median :4.000   Median :5.000   Median :5.000   Median :5.000  
##  Mean   :3.794   Mean   :4.735   Mean   :4.466   Mean   :4.435  
##  3rd Qu.:5.500   3rd Qu.:7.000   3rd Qu.:6.000   3rd Qu.:6.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##      RRE02           RRE03           RRE04           RRE05           RRE06    
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.0  
##  1st Qu.:5.000   1st Qu.:5.000   1st Qu.:5.000   1st Qu.:5.000   1st Qu.:4.0  
##  Median :6.000   Median :6.000   Median :6.000   Median :6.000   Median :6.0  
##  Mean   :5.691   Mean   :5.534   Mean   :5.668   Mean   :5.623   Mean   :5.3  
##  3rd Qu.:7.000   3rd Qu.:7.000   3rd Qu.:7.000   3rd Qu.:7.000   3rd Qu.:7.0  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.0  
##      RRE07           RRE10           RMA02           RMA03      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:5.000   1st Qu.:3.000   1st Qu.:3.000  
##  Median :6.000   Median :6.000   Median :4.000   Median :5.000  
##  Mean   :5.305   Mean   :5.664   Mean   :4.215   Mean   :4.377  
##  3rd Qu.:7.000   3rd Qu.:7.000   3rd Qu.:6.000   3rd Qu.:6.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##      RMA04           RMA05           RMA06           RMA07      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:3.000   1st Qu.:5.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :6.000   Median :5.000  
##  Mean   :4.686   Mean   :4.637   Mean   :5.511   Mean   :4.767  
##  3rd Qu.:6.000   3rd Qu.:6.000   3rd Qu.:7.000   3rd Qu.:6.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##      RMA08           RMA09           RMA10          RCO02           RCO03      
##  Min.   :1.000   Min.   :1.000   Min.   :1.00   Min.   :1.000   Min.   :1.000  
##  1st Qu.:4.000   1st Qu.:3.000   1st Qu.:3.00   1st Qu.:5.000   1st Qu.:5.000  
##  Median :5.000   Median :5.000   Median :5.00   Median :6.000   Median :6.000  
##  Mean   :4.942   Mean   :4.614   Mean   :4.43   Mean   :5.336   Mean   :5.574  
##  3rd Qu.:6.500   3rd Qu.:6.000   3rd Qu.:6.00   3rd Qu.:7.000   3rd Qu.:7.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.00   Max.   :7.000   Max.   :7.000  
##      RCO04           RCO05           RCO06           RCO07      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:5.000   1st Qu.:5.000   1st Qu.:5.000   1st Qu.:5.000  
##  Median :6.000   Median :6.000   Median :6.000   Median :6.000  
##  Mean   :5.704   Mean   :5.668   Mean   :5.619   Mean   :5.632  
##  3rd Qu.:7.000   3rd Qu.:7.000   3rd Qu.:7.000   3rd Qu.:7.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##       EN01            EN02            EN04            EN05      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
##  1st Qu.:3.000   1st Qu.:4.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :6.000   Median :5.000   Median :5.000  
##  Mean   :4.717   Mean   :5.004   Mean   :4.883   Mean   :4.928  
##  3rd Qu.:6.000   3rd Qu.:7.000   3rd Qu.:6.000   3rd Qu.:6.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##       EN06            EN07            EN08           EVI01      
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :0.000  
##  1st Qu.:3.000   1st Qu.:3.000   1st Qu.:4.000   1st Qu.:4.000  
##  Median :5.000   Median :5.000   Median :5.000   Median :5.000  
##  Mean   :4.767   Mean   :4.578   Mean   :4.776   Mean   :5.013  
##  3rd Qu.:6.000   3rd Qu.:6.000   3rd Qu.:6.000   3rd Qu.:6.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##      EVI02           EVI03           EDE01           EDE02      
##  Min.   :0.000   Min.   :0.000   Min.   :0.000   Min.   :0.000  
##  1st Qu.:4.000   1st Qu.:4.000   1st Qu.:5.000   1st Qu.:5.000  
##  Median :6.000   Median :6.000   Median :6.000   Median :6.000  
##  Mean   :5.076   Mean   :4.973   Mean   :5.305   Mean   :5.543  
##  3rd Qu.:6.000   3rd Qu.:6.000   3rd Qu.:7.000   3rd Qu.:7.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000  
##      EDE03           EAB01           EAB02           EAB03      
##  Min.   :0.000   Min.   :0.000   Min.   :0.000   Min.   :0.000  
##  1st Qu.:6.000   1st Qu.:5.000   1st Qu.:5.000   1st Qu.:5.000  
##  Median :7.000   Median :6.000   Median :6.000   Median :6.000  
##  Mean   :6.135   Mean   :5.605   Mean   :5.821   Mean   :5.363  
##  3rd Qu.:7.000   3rd Qu.:7.000   3rd Qu.:7.000   3rd Qu.:7.000  
##  Max.   :7.000   Max.   :7.000   Max.   :7.000   Max.   :7.000
str(df1)
## tibble [223 × 51] (S3: tbl_df/tbl/data.frame)
##  $ ID   : num [1:223] 1 2 3 4 5 6 7 8 9 10 ...
##  $ GEN  : num [1:223] 1 1 1 1 1 0 0 1 1 1 ...
##  $ EXPER: num [1:223] 22 22 30 17 23 31 26 30 15 15 ...
##  $ EDAD : num [1:223] 45 44 52 41 51 52 53 48 40 38 ...
##  $ RPD01: num [1:223] 5 4 7 5 7 3 5 6 4 2 ...
##  $ RPD02: num [1:223] 1 4 7 5 6 4 5 7 4 3 ...
##  $ RPD03: num [1:223] 3 6 7 1 7 5 4 6 4 2 ...
##  $ RPD05: num [1:223] 2 5 7 1 6 4 4 7 4 3 ...
##  $ RPD06: num [1:223] 3 3 7 3 7 3 5 2 6 7 ...
##  $ RPD07: num [1:223] 1 2 6 5 6 5 6 5 4 1 ...
##  $ RPD08: num [1:223] 3 3 7 3 7 4 6 2 5 3 ...
##  $ RPD09: num [1:223] 2 4 7 2 6 4 7 4 4 2 ...
##  $ RPD10: num [1:223] 4 4 7 2 6 4 7 1 6 2 ...
##  $ RRE02: num [1:223] 6 6 7 6 7 5 7 5 6 7 ...
##  $ RRE03: num [1:223] 6 6 7 6 7 4 7 4 4 7 ...
##  $ RRE04: num [1:223] 6 6 7 6 7 4 7 4 6 7 ...
##  $ RRE05: num [1:223] 6 6 7 6 7 5 7 4 6 7 ...
##  $ RRE06: num [1:223] 6 6 7 6 7 4 7 4 6 7 ...
##  $ RRE07: num [1:223] 6 6 7 6 7 4 7 4 6 7 ...
##  $ RRE10: num [1:223] 6 6 7 6 7 4 7 4 6 7 ...
##  $ RMA02: num [1:223] 4 6 4 3 4 7 5 2 6 7 ...
##  $ RMA03: num [1:223] 5 6 5 4 4 7 5 1 2 7 ...
##  $ RMA04: num [1:223] 5 5 6 4 4 5 5 1 4 7 ...
##  $ RMA05: num [1:223] 5 5 6 4 4 6 5 3 4 7 ...
##  $ RMA06: num [1:223] 6 6 7 6 5 4 5 7 6 7 ...
##  $ RMA07: num [1:223] 4 6 6 5 4 5 7 4 6 7 ...
##  $ RMA08: num [1:223] 5 6 4 4 4 6 6 4 2 7 ...
##  $ RMA09: num [1:223] 3 5 4 3 5 4 5 2 4 7 ...
##  $ RMA10: num [1:223] 7 5 5 4 5 5 6 4 3 7 ...
##  $ RCO02: num [1:223] 7 7 7 5 7 6 7 7 3 7 ...
##  $ RCO03: num [1:223] 7 7 7 5 7 5 7 7 3 7 ...
##  $ RCO04: num [1:223] 7 7 7 6 7 4 7 7 3 7 ...
##  $ RCO05: num [1:223] 7 7 7 6 7 4 7 7 3 7 ...
##  $ RCO06: num [1:223] 7 7 7 6 7 4 7 7 4 7 ...
##  $ RCO07: num [1:223] 5 7 7 6 7 4 7 7 7 7 ...
##  $ EN01 : num [1:223] 6 6 7 4 6 4 7 7 4 7 ...
##  $ EN02 : num [1:223] 7 6 7 4 6 4 7 7 4 7 ...
##  $ EN04 : num [1:223] 6 6 7 4 6 4 7 6 4 7 ...
##  $ EN05 : num [1:223] 5 5 7 5 6 5 7 6 4 7 ...
##  $ EN06 : num [1:223] 5 5 7 5 6 3 7 5 5 7 ...
##  $ EN07 : num [1:223] 5 5 7 2 6 4 7 4 4 7 ...
##  $ EN08 : num [1:223] 6 5 7 5 6 4 7 4 4 7 ...
##  $ EVI01: num [1:223] 6 5 7 5 6 4 7 6 6 0 ...
##  $ EVI02: num [1:223] 6 5 7 6 6 4 6 5 5 1 ...
##  $ EVI03: num [1:223] 6 6 6 7 6 4 6 6 7 0 ...
##  $ EDE01: num [1:223] 6 6 6 5 7 6 7 7 7 1 ...
##  $ EDE02: num [1:223] 7 6 7 6 7 5 7 7 7 5 ...
##  $ EDE03: num [1:223] 7 7 7 7 7 5 7 7 7 6 ...
##  $ EAB01: num [1:223] 7 7 7 6 7 5 7 7 7 0 ...
##  $ EAB02: num [1:223] 7 7 7 6 7 5 7 2 5 1 ...
##  $ EAB03: num [1:223] 6 5 6 5 6 5 7 3 5 0 ...

Tipos de formulas

  1. Regresion (~) variable que depende de otras
  2. Variables latentes (=~) No se observa, se infiere No la podemos medir pero si intuir por otras variables = guion curvo y luego las variables para explicarla unidas por un signo mas 3.Analisis de varianza y covarianza (~~) Relaciones entre variables latentes y observadas (varianza entre si misma, Covarianza,entre otras)
  3. Intercepto (~1) Valor esperado cuando las demas variables son cero.

Estructurar el modelo

modelo1<- '# Regresiones
  # Variables latentes
  desapego=~ RPD01 + RPD02 + RPD03 + RPD05 + RPD06 + RPD07 + RPD08 + RPD09 + RPD10
  relajación=~ RRE02 + RRE03 + RRE04 + RRE05 + RRE06 + RRE07 + RRE10
  dominio=~ RMA02 + RMA03 + RMA04 + RMA05 + RMA06 + RMA07 + RMA08+ RMA09 + RMA10
  control=~ RCO02 + RCO03 + RCO04 + RCO05 + RCO06 + RCO07
  recuperación=~ desapego + relajación + dominio + control
  # Varianzas y covarianzas
  # Intercepto
  '

Generar análisis factorial confirmatorio (CFA)

fit <- cfa(modelo1, df1)
summary(fit)
## lavaan 0.6.17 ended normally after 47 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        66
## 
##   Number of observations                           223
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1221.031
##   Degrees of freedom                               430
##   P-value (Chi-square)                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   desapego =~                                         
##     RPD01             1.000                           
##     RPD02             1.206    0.082   14.780    0.000
##     RPD03             1.143    0.085   13.374    0.000
##     RPD05             1.312    0.086   15.244    0.000
##     RPD06             1.088    0.089   12.266    0.000
##     RPD07             1.229    0.085   14.440    0.000
##     RPD08             1.164    0.087   13.447    0.000
##     RPD09             1.317    0.087   15.153    0.000
##     RPD10             1.346    0.088   15.258    0.000
##   relajación =~                                       
##     RRE02             1.000                           
##     RRE03             1.120    0.065   17.227    0.000
##     RRE04             1.025    0.058   17.713    0.000
##     RRE05             1.055    0.056   18.758    0.000
##     RRE06             1.245    0.074   16.869    0.000
##     RRE07             1.117    0.071   15.689    0.000
##     RRE10             0.815    0.067   12.120    0.000
##   dominio =~                                          
##     RMA02             1.000                           
##     RMA03             1.155    0.096   12.079    0.000
##     RMA04             1.178    0.089   13.274    0.000
##     RMA05             1.141    0.087   13.072    0.000
##     RMA06             0.645    0.075    8.597    0.000
##     RMA07             1.103    0.084   13.061    0.000
##     RMA08             1.109    0.085   12.994    0.000
##     RMA09             1.028    0.084   12.246    0.000
##     RMA10             1.055    0.088   12.044    0.000
##   control =~                                          
##     RCO02             1.000                           
##     RCO03             0.948    0.049   19.182    0.000
##     RCO04             0.796    0.044   18.110    0.000
##     RCO05             0.818    0.043   18.990    0.000
##     RCO06             0.834    0.046   18.216    0.000
##     RCO07             0.835    0.046   18.057    0.000
##   recuperación =~                                     
##     desapego          1.000                           
##     relajación        1.149    0.131    8.787    0.000
##     dominio           0.858    0.129    6.666    0.000
##     control           1.341    0.156    8.605    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .RPD01             1.172    0.120    9.782    0.000
##    .RPD02             0.999    0.108    9.228    0.000
##    .RPD03             1.441    0.148    9.733    0.000
##    .RPD05             0.987    0.110    8.964    0.000
##    .RPD06             1.817    0.182    9.967    0.000
##    .RPD07             1.173    0.125    9.383    0.000
##    .RPD08             1.460    0.150    9.714    0.000
##    .RPD09             1.032    0.114    9.021    0.000
##    .RPD10             1.034    0.115    8.955    0.000
##    .RRE02             0.626    0.068    9.274    0.000
##    .RRE03             0.653    0.073    9.011    0.000
##    .RRE04             0.481    0.055    8.794    0.000
##    .RRE05             0.374    0.046    8.153    0.000
##    .RRE06             0.886    0.097    9.149    0.000
##    .RRE07             0.950    0.100    9.505    0.000
##    .RRE10             1.137    0.113   10.093    0.000
##    .RMA02             1.740    0.175    9.931    0.000
##    .RMA03             1.485    0.155    9.575    0.000
##    .RMA04             0.855    0.097    8.772    0.000
##    .RMA05             0.899    0.100    8.967    0.000
##    .RMA06             1.631    0.159   10.281    0.000
##    .RMA07             0.845    0.094    8.977    0.000
##    .RMA08             0.886    0.098    9.034    0.000
##    .RMA09             1.094    0.115    9.500    0.000
##    .RMA10             1.259    0.131    9.590    0.000
##    .RCO02             0.983    0.105    9.379    0.000
##    .RCO03             0.484    0.058    8.391    0.000
##    .RCO04             0.462    0.052    8.963    0.000
##    .RCO05             0.382    0.045    8.513    0.000
##    .RCO06             0.494    0.055    8.917    0.000
##    .RCO07             0.515    0.057    8.985    0.000
##    .desapego          0.943    0.152    6.207    0.000
##    .relajación        0.333    0.089    3.757    0.000
##    .dominio           1.260    0.212    5.942    0.000
##    .control           0.900    0.159    5.666    0.000
##     recuperación      0.978    0.202    4.833    0.000
lavaanPlot(fit, coef = TRUE, cov = TRUE)

Criterios para depurar el modelo

Checar en latent variables Los índices son los Estimate y entre mas altos tienen más valor depurar Los índices son los estimate son muy bajos *p value mayor de .05 se quita porque no es estadisticamente significativa Si el std error (error estandar) es muy alto se quita

Depurar el modelo

modelo1depurado<- '# Regresiones
  # Variables latentes
  desapego=~ RPD01 + RPD02 + RPD03 + RPD05 + RPD07 + RPD08 + RPD09 + RPD10
  relajación=~ RRE02 + RRE03 + RRE04 + RRE05 + RRE06 + RRE07
  dominio=~ RMA02 + RMA03 + RMA04 + RMA05 + RMA07 + RMA08 + RMA09 + RMA10
  control=~ RCO02 + RCO03 + RCO05 + RCO06 + RCO07
  recuperación=~ desapego + relajación + dominio + control
  # Varianzas y covarianzas
  # Intercepto
  '

Generar análisis factorial confirmatorio (CFA)

fitdepurado <- cfa(modelo1depurado, df1)
summary(fitdepurado)
## lavaan 0.6.17 ended normally after 48 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        58
## 
##   Number of observations                           223
## 
## Model Test User Model:
##                                                       
##   Test statistic                               886.791
##   Degrees of freedom                               320
##   P-value (Chi-square)                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   desapego =~                                         
##     RPD01             1.000                           
##     RPD02             1.204    0.079   15.158    0.000
##     RPD03             1.146    0.083   13.750    0.000
##     RPD05             1.310    0.084   15.663    0.000
##     RPD07             1.219    0.083   14.675    0.000
##     RPD08             1.114    0.086   13.004    0.000
##     RPD09             1.301    0.085   15.315    0.000
##     RPD10             1.328    0.086   15.404    0.000
##   relajación =~                                       
##     RRE02             1.000                           
##     RRE03             1.111    0.064   17.245    0.000
##     RRE04             1.025    0.057   17.974    0.000
##     RRE05             1.054    0.055   19.046    0.000
##     RRE06             1.237    0.073   16.904    0.000
##     RRE07             1.105    0.071   15.618    0.000
##   dominio =~                                          
##     RMA02             1.000                           
##     RMA03             1.155    0.095   12.223    0.000
##     RMA04             1.176    0.088   13.412    0.000
##     RMA05             1.140    0.086   13.220    0.000
##     RMA07             1.091    0.083   13.067    0.000
##     RMA08             1.103    0.084   13.087    0.000
##     RMA09             1.020    0.083   12.287    0.000
##     RMA10             1.049    0.087   12.097    0.000
##   control =~                                          
##     RCO02             1.000                           
##     RCO03             0.944    0.051   18.648    0.000
##     RCO05             0.820    0.044   18.683    0.000
##     RCO06             0.840    0.046   18.083    0.000
##     RCO07             0.842    0.047   18.010    0.000
##   recuperación =~                                     
##     desapego          1.000                           
##     relajación        1.145    0.132    8.696    0.000
##     dominio           0.843    0.129    6.525    0.000
##     control           1.356    0.159    8.549    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .RPD01             1.134    0.117    9.697    0.000
##    .RPD02             0.956    0.105    9.070    0.000
##    .RPD03             1.381    0.143    9.629    0.000
##    .RPD05             0.932    0.107    8.749    0.000
##    .RPD07             1.162    0.125    9.304    0.000
##    .RPD08             1.629    0.166    9.815    0.000
##    .RPD09             1.053    0.117    8.980    0.000
##    .RPD10             1.061    0.119    8.926    0.000
##    .RRE02             0.612    0.067    9.179    0.000
##    .RRE03             0.666    0.074    8.988    0.000
##    .RRE04             0.467    0.054    8.651    0.000
##    .RRE05             0.361    0.045    7.940    0.000
##    .RRE06             0.898    0.098    9.119    0.000
##    .RRE07             0.974    0.102    9.502    0.000
##    .RMA02             1.720    0.174    9.901    0.000
##    .RMA03             1.456    0.153    9.519    0.000
##    .RMA04             0.839    0.097    8.681    0.000
##    .RMA05             0.879    0.099    8.876    0.000
##    .RMA07             0.874    0.097    9.009    0.000
##    .RMA08             0.884    0.098    8.993    0.000
##    .RMA09             1.105    0.116    9.490    0.000
##    .RMA10             1.265    0.132    9.573    0.000
##    .RCO02             0.999    0.109    9.187    0.000
##    .RCO03             0.517    0.063    8.171    0.000
##    .RCO05             0.385    0.047    8.145    0.000
##    .RCO06             0.482    0.056    8.540    0.000
##    .RCO07             0.495    0.058    8.582    0.000
##    .desapego          0.985    0.157    6.286    0.000
##    .relajación        0.360    0.092    3.917    0.000
##    .dominio           1.309    0.218    5.994    0.000
##    .control           0.850    0.159    5.341    0.000
##     recuperación      0.974    0.203    4.795    0.000
lavaanPlot(fitdepurado, coef = TRUE, cov = TRUE)

Test statistic el mejor modelo es el que tiene mayor test statistic en este caso el modelo 1

Parte 2 Energía recuperada

Estructurar el modelo

modelo2<- '# Regresiones
  # Variables latentes
  energia=~ EN01 + EN02 + EN04 + EN05 + EN06 + EN07 + EN08
  # Varianzas y covarianzas
  # Intercepto
  '

Generar análisis factorial confirmatorio (CFA)

fit2 <- cfa(modelo2, df1)
summary(fit2)
## lavaan 0.6.17 ended normally after 32 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        14
## 
##   Number of observations                           223
## 
## Model Test User Model:
##                                                       
##   Test statistic                                47.222
##   Degrees of freedom                                14
##   P-value (Chi-square)                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   energia =~                                          
##     EN01              1.000                           
##     EN02              1.029    0.044   23.192    0.000
##     EN04              0.999    0.044   22.583    0.000
##     EN05              0.999    0.042   23.649    0.000
##     EN06              0.986    0.042   23.722    0.000
##     EN07              1.049    0.046   22.856    0.000
##     EN08              1.036    0.043   24.173    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .EN01              0.711    0.074    9.651    0.000
##    .EN02              0.444    0.049    9.012    0.000
##    .EN04              0.481    0.052    9.214    0.000
##    .EN05              0.375    0.042    8.830    0.000
##    .EN06              0.359    0.041    8.798    0.000
##    .EN07              0.499    0.055    9.129    0.000
##    .EN08              0.353    0.041    8.580    0.000
##     energia           2.801    0.327    8.565    0.000
lavaanPlot(fit2, coef = TRUE, cov = TRUE)

Después de evaluar los valores estimativos, los errores estándar y el p value, determinamos innecesario depurar el modelo

Parte 3 Engagement laboral

Estructurar el modelo

modelo3<- '# Regresiones
  # Variables latentes 1
  desapego=~ RPD01 + RPD02 + RPD03 + RPD05 + RPD06 + RPD07 + RPD08 + RPD09 + RPD10
  relajación=~ RRE02 + RRE03 + RRE04 + RRE05 + RRE06 + RRE07 + RRE10
  dominio=~ RMA02 + RMA03 + RMA04 + RMA05 + RMA06 + RMA07 + RMA08+ RMA09 + RMA10
  control=~ RCO02 + RCO03 + RCO04 + RCO05 + RCO06 + RCO07
  recuperación=~ desapego + relajación + dominio + control
  
  # Variables latentes 2
  energia=~ EN01 + EN02 + EN04 + EN05 + EN06 + EN07 + EN08
  
  # Variables latentes 3
  vigor=~ EVI01 + EVI02 + EVI03
  dedicacion=~ EDE01 + EDE02 + EDE03
  absorcion=~ EAB01 + EAB02
  engagement=~ vigor + dedicacion + absorcion
  
  # Varianzas y covarianzas
  engagement ~~ energia + recuperación
  # Intercepto
  '

Generar análisis de senderos

fit3 <- sem(modelo3, df1)
summary(fit3)
## lavaan 0.6.17 ended normally after 73 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       102
## 
##   Number of observations                           223
## 
## Model Test User Model:
##                                                       
##   Test statistic                              2395.225
##   Degrees of freedom                               979
##   P-value (Chi-square)                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   desapego =~                                         
##     RPD01             1.000                           
##     RPD02             1.209    0.081   14.866    0.000
##     RPD03             1.144    0.085   13.419    0.000
##     RPD05             1.313    0.086   15.317    0.000
##     RPD06             1.082    0.089   12.214    0.000
##     RPD07             1.229    0.085   14.487    0.000
##     RPD08             1.157    0.086   13.375    0.000
##     RPD09             1.315    0.087   15.163    0.000
##     RPD10             1.343    0.088   15.247    0.000
##   relajación =~                                       
##     RRE02             1.000                           
##     RRE03             1.120    0.065   17.295    0.000
##     RRE04             1.021    0.058   17.626    0.000
##     RRE05             1.051    0.056   18.687    0.000
##     RRE06             1.246    0.074   16.924    0.000
##     RRE07             1.121    0.071   15.837    0.000
##     RRE10             0.814    0.067   12.134    0.000
##   dominio =~                                          
##     RMA02             1.000                           
##     RMA03             1.152    0.096   12.041    0.000
##     RMA04             1.178    0.089   13.265    0.000
##     RMA05             1.141    0.087   13.057    0.000
##     RMA06             0.648    0.075    8.625    0.000
##     RMA07             1.104    0.085   13.062    0.000
##     RMA08             1.110    0.085   13.001    0.000
##     RMA09             1.030    0.084   12.257    0.000
##     RMA10             1.056    0.088   12.047    0.000
##   control =~                                          
##     RCO02             1.000                           
##     RCO03             0.945    0.049   19.172    0.000
##     RCO04             0.794    0.044   18.100    0.000
##     RCO05             0.814    0.043   18.926    0.000
##     RCO06             0.837    0.045   18.409    0.000
##     RCO07             0.836    0.046   18.206    0.000
##   recuperación =~                                     
##     desapego          1.000                           
##     relajación        1.070    0.121    8.838    0.000
##     dominio           0.900    0.129    6.959    0.000
##     control           1.424    0.157    9.063    0.000
##   energia =~                                          
##     EN01              1.000                           
##     EN02              1.027    0.044   23.416    0.000
##     EN04              0.998    0.044   22.870    0.000
##     EN05              0.996    0.042   23.836    0.000
##     EN06              0.983    0.041   23.857    0.000
##     EN07              1.045    0.045   22.964    0.000
##     EN08              1.033    0.042   24.399    0.000
##   vigor =~                                            
##     EVI01             1.000                           
##     EVI02             0.985    0.028   35.255    0.000
##     EVI03             0.996    0.048   20.570    0.000
##   dedicacion =~                                       
##     EDE01             1.000                           
##     EDE02             0.905    0.034   26.515    0.000
##     EDE03             0.567    0.037   15.447    0.000
##   absorcion =~                                        
##     EAB01             1.000                           
##     EAB02             0.656    0.053   12.368    0.000
##   engagement =~                                       
##     vigor             1.000                           
##     dedicacion        1.216    0.061   20.023    0.000
##     absorcion         0.984    0.057   17.202    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   energia ~~                                          
##     engagement        1.616    0.222    7.269    0.000
##   recuperación ~~                                     
##     engagement        0.893    0.152    5.888    0.000
##     energia           1.365    0.197    6.933    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .RPD01             1.168    0.119    9.781    0.000
##    .RPD02             0.982    0.107    9.202    0.000
##    .RPD03             1.434    0.147    9.729    0.000
##    .RPD05             0.972    0.109    8.938    0.000
##    .RPD06             1.837    0.184    9.980    0.000
##    .RPD07             1.165    0.124    9.377    0.000
##    .RPD08             1.486    0.153    9.740    0.000
##    .RPD09             1.037    0.115    9.036    0.000
##    .RPD10             1.046    0.116    8.984    0.000
##    .RRE02             0.623    0.067    9.252    0.000
##    .RRE03             0.647    0.072    8.976    0.000
##    .RRE04             0.492    0.056    8.829    0.000
##    .RRE05             0.384    0.047    8.202    0.000
##    .RRE06             0.880    0.097    9.122    0.000
##    .RRE07             0.930    0.098    9.460    0.000
##    .RRE10             1.136    0.113   10.087    0.000
##    .RMA02             1.741    0.175    9.935    0.000
##    .RMA03             1.499    0.156    9.594    0.000
##    .RMA04             0.857    0.098    8.785    0.000
##    .RMA05             0.903    0.101    8.983    0.000
##    .RMA06             1.626    0.158   10.280    0.000
##    .RMA07             0.844    0.094    8.979    0.000
##    .RMA08             0.882    0.098    9.031    0.000
##    .RMA09             1.090    0.115    9.498    0.000
##    .RMA10             1.257    0.131    9.592    0.000
##    .RCO02             0.977    0.104    9.391    0.000
##    .RCO03             0.493    0.058    8.475    0.000
##    .RCO04             0.468    0.052    9.017    0.000
##    .RCO05             0.393    0.046    8.621    0.000
##    .RCO06             0.479    0.054    8.883    0.000
##    .RCO07             0.505    0.056    8.972    0.000
##    .EN01              0.696    0.072    9.660    0.000
##    .EN02              0.443    0.049    9.063    0.000
##    .EN04              0.473    0.051    9.236    0.000
##    .EN05              0.378    0.042    8.907    0.000
##    .EN06              0.366    0.041    8.899    0.000
##    .EN07              0.507    0.055    9.209    0.000
##    .EN08              0.353    0.041    8.658    0.000
##    .EVI01             0.199    0.039    5.056    0.000
##    .EVI02             0.224    0.040    5.637    0.000
##    .EVI03             1.211    0.124    9.770    0.000
##    .EDE01             0.352    0.064    5.529    0.000
##    .EDE02             0.509    0.067    7.646    0.000
##    .EDE03             0.874    0.088    9.945    0.000
##    .EAB01             0.379    0.128    2.953    0.003
##    .EAB02             1.149    0.121    9.491    0.000
##    .desapego          0.953    0.149    6.397    0.000
##    .relajación        0.514    0.085    6.027    0.000
##    .dominio           1.191    0.200    5.956    0.000
##    .control           0.693    0.125    5.534    0.000
##     recuperación      0.972    0.199    4.892    0.000
##     energia           2.816    0.327    8.605    0.000
##    .vigor             0.536    0.084    6.413    0.000
##    .dedicacion        0.099    0.087    1.131    0.258
##    .absorcion         0.469    0.138    3.392    0.001
##     engagement        2.300    0.284    8.099    0.000
lavaanPlot(fit3, coef = TRUE, cov = TRUE)