# Actividad 3. 

# Alhelí Acosta de la Rosa // A01382195
# Ana Gabriela Sánchez Ruiz // A00828813
# Andrea Natalia Padilla Cedeño // A01197560
# Litzy Duque González // A01382189
# Rodrigo Gutiérrez Del Bosque //  A01382212


 
library(lavaan)
## This is lavaan 0.6-14
## lavaan is FREE software! Please report any bugs.
library(lavaanPlot)
# lavaan = Latent Variable Analysis

# Importar la base de datos
bd <- read.csv("C:/Users/andre/Desktop/Generación de escenarios/Estadística multivariante/Datos_SEM_Eng.csv")
# Entender la base de datos
summary(bd)
##        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
# Tipos de fórmula
# Regresión  ~
# Definición de variable latente =~
# Varianzas y covarianzas ~~
# Intercepto ~1

# Estructura del modelo


## Parte 1

model_p1 <-  "
  desapego =~ RPD02 + RPD03 + RPD05 + RPD06 + RPD07 + RPD08 + RPD09 + RPD10
  relajacion =~ RRE02 + RRE03 + RRE04 + RRE05 + RRE06 + RRE07 + RRE10
  maestria =~ RMA03 + RMA04 + RMA05 + RMA07 + RMA08 + RMA09 + RMA10
  control =~ RCO02 + RCO03 + RCO04 + RCO05 + RCO06 + RCO07
  
  # Second order factor life_satisfaction
  recuperacion =~ desapego + relajacion + maestria + control
  "

fit <- cfa(model_p1, bd)
summary(fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6.14 ended normally after 45 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        60
## 
##   Number of observations                           223
## 
## Model Test User Model:
##                                                       
##   Test statistic                               970.578
##   Degrees of freedom                               346
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              6830.254
##   Degrees of freedom                               378
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.903
##   Tucker-Lewis Index (TLI)                       0.894
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -9515.025
##   Loglikelihood unrestricted model (H1)      -9029.736
##                                                       
##   Akaike (AIC)                               19150.050
##   Bayesian (BIC)                             19354.480
##   Sample-size adjusted Bayesian (SABIC)      19164.333
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.090
##   90 Percent confidence interval - lower         0.083
##   90 Percent confidence interval - upper         0.097
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.993
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.060
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   desapego =~                                                           
##     RPD02             1.000                               1.648    0.846
##     RPD03             0.947    0.066   14.366    0.000    1.561    0.785
##     RPD05             1.096    0.064   17.123    0.000    1.806    0.872
##     RPD06             0.927    0.068   13.543    0.000    1.528    0.756
##     RPD07             1.027    0.064   15.996    0.000    1.693    0.839
##     RPD08             0.993    0.066   15.149    0.000    1.635    0.812
##     RPD09             1.119    0.064   17.494    0.000    1.843    0.882
##     RPD10             1.141    0.065   17.579    0.000    1.879    0.885
##   relajacion =~                                                         
##     RRE02             1.000                               1.274    0.849
##     RRE03             1.120    0.065   17.221    0.000    1.426    0.870
##     RRE04             1.025    0.058   17.709    0.000    1.306    0.883
##     RRE05             1.055    0.056   18.761    0.000    1.344    0.910
##     RRE06             1.245    0.074   16.862    0.000    1.586    0.860
##     RRE07             1.117    0.071   15.690    0.000    1.423    0.825
##     RRE10             0.815    0.067   12.123    0.000    1.038    0.698
##   maestria =~                                                           
##     RMA03             1.000                               1.592    0.783
##     RMA04             1.047    0.070   14.949    0.000    1.666    0.878
##     RMA05             1.008    0.069   14.564    0.000    1.605    0.861
##     RMA07             0.975    0.067   14.551    0.000    1.552    0.860
##     RMA08             0.989    0.068   14.644    0.000    1.575    0.864
##     RMA09             0.917    0.067   13.611    0.000    1.460    0.818
##     RMA10             0.928    0.071   13.084    0.000    1.477    0.793
##   control =~                                                            
##     RCO02             1.000                               1.630    0.854
##     RCO03             0.948    0.049   19.172    0.000    1.545    0.912
##     RCO04             0.796    0.044   18.104    0.000    1.297    0.886
##     RCO05             0.818    0.043   18.986    0.000    1.333    0.907
##     RCO06             0.835    0.046   18.213    0.000    1.360    0.889
##     RCO07             0.835    0.046   18.053    0.000    1.361    0.884
##   recuperacion =~                                                       
##     desapego          1.000                               0.717    0.717
##     relajacion        0.963    0.105    9.159    0.000    0.893    0.893
##     maestria          0.797    0.115    6.917    0.000    0.592    0.592
##     control           1.118    0.125    8.950    0.000    0.811    0.811
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .RPD02             1.080    0.116    9.270    0.000    1.080    0.285
##    .RPD03             1.515    0.156    9.738    0.000    1.515    0.383
##    .RPD05             1.030    0.115    8.932    0.000    1.030    0.240
##    .RPD06             1.754    0.178    9.880    0.000    1.754    0.429
##    .RPD07             1.209    0.129    9.345    0.000    1.209    0.297
##    .RPD08             1.386    0.145    9.571    0.000    1.386    0.341
##    .RPD09             0.968    0.111    8.755    0.000    0.968    0.222
##    .RPD10             0.982    0.113    8.710    0.000    0.982    0.218
##    .RRE02             0.626    0.068    9.274    0.000    0.626    0.278
##    .RRE03             0.654    0.073    9.013    0.000    0.654    0.243
##    .RRE04             0.481    0.055    8.794    0.000    0.481    0.220
##    .RRE05             0.374    0.046    8.148    0.000    0.374    0.171
##    .RRE06             0.887    0.097    9.151    0.000    0.887    0.261
##    .RRE07             0.950    0.100    9.504    0.000    0.950    0.319
##    .RRE10             1.136    0.113   10.092    0.000    1.136    0.513
##    .RMA03             1.594    0.166    9.605    0.000    1.594    0.386
##    .RMA04             0.829    0.097    8.534    0.000    0.829    0.230
##    .RMA05             0.902    0.102    8.833    0.000    0.902    0.259
##    .RMA07             0.847    0.096    8.842    0.000    0.847    0.260
##    .RMA08             0.840    0.096    8.776    0.000    0.840    0.253
##    .RMA09             1.056    0.113    9.344    0.000    1.056    0.331
##    .RMA10             1.285    0.135    9.540    0.000    1.285    0.371
##    .RCO02             0.984    0.105    9.380    0.000    0.984    0.270
##    .RCO03             0.485    0.058    8.392    0.000    0.485    0.169
##    .RCO04             0.462    0.052    8.962    0.000    0.462    0.215
##    .RCO05             0.382    0.045    8.510    0.000    0.382    0.177
##    .RCO06             0.493    0.055    8.914    0.000    0.493    0.211
##    .RCO07             0.515    0.057    8.984    0.000    0.515    0.218
##    .desapego          1.319    0.197    6.692    0.000    0.486    0.486
##    .relajacion        0.330    0.089    3.702    0.000    0.203    0.203
##    .maestria          1.646    0.253    6.513    0.000    0.650    0.650
##    .control           0.911    0.160    5.691    0.000    0.343    0.343
##     recuperacion      1.396    0.274    5.093    0.000    1.000    1.000
lavaanPlot(model = fit, coefs = TRUE, covs = TRUE)
## Parte 2

model_p2 <-  "
  energia =~ EN01 + EN02 + EN04 + EN05 + EN06 + EN07 + EN08 
  "

fit2 <- cfa(model_p2, bd)
summary(fit2, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6.14 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
## 
## Model Test Baseline Model:
## 
##   Test statistic                              2324.436
##   Degrees of freedom                                21
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.986
##   Tucker-Lewis Index (TLI)                       0.978
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -2017.154
##   Loglikelihood unrestricted model (H1)      -1993.543
##                                                       
##   Akaike (AIC)                                4062.308
##   Bayesian (BIC)                              4110.008
##   Sample-size adjusted Bayesian (SABIC)       4065.641
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.103
##   90 Percent confidence interval - lower         0.072
##   90 Percent confidence interval - upper         0.136
##   P-value H_0: RMSEA <= 0.050                    0.004
##   P-value H_0: RMSEA >= 0.080                    0.892
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.012
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   energia =~                                                            
##     EN01              1.000                               1.674    0.893
##     EN02              1.029    0.044   23.192    0.000    1.723    0.933
##     EN04              0.999    0.044   22.583    0.000    1.672    0.924
##     EN05              0.999    0.042   23.649    0.000    1.672    0.939
##     EN06              0.986    0.042   23.722    0.000    1.651    0.940
##     EN07              1.049    0.046   22.856    0.000    1.755    0.928
##     EN08              1.036    0.043   24.173    0.000    1.734    0.946
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .EN01              0.711    0.074    9.651    0.000    0.711    0.202
##    .EN02              0.444    0.049    9.012    0.000    0.444    0.130
##    .EN04              0.481    0.052    9.214    0.000    0.481    0.147
##    .EN05              0.375    0.042    8.830    0.000    0.375    0.118
##    .EN06              0.359    0.041    8.798    0.000    0.359    0.116
##    .EN07              0.499    0.055    9.129    0.000    0.499    0.139
##    .EN08              0.353    0.041    8.580    0.000    0.353    0.105
##     energia           2.801    0.327    8.565    0.000    1.000    1.000
lavaanPlot(model = fit2, coefs = TRUE, covs = TRUE)
# EN 


# Parte 3

model_p3 <- "
  
  # Engagement
  
  vigor =~ EVI01 + EVI02 + EVI03
  dedicacion =~ EDE01 + EDE02 + EDE03
  absorcion =~ EAB01 + EAB02
  
  engagement =~ vigor + dedicacion + absorcion
  
  # Recuperación 
  desapego =~ RPD02 + RPD03 + RPD05 + RPD06 + RPD07 + RPD08 + RPD09 + RPD10
  relajacion =~ RRE02 + RRE03 + RRE04 + RRE05 + RRE06 + RRE07 + RRE10
  maestria =~ RMA03 + RMA04 + RMA05 + RMA07 + RMA08 + RMA09 + RMA10
  control =~ RCO02 + RCO03 + RCO04 + RCO05 + RCO06 + RCO07
  
  recuperacion =~ desapego + relajacion + maestria + control
  
  # Energía
  energia =~ EN01 + EN02 + EN04 + EN05 + EN06 + EN07 + EN08 
  
  #Final
  ambiente =~ engagement + recuperacion + energia


  "

fit3 <- cfa(model_p3, bd)
summary(fit3, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6.14 ended normally after 72 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        96
## 
##   Number of observations                           223
## 
## Model Test User Model:
##                                                       
##   Test statistic                              2077.771
##   Degrees of freedom                               850
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             12369.625
##   Degrees of freedom                               903
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.893
##   Tucker-Lewis Index (TLI)                       0.886
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -13968.683
##   Loglikelihood unrestricted model (H1)     -12929.798
##                                                       
##   Akaike (AIC)                               28129.367
##   Bayesian (BIC)                             28456.455
##   Sample-size adjusted Bayesian (SABIC)      28152.219
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.080
##   90 Percent confidence interval - lower         0.076
##   90 Percent confidence interval - upper         0.085
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.576
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.064
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   vigor =~                                                              
##     EVI01             1.000                               1.684    0.967
##     EVI02             0.985    0.028   35.256    0.000    1.659    0.962
##     EVI03             0.996    0.048   20.569    0.000    1.678    0.836
##   dedicacion =~                                                         
##     EDE01             1.000                               1.871    0.953
##     EDE02             0.905    0.034   26.515    0.000    1.694    0.922
##     EDE03             0.567    0.037   15.448    0.000    1.061    0.750
##   absorcion =~                                                          
##     EAB01             1.000                               1.641    0.936
##     EAB02             0.656    0.053   12.368    0.000    1.077    0.709
##   engagement =~                                                         
##     vigor             1.000                               0.900    0.900
##     dedicacion        1.216    0.061   20.021    0.000    0.986    0.986
##     absorcion         0.984    0.057   17.201    0.000    0.909    0.909
##   desapego =~                                                           
##     RPD02             1.000                               1.654    0.849
##     RPD03             0.946    0.065   14.490    0.000    1.564    0.787
##     RPD05             1.095    0.063   17.339    0.000    1.811    0.874
##     RPD06             0.920    0.068   13.507    0.000    1.521    0.752
##     RPD07             1.025    0.063   16.148    0.000    1.696    0.840
##     RPD08             0.983    0.065   15.096    0.000    1.626    0.807
##     RPD09             1.114    0.063   17.605    0.000    1.842    0.882
##     RPD10             1.134    0.064   17.657    0.000    1.876    0.883
##   relajacion =~                                                         
##     RRE02             1.000                               1.275    0.850
##     RRE03             1.120    0.065   17.289    0.000    1.428    0.871
##     RRE04             1.021    0.058   17.623    0.000    1.301    0.880
##     RRE05             1.051    0.056   18.686    0.000    1.341    0.908
##     RRE06             1.246    0.074   16.921    0.000    1.588    0.861
##     RRE07             1.121    0.071   15.838    0.000    1.430    0.829
##     RRE10             0.815    0.067   12.135    0.000    1.039    0.698
##   maestria =~                                                           
##     RMA03             1.000                               1.587    0.781
##     RMA04             1.049    0.071   14.878    0.000    1.666    0.877
##     RMA05             1.010    0.070   14.491    0.000    1.604    0.860
##     RMA07             0.978    0.067   14.499    0.000    1.552    0.860
##     RMA08             0.993    0.068   14.602    0.000    1.576    0.865
##     RMA09             0.921    0.068   13.582    0.000    1.462    0.819
##     RMA10             0.931    0.071   13.050    0.000    1.477    0.794
##   control =~                                                            
##     RCO02             1.000                               1.632    0.855
##     RCO03             0.945    0.049   19.161    0.000    1.542    0.910
##     RCO04             0.794    0.044   18.094    0.000    1.295    0.884
##     RCO05             0.815    0.043   18.923    0.000    1.329    0.904
##     RCO06             0.837    0.045   18.404    0.000    1.365    0.892
##     RCO07             0.836    0.046   18.201    0.000    1.365    0.887
##   recuperacion =~                                                       
##     desapego          1.000                               0.713    0.713
##     relajacion        0.895    0.097    9.230    0.000    0.827    0.827
##     maestria          0.834    0.115    7.255    0.000    0.620    0.620
##     control           1.189    0.125    9.478    0.000    0.860    0.860
##   energia =~                                                            
##     EN01              1.000                               1.678    0.895
##     EN02              1.027    0.044   23.414    0.000    1.723    0.933
##     EN04              0.998    0.044   22.868    0.000    1.675    0.925
##     EN05              0.996    0.042   23.835    0.000    1.671    0.939
##     EN06              0.983    0.041   23.857    0.000    1.649    0.939
##     EN07              1.045    0.045   22.961    0.000    1.753    0.926
##     EN08              1.033    0.042   24.399    0.000    1.733    0.946
##   ambiente =~                                                           
##     engagement        1.000                               0.678    0.678
##     recuperacion      1.009    0.132    7.622    0.000    0.880    0.880
##     energia           1.530    0.170    8.987    0.000    0.937    0.937
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .EVI01             0.199    0.039    5.056    0.000    0.199    0.066
##    .EVI02             0.224    0.040    5.637    0.000    0.224    0.075
##    .EVI03             1.211    0.124    9.770    0.000    1.211    0.301
##    .EDE01             0.352    0.064    5.530    0.000    0.352    0.091
##    .EDE02             0.509    0.067    7.646    0.000    0.509    0.151
##    .EDE03             0.874    0.088    9.945    0.000    0.874    0.437
##    .EAB01             0.379    0.128    2.952    0.003    0.379    0.123
##    .EAB02             1.149    0.121    9.492    0.000    1.149    0.498
##    .RPD02             1.059    0.115    9.239    0.000    1.059    0.279
##    .RPD03             1.505    0.155    9.731    0.000    1.505    0.381
##    .RPD05             1.011    0.114    8.896    0.000    1.011    0.236
##    .RPD06             1.777    0.180    9.896    0.000    1.777    0.434
##    .RPD07             1.199    0.128    9.334    0.000    1.199    0.294
##    .RPD08             1.415    0.147    9.606    0.000    1.415    0.349
##    .RPD09             0.973    0.111    8.771    0.000    0.973    0.223
##    .RPD10             0.995    0.114    8.745    0.000    0.995    0.220
##    .RRE02             0.624    0.067    9.253    0.000    0.624    0.277
##    .RRE03             0.648    0.072    8.978    0.000    0.648    0.241
##    .RRE04             0.492    0.056    8.829    0.000    0.492    0.225
##    .RRE05             0.384    0.047    8.201    0.000    0.384    0.176
##    .RRE06             0.880    0.097    9.122    0.000    0.880    0.259
##    .RRE07             0.930    0.098    9.459    0.000    0.930    0.313
##    .RRE10             1.136    0.113   10.087    0.000    1.136    0.513
##    .RMA03             1.607    0.167    9.623    0.000    1.607    0.389
##    .RMA04             0.831    0.097    8.550    0.000    0.831    0.230
##    .RMA05             0.905    0.102    8.851    0.000    0.905    0.260
##    .RMA07             0.845    0.096    8.846    0.000    0.845    0.260
##    .RMA08             0.836    0.095    8.772    0.000    0.836    0.252
##    .RMA09             1.051    0.113    9.342    0.000    1.051    0.330
##    .RMA10             1.282    0.134    9.542    0.000    1.282    0.370
##    .RCO02             0.978    0.104    9.392    0.000    0.978    0.269
##    .RCO03             0.493    0.058    8.476    0.000    0.493    0.172
##    .RCO04             0.468    0.052    9.016    0.000    0.468    0.218
##    .RCO05             0.393    0.046    8.618    0.000    0.393    0.182
##    .RCO06             0.479    0.054    8.882    0.000    0.479    0.204
##    .RCO07             0.505    0.056    8.971    0.000    0.505    0.213
##    .EN01              0.696    0.072    9.660    0.000    0.696    0.198
##    .EN02              0.443    0.049    9.063    0.000    0.443    0.130
##    .EN04              0.473    0.051    9.236    0.000    0.473    0.144
##    .EN05              0.377    0.042    8.907    0.000    0.377    0.119
##    .EN06              0.366    0.041    8.898    0.000    0.366    0.119
##    .EN07              0.507    0.055    9.209    0.000    0.507    0.142
##    .EN08              0.353    0.041    8.657    0.000    0.353    0.105
##    .vigor             0.537    0.084    6.415    0.000    0.189    0.189
##    .dedicacion        0.099    0.087    1.128    0.259    0.028    0.028
##    .absorcion         0.469    0.138    3.393    0.001    0.174    0.174
##    .engagement        1.244    0.172    7.218    0.000    0.541    0.541
##    .desapego          1.345    0.193    6.975    0.000    0.492    0.492
##    .relajacion        0.513    0.085    6.006    0.000    0.315    0.315
##    .maestria          1.552    0.239    6.508    0.000    0.616    0.616
##    .control           0.695    0.126    5.530    0.000    0.261    0.261
##    .recuperacion      0.314    0.102    3.078    0.002    0.226    0.226
##    .energia           0.345    0.169    2.044    0.041    0.123    0.123
##     ambiente          1.056    0.217    4.867    0.000    1.000    1.000
lavaanPlot(model = fit3, coefs = TRUE, covs = TRUE)