Ecuaciones Estructurales (Análisis y Resultados)

En R existen diversos paquetes para análisis de ecuaciones estructurales. Los más conocidos son “SEM” (Fox 2006, 2010), “OpenMx” (Bates, Mehta y Fox, 2011) y “lavaan” (Rosseel 2011, 2012a, 2012b). Aunque aún está en fase de desarrollo, “lavaan” permite escribir los modelos de medida y estructurales más sencillamente que los otros dos paquetes, y permite realizar análisis relativamente complejos, como el análisis de grupos de ecuaciones estructurales, o el uso de métodos de estimación alternativos al de máxima verosimilitud. En este documento se utilizará un modelo de análisis factorial confirmatorio obtenido a partir de nueve de las 26 variables de HolzingerSwineford1939, un conjunto de datos disponible en R y que se usa frecuentemente en documentos sobre ecuaciones estructurales.

library("MBESS")
library("lavaan")
## This is lavaan 0.6-7
## lavaan is BETA software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:MBESS':
## 
##     cor2cov
data('HS')
hs2<-HS
hs3<-hs2[1:40,1:24]
hs3
##    id    sex grade age month_since_birthday age_months age_years  school
## 1   1   Male     7  13                    1        157   13.0833 Pasteur
## 2   2 Female     7  13                    7        163   13.5833 Pasteur
## 3   3 Female     7  13                    1        157   13.0833 Pasteur
## 4   4   Male     7  13                    2        158   13.1667 Pasteur
## 5   5 Female     7  12                    2        146   12.1667 Pasteur
## 6   6 Female     7  14                    1        169   14.0833 Pasteur
## 7   7   Male     7  12                    1        145   12.0833 Pasteur
## 8   8 Female     7  12                    2        146   12.1667 Pasteur
## 9   9 Female     7  13                    0        156   13.0000 Pasteur
## 10 11 Female     7  12                    5        149   12.4167 Pasteur
## 11 12   Male     7  12                    2        146   12.1667 Pasteur
## 12 13   Male     7  12                   11        155   12.9167 Pasteur
## 13 14 Female     7  12                    7        151   12.5833 Pasteur
## 14 15 Female     7  12                    8        152   12.6667 Pasteur
## 15 16   Male     7  12                    6        150   12.5000 Pasteur
## 16 17 Female     7  12                    1        145   12.0833 Pasteur
## 17 18 Female     7  14                   11        179   14.9167 Pasteur
## 18 19   Male     7  13                    5        161   13.4167 Pasteur
## 19 20 Female     7  12                    8        152   12.6667 Pasteur
## 20 21 Female     7  12                    3        147   12.2500 Pasteur
## 21 22   Male     7  14                   10        178   14.8333 Pasteur
## 22 23   Male     7  12                    9        153   12.7500 Pasteur
## 23 24   Male     7  12                   11        155   12.9167 Pasteur
## 24 25 Female     7  12                    8        152   12.6667 Pasteur
## 25 26   Male     7  12                    3        147   12.2500 Pasteur
## 26 27   Male     7  12                    7        151   12.5833 Pasteur
## 27 28   Male     7  12                    8        152   12.6667 Pasteur
## 28 29 Female     7  13                    2        158   13.1667 Pasteur
## 29 30 Female     7  12                    5        149   12.4167 Pasteur
## 30 31 Female     7  12                    2        146   12.1667 Pasteur
## 31 33 Female     7  12                    7        151   12.5833 Pasteur
## 32 34   Male     7  16                    0        192   16.0000 Pasteur
## 33 35 Female     7  12                    2        146   12.1667 Pasteur
## 34 36 Female     7  12                    3        147   12.2500 Pasteur
## 35 38 Female     7  13                    3        159   13.2500 Pasteur
## 36 39   Male     7  13                   10        166   13.8333 Pasteur
## 37 40   Male     7  12                    9        153   12.7500 Pasteur
## 38 41 Female     7  12                    8        152   12.6667 Pasteur
## 39 42 Female     7  12                    6        150   12.5000 Pasteur
## 40 43   Male     7  12                    5        149   12.4167 Pasteur
##    t1_visual_perception t2_cubes t3_paper_form_board t4_lozenges
## 1                    20       31                  12           3
## 2                    32       21                  12          17
## 3                    27       21                  12          15
## 4                    32       31                  16          24
## 5                    29       19                  12           7
## 6                    32       20                  11          18
## 7                    17       24                  12           8
## 8                    34       25                  13          15
## 9                    27       23                  11          12
## 10                   21       21                  10           6
## 11                   22       23                  13          16
## 12                   35       24                  15          23
## 13                   34       18                  15          33
## 14                   36       22                  16          14
## 15                   35       23                  13          29
## 16                   28       19                  13          19
## 17                   26       19                  18          12
## 18                   30       27                  17          18
## 19                   34       21                  14          32
## 20                   38       35                  13          24
## 21                   35       32                  17          16
## 22                   40       34                  16          33
## 23                   30       25                  16          15
## 24                   23       22                  15          13
## 25                   34       22                  12          10
## 26                   32       16                  16          27
## 27                   33       21                  16          36
## 28                   36       20                  18          17
## 29                   28       24                  14          34
## 30                   30       18                  13           6
## 31                   21       23                  14          11
## 32                   18       24                  17           2
## 33                   30       21                  12          14
## 34                   25       24                  12          19
## 35                   20       15                  13          12
## 36                   29       21                  14           4
## 37                   33       28                  15          28
## 38                   23       18                  12          18
## 39                   38       16                   9          31
## 40                   35       31                  19          20
##    t5_general_information t6_paragraph_comprehension t7_sentence
## 1                      40                          7          23
## 2                      34                          5          12
## 3                      20                          3           7
## 4                      42                          8          18
## 5                      37                          8          16
## 6                      31                          3          12
## 7                      40                         10          24
## 8                      29                         11          17
## 9                      29                          8          23
## 10                     33                          8          20
## 11                     38                          6          14
## 12                     33                          8          18
## 13                     33                          8          16
## 14                     32                         14          16
## 15                     54                         15          22
## 16                     27                          8          17
## 17                     35                          6          16
## 18                     25                          6          10
## 19                     62                         13          21
## 20                     41                         11          15
## 21                     22                          5          10
## 22                     24                          6          13
## 23                     37                         10          23
## 24                     35                          8          12
## 25                     45                          7          15
## 26                     46                          5          14
## 27                     18                          8           9
## 28                     27                          5          12
## 29                     31                          6          12
## 30                     30                          8          13
## 31                     29                          6          14
## 32                     29                          5          12
## 33                     52                          8          21
## 34                     44                         10          17
## 35                     30                          4          12
## 36                     32                          5          19
## 37                     34                          8          16
## 38                     35                          9          12
## 39                     47                         12          21
## 40                     58                          9          21
##    t8_word_classification t9_word_meaning t10_addition t11_code
## 1                      22               9           78       74
## 2                      22               9           87       84
## 3                      12               3           75       49
## 4                      21              17           69       65
## 5                      25              18           85       63
## 6                      25               6          100       92
## 7                      32              20          108       65
## 8                      25               9           78       80
## 9                      19              19          104       52
## 10                     25              18           95       74
## 11                     22              11           86       60
## 12                     27              19           85       71
## 13                     31              16          135       68
## 14                     25              11          118       68
## 15                     27              21           92       64
## 16                     18               5           94       59
## 17                     24               9           85       58
## 18                     17              12           92       61
## 19                     34              26           90       94
## 20                     24              18           80       62
## 21                     20               4           60       44
## 22                     18              15          103       73
## 23                     25              22           80       62
## 24                     22               7          134       64
## 25                     27               9          108       60
## 26                     26              10          132       67
## 27                     20               5           95       67
## 28                     22               8           65       56
## 29                     21              14          118       90
## 30                     18              13          107       65
## 31                     23              13          111       60
## 32                     18               7           47       31
## 33                     32              14           62       64
## 34                     25              13          124       86
## 35                     16               6           64       64
## 36                     23              10           72       42
## 37                     25              14           88       65
## 38                     24              12           94       50
## 39                     31              23          127       83
## 40                     28              22           74       69
##    t12_counting_groups_of_dots t13_straight_and_curved_capitals
## 1                          115                              229
## 2                          125                              285
## 3                           78                              159
## 4                          106                              175
## 5                          126                              213
## 6                          133                              270
## 7                          124                              175
## 8                          103                              132
## 9                           93                              265
## 10                          91                              157
## 11                         114                              155
## 12                         103                              149
## 13                         104                              211
## 14                          94                              160
## 15                          87                              211
## 16                          76                              185
## 17                         133                              189
## 18                         105                              196
## 19                          97                              207
## 20                         107                              177
## 21                          92                              194
## 22                         109                              252
## 23                          92                              180
## 24                         106                              244
## 25                          92                              149
## 26                         125                              156
## 27                         102                              163
## 28                         111                              159
## 29                         117                              310
## 30                          97                              196
## 31                         139                              215
## 32                          73                              121
## 33                          86                              173
## 34                          87                              203
## 35                         104                              174
## 36                          75                              177
## 37                          80                              191
## 38                          70                              183
## 39                         109                              184
## 40                          90                              176
##    t14_word_recognition t15_number_recognition t16_figure_recognition
## 1                   170                     86                     96
## 2                   184                     85                    100
## 3                   170                     85                     95
## 4                   181                     80                     91
## 5                   187                     99                    104
## 6                   164                     84                    104
## 7                   121                     71                     78
## 8                   184                     95                    106
## 9                   184                     91                    105
## 10                  175                     92                    100
## 11                  173                     86                    107
## 12                  167                    103                    108
## 13                  166                     92                    103
## 14                  186                     86                    102
## 15                  168                     84                    102
## 16                  181                     79                     99
## 17                  164                     84                    100
## 18                  149                     88                     98
## 19                  171                     74                    107
## 20                  186                     99                    105
## 21                  169                     96                     96
## 22                  169                     94                    105
## 23                  166                     83                    101
## 24                  173                     96                     99
## 25                  154                     92                    106
## 26                  175                    103                    110
## 27                  190                     97                    106
## 28                  172                     97                     98
## 29                  196                     94                    101
## 30                  192                     83                    109
## 31                  163                     88                    101
## 32                  159                     84                     92
## 33                  173                     95                    101
## 34                  182                     92                     96
## 35                  181                     90                     87
## 36                  176                     87                     87
## 37                  173                     78                     89
## 38                  154                     96                     87
## 39                  173                     96                    105
## 40                  172                     79                    105

Valores Faltantes por columna

##                               id                              sex 
##                                0                                0 
##                            grade                              age 
##                                0                                0 
##             month_since_birthday                       age_months 
##                                0                                0 
##                        age_years                           school 
##                                0                                0 
##             t1_visual_perception                         t2_cubes 
##                                0                                0 
##              t3_paper_form_board                      t4_lozenges 
##                                0                                0 
##           t5_general_information       t6_paragraph_comprehension 
##                                0                                0 
##                      t7_sentence           t8_word_classification 
##                                0                                0 
##                  t9_word_meaning                     t10_addition 
##                                0                                0 
##                         t11_code      t12_counting_groups_of_dots 
##                                0                                0 
## t13_straight_and_curved_capitals             t14_word_recognition 
##                                0                                0 
##           t15_number_recognition           t16_figure_recognition 
##                                0                                0

Ejemplo Ecuaciones Estructurales

Modelo <- ’ visual =~ t1_visual_perception + t2_cubes + t3_paper_form_board textual =~ t4_lozenges +t5_general_information + t6_paragraph_comprehension speed =~ t11_code + t12_counting_groups_of_dots + t13_straight_and_curved_capitals’

Las variables t1, t2 y t3 miden el factor representado por la variable latente visual. Las variables t4, t5 y t6 miden el factor textual. Las variables t11, t12 y t13 miden el factor speed.

## Warning in lav_object_post_check(object): lavaan WARNING: some estimated ov
## variances are negative
## lavaan 0.6-7 ended normally after 156 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         13
##                                                       
##   Number of observations                            40
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                18.294
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.019
## lavaan 0.6-7 ended normally after 156 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of free parameters                         13
##                                                       
##   Number of observations                            40
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                18.294
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.019
## 
## Model Test Baseline Model:
## 
##   Test statistic                                47.675
##   Degrees of freedom                                15
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.685
##   Tucker-Lewis Index (TLI)                       0.409
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)               -712.925
##   Loglikelihood unrestricted model (H1)       -703.777
##                                                       
##   Akaike (AIC)                                1451.849
##   Bayesian (BIC)                              1473.805
##   Sample-size adjusted Bayesian (BIC)         1433.124
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.179
##   90 Percent confidence interval - lower         0.069
##   90 Percent confidence interval - upper         0.289
##   P-value RMSEA <= 0.05                          0.034
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.130
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   visual =~                                           
##     t1_visl_prcptn    1.000                           
##     t2_cubes          0.173    0.162    1.071    0.284
##     t3_ppr_frm_brd    0.088    0.079    1.103    0.270
##   textual =~                                          
##     t4_lozenges       1.000                           
##     t5_gnrl_nfrmtn    0.346    0.259    1.337    0.181
##     t6_prgrph_cmpr    0.157    0.076    2.072    0.038
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   visual ~~                                           
##     textual          32.310    9.899    3.264    0.001
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .t1_visl_prcptn   -2.004   22.584   -0.089    0.929
##    .t2_cubes         22.042    4.968    4.437    0.000
##    .t3_ppr_frm_brd    5.064    1.144    4.427    0.000
##    .t4_lozenges      34.123   19.729    1.730    0.084
##    .t5_gnrl_nfrmtn   88.863   20.275    4.383    0.000
##    .t6_prgrph_cmpr    6.347    1.508    4.210    0.000
##     visual           36.901   23.886    1.545    0.122
##     textual          48.351   24.757    1.953    0.051
##                           lhs op                        rhs    est     se
## 1                      visual =~       t1_visual_perception  1.000  0.000
## 2                      visual =~                   t2_cubes  0.173  0.162
## 3                      visual =~        t3_paper_form_board  0.088  0.079
## 4                     textual =~                t4_lozenges  1.000  0.000
## 5                     textual =~     t5_general_information  0.346  0.259
## 6                     textual =~ t6_paragraph_comprehension  0.157  0.076
## 7        t1_visual_perception ~~       t1_visual_perception -2.004 22.584
## 8                    t2_cubes ~~                   t2_cubes 22.042  4.968
## 9         t3_paper_form_board ~~        t3_paper_form_board  5.064  1.144
## 10                t4_lozenges ~~                t4_lozenges 34.123 19.729
## 11     t5_general_information ~~     t5_general_information 88.863 20.275
## 12 t6_paragraph_comprehension ~~ t6_paragraph_comprehension  6.347  1.508
## 13                     visual ~~                     visual 36.901 23.886
## 14                    textual ~~                    textual 48.351 24.757
## 15                     visual ~~                    textual 32.310  9.899
##         z pvalue ci.lower ci.upper
## 1      NA     NA    1.000    1.000
## 2   1.071  0.284   -0.143    0.490
## 3   1.103  0.270   -0.068    0.243
## 4      NA     NA    1.000    1.000
## 5   1.337  0.181   -0.161    0.853
## 6   2.072  0.038    0.009    0.305
## 7  -0.089  0.929  -46.268   42.260
## 8   4.437  0.000   12.305   31.780
## 9   4.427  0.000    2.822    7.306
## 10  1.730  0.084   -4.545   72.792
## 11  4.383  0.000   49.124  128.601
## 12  4.210  0.000    3.392    9.302
## 13  1.545  0.122   -9.914   83.716
## 14  1.953  0.051   -0.171   96.873
## 15  3.264  0.001   12.908   51.712

Bondad de ajuste

Graficas

IMPORTANTE:

Lo que acabas de ver es una simulación respecto al análisis de SEM y una breve reseña.

Para conocer mas detalles visita los siguientes sitios:

EN RPUBS==>RPUBS.COM/ESTATING

VISITA LO QUE HAGO EN WEB: ESTATING.NEGOCIO.SITE

CHILE

Maqueta: Ecuaciones Estructurales (Análisis y Resultados)