Más aplicaciones estadísticas en:

Definición.

El análisis de ecuaciones estructurales es una técnica multivariada utilizada en la evaluación de modelos que presentan relaciones entre variables. También es la técnica a utilizar cuando los modelos incluyen variables latentes, medidas a partir de dos o más variables observables.Un caso particular especialmente relevante de ecuaciones estructurales es el análisis factorial confirmatorio, utilizado para evaluar la validez de constructo de escalas de medida.

Los modelos de ecuaciones estructurales permiten evaluar si un modelo que expresa una determinada relación entre las variables observables se ajusta a los datos muestrales. La evaluación de un modelo requiere una primera fase de especificación de tal modelo, seguida de las fases de identificación y de estimación. En la fase de especificación se definen las relaciones a evaluar entre variables. .

Datos utilizados.

Se utilizan los datos de Holzinger y Swineford (1939) consiste en puntuaciones de pruebas de capacidad mental de niños de séptimo y octavo grado de dos escuelas diferentes, tomados del paquete levaan.

Solamente se utilizan las variables.

x1: Visual perception

x2: Cubes

x3: Lozenges

x4: Paragraph comprehension

x5: Sentence completion

x6: Word meaning

x7: Speeded addition

x8: Speeded counting of dots

x9: Speeded discrimination straight and curved capitals

dato<-data.frame(x1,x2,x3,x4,x5,x6,x7,x8,x9)
head(dato)
##         x1   x2    x3       x4   x5        x6       x7   x8       x9
## 1 3.333333 7.75 0.375 2.333333 5.75 1.2857143 3.391304 5.75 6.361111
## 2 5.333333 5.25 2.125 1.666667 3.00 1.2857143 3.782609 6.25 7.916667
## 3 4.500000 5.25 1.875 1.000000 1.75 0.4285714 3.260870 3.90 4.416667
## 4 5.333333 7.75 3.000 2.666667 4.50 2.4285714 3.000000 5.30 4.861111
## 5 4.833333 4.75 0.875 2.666667 4.00 2.5714286 3.695652 6.30 5.916667
## 6 5.333333 5.00 2.250 1.000000 3.00 0.8571429 4.347826 6.65 7.500000

El modelo de ecuaciones estructurales.

modelo5 <-" visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 "
modelo6<-sem(model= modelo5,
              data= dato)
summary(modelo6, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6.16 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
## 
## Model Test Baseline Model:
## 
##   Test statistic                               918.852
##   Degrees of freedom                                36
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.931
##   Tucker-Lewis Index (TLI)                       0.896
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3737.745
##   Loglikelihood unrestricted model (H1)      -3695.092
##                                                       
##   Akaike (AIC)                                7517.490
##   Bayesian (BIC)                              7595.339
##   Sample-size adjusted Bayesian (SABIC)       7528.739
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.092
##   90 Percent confidence interval - lower         0.071
##   90 Percent confidence interval - upper         0.114
##   P-value H_0: RMSEA <= 0.050                    0.001
##   P-value H_0: RMSEA >= 0.080                    0.840
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.065
## 
## 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
##   visual =~                                                             
##     x1                1.000                               0.900    0.772
##     x2                0.554    0.100    5.554    0.000    0.498    0.424
##     x3                0.729    0.109    6.685    0.000    0.656    0.581
##   textual =~                                                            
##     x4                1.000                               0.990    0.852
##     x5                1.113    0.065   17.014    0.000    1.102    0.855
##     x6                0.926    0.055   16.703    0.000    0.917    0.838
##   speed =~                                                              
##     x7                1.000                               0.619    0.570
##     x8                1.180    0.165    7.152    0.000    0.731    0.723
##     x9                1.082    0.151    7.155    0.000    0.670    0.665
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.408    0.074    5.552    0.000    0.459    0.459
##     speed             0.262    0.056    4.660    0.000    0.471    0.471
##   textual ~~                                                            
##     speed             0.173    0.049    3.518    0.000    0.283    0.283
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.549    0.114    4.833    0.000    0.549    0.404
##    .x2                1.134    0.102   11.146    0.000    1.134    0.821
##    .x3                0.844    0.091    9.317    0.000    0.844    0.662
##    .x4                0.371    0.048    7.779    0.000    0.371    0.275
##    .x5                0.446    0.058    7.642    0.000    0.446    0.269
##    .x6                0.356    0.043    8.277    0.000    0.356    0.298
##    .x7                0.799    0.081    9.823    0.000    0.799    0.676
##    .x8                0.488    0.074    6.573    0.000    0.488    0.477
##    .x9                0.566    0.071    8.003    0.000    0.566    0.558
##     visual            0.809    0.145    5.564    0.000    1.000    1.000
##     textual           0.979    0.112    8.737    0.000    1.000    1.000
##     speed             0.384    0.086    4.451    0.000    1.000    1.000
summary(modelo6,rsquare=TRUE,fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6.16 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
## 
## Model Test Baseline Model:
## 
##   Test statistic                               918.852
##   Degrees of freedom                                36
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.931
##   Tucker-Lewis Index (TLI)                       0.896
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3737.745
##   Loglikelihood unrestricted model (H1)      -3695.092
##                                                       
##   Akaike (AIC)                                7517.490
##   Bayesian (BIC)                              7595.339
##   Sample-size adjusted Bayesian (SABIC)       7528.739
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.092
##   90 Percent confidence interval - lower         0.071
##   90 Percent confidence interval - upper         0.114
##   P-value H_0: RMSEA <= 0.050                    0.001
##   P-value H_0: RMSEA >= 0.080                    0.840
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.065
## 
## 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
##   visual =~                                                             
##     x1                1.000                               0.900    0.772
##     x2                0.554    0.100    5.554    0.000    0.498    0.424
##     x3                0.729    0.109    6.685    0.000    0.656    0.581
##   textual =~                                                            
##     x4                1.000                               0.990    0.852
##     x5                1.113    0.065   17.014    0.000    1.102    0.855
##     x6                0.926    0.055   16.703    0.000    0.917    0.838
##   speed =~                                                              
##     x7                1.000                               0.619    0.570
##     x8                1.180    0.165    7.152    0.000    0.731    0.723
##     x9                1.082    0.151    7.155    0.000    0.670    0.665
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   visual ~~                                                             
##     textual           0.408    0.074    5.552    0.000    0.459    0.459
##     speed             0.262    0.056    4.660    0.000    0.471    0.471
##   textual ~~                                                            
##     speed             0.173    0.049    3.518    0.000    0.283    0.283
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .x1                0.549    0.114    4.833    0.000    0.549    0.404
##    .x2                1.134    0.102   11.146    0.000    1.134    0.821
##    .x3                0.844    0.091    9.317    0.000    0.844    0.662
##    .x4                0.371    0.048    7.779    0.000    0.371    0.275
##    .x5                0.446    0.058    7.642    0.000    0.446    0.269
##    .x6                0.356    0.043    8.277    0.000    0.356    0.298
##    .x7                0.799    0.081    9.823    0.000    0.799    0.676
##    .x8                0.488    0.074    6.573    0.000    0.488    0.477
##    .x9                0.566    0.071    8.003    0.000    0.566    0.558
##     visual            0.809    0.145    5.564    0.000    1.000    1.000
##     textual           0.979    0.112    8.737    0.000    1.000    1.000
##     speed             0.384    0.086    4.451    0.000    1.000    1.000
## 
## R-Square:
##                    Estimate
##     x1                0.596
##     x2                0.179
##     x3                0.338
##     x4                0.725
##     x5                0.731
##     x6                0.702
##     x7                0.324
##     x8                0.523
##     x9                0.442
inspect(modelo6, what = "std")
## $lambda
##    visual textul speed
## x1  0.772  0.000 0.000
## x2  0.424  0.000 0.000
## x3  0.581  0.000 0.000
## x4  0.000  0.852 0.000
## x5  0.000  0.855 0.000
## x6  0.000  0.838 0.000
## x7  0.000  0.000 0.570
## x8  0.000  0.000 0.723
## x9  0.000  0.000 0.665
## 
## $theta
##       x1    x2    x3    x4    x5    x6    x7    x8    x9
## x1 0.404                                                
## x2 0.000 0.821                                          
## x3 0.000 0.000 0.662                                    
## x4 0.000 0.000 0.000 0.275                              
## x5 0.000 0.000 0.000 0.000 0.269                        
## x6 0.000 0.000 0.000 0.000 0.000 0.298                  
## x7 0.000 0.000 0.000 0.000 0.000 0.000 0.676            
## x8 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.477      
## x9 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.558
## 
## $psi
##         visual textul speed
## visual   1.000             
## textual  0.459  1.000      
## speed    0.471  0.283 1.000
fitMeasures(modelo6)
##                  npar                  fmin                 chisq 
##                21.000                 0.142                85.306 
##                    df                pvalue        baseline.chisq 
##                24.000                 0.000               918.852 
##           baseline.df       baseline.pvalue                   cfi 
##                36.000                 0.000                 0.931 
##                   tli                  nnfi                   rfi 
##                 0.896                 0.896                 0.861 
##                   nfi                  pnfi                   ifi 
##                 0.907                 0.605                 0.931 
##                   rni                  logl     unrestricted.logl 
##                 0.931             -3737.745             -3695.092 
##                   aic                   bic                ntotal 
##              7517.490              7595.339               301.000 
##                  bic2                 rmsea        rmsea.ci.lower 
##              7528.739                 0.092                 0.071 
##        rmsea.ci.upper        rmsea.ci.level          rmsea.pvalue 
##                 0.114                 0.900                 0.001 
##        rmsea.close.h0 rmsea.notclose.pvalue     rmsea.notclose.h0 
##                 0.050                 0.840                 0.080 
##                   rmr            rmr_nomean                  srmr 
##                 0.082                 0.082                 0.065 
##          srmr_bentler   srmr_bentler_nomean                  crmr 
##                 0.065                 0.065                 0.073 
##           crmr_nomean            srmr_mplus     srmr_mplus_nomean 
##                 0.073                 0.065                 0.065 
##                 cn_05                 cn_01                   gfi 
##               129.490               152.654                 0.943 
##                  agfi                  pgfi                   mfi 
##                 0.894                 0.503                 0.903 
##                  ecvi 
##                 0.423
fitMeasures( modelo6, c( "rmr","rmsea","gfi","agfi", "nfi","cfi" ) )
##   rmr rmsea   gfi  agfi   nfi   cfi 
## 0.082 0.092 0.943 0.894 0.907 0.931
param<- parameterestimates(modelo6, standardized=TRUE );param
##        lhs op     rhs   est    se      z pvalue ci.lower ci.upper std.lv
## 1   visual =~      x1 1.000 0.000     NA     NA    1.000    1.000  0.900
## 2   visual =~      x2 0.554 0.100  5.554      0    0.358    0.749  0.498
## 3   visual =~      x3 0.729 0.109  6.685      0    0.516    0.943  0.656
## 4  textual =~      x4 1.000 0.000     NA     NA    1.000    1.000  0.990
## 5  textual =~      x5 1.113 0.065 17.014      0    0.985    1.241  1.102
## 6  textual =~      x6 0.926 0.055 16.703      0    0.817    1.035  0.917
## 7    speed =~      x7 1.000 0.000     NA     NA    1.000    1.000  0.619
## 8    speed =~      x8 1.180 0.165  7.152      0    0.857    1.503  0.731
## 9    speed =~      x9 1.082 0.151  7.155      0    0.785    1.378  0.670
## 10      x1 ~~      x1 0.549 0.114  4.833      0    0.326    0.772  0.549
## 11      x2 ~~      x2 1.134 0.102 11.146      0    0.934    1.333  1.134
## 12      x3 ~~      x3 0.844 0.091  9.317      0    0.667    1.022  0.844
## 13      x4 ~~      x4 0.371 0.048  7.779      0    0.278    0.465  0.371
## 14      x5 ~~      x5 0.446 0.058  7.642      0    0.332    0.561  0.446
## 15      x6 ~~      x6 0.356 0.043  8.277      0    0.272    0.441  0.356
## 16      x7 ~~      x7 0.799 0.081  9.823      0    0.640    0.959  0.799
## 17      x8 ~~      x8 0.488 0.074  6.573      0    0.342    0.633  0.488
## 18      x9 ~~      x9 0.566 0.071  8.003      0    0.427    0.705  0.566
## 19  visual ~~  visual 0.809 0.145  5.564      0    0.524    1.094  1.000
## 20 textual ~~ textual 0.979 0.112  8.737      0    0.760    1.199  1.000
## 21   speed ~~   speed 0.384 0.086  4.451      0    0.215    0.553  1.000
## 22  visual ~~ textual 0.408 0.074  5.552      0    0.264    0.552  0.459
## 23  visual ~~   speed 0.262 0.056  4.660      0    0.152    0.373  0.471
## 24 textual ~~   speed 0.173 0.049  3.518      0    0.077    0.270  0.283
##    std.all std.nox
## 1    0.772   0.772
## 2    0.424   0.424
## 3    0.581   0.581
## 4    0.852   0.852
## 5    0.855   0.855
## 6    0.838   0.838
## 7    0.570   0.570
## 8    0.723   0.723
## 9    0.665   0.665
## 10   0.404   0.404
## 11   0.821   0.821
## 12   0.662   0.662
## 13   0.275   0.275
## 14   0.269   0.269
## 15   0.298   0.298
## 16   0.676   0.676
## 17   0.477   0.477
## 18   0.558   0.558
## 19   1.000   1.000
## 20   1.000   1.000
## 21   1.000   1.000
## 22   0.459   0.459
## 23   0.471   0.471
## 24   0.283   0.283
semPaths(modelo6, intAtSide=TRUE)

semPaths(modelo6,"std","hide", intAtSide=TRUE)

semPaths(modelo6,'std', 'est', curveAdjacent = TRUE, style = "lisrel")

-|—|—|

O.M.F.

-|—|—|

paquetes utilizados:

polycor, ggcorrplot

GPArotation, lavaan

tidyverse,semTools

semPlot,psych

MVN

diagram

lavaanPlot

piecewiseSEM

corrr

corrplot