2  An Introduction to ModSEM

2.1 Why ModSEM

ModSEM is a package which attempts to gather the most common methods for analyzing latent interactions, into a single package in R, whilst being both flexible, and easy to use. With ModSEM you will be able to perform different product indicator based methods for estimating interaction effects, as well as the Latent Moderated Structural Equations Approach (LMS).

In other similar packages are usualy less userfriendly, and not as flexible. The main advantage with ModSEM, is that it functions as an extension to the allready comprehensive lavaan-syntax, allowing you to combine latent interaction with almost every type of SEM-model in Lavaan.

2.2 The Basic Syntax

ModSEM basically introduces two new feature to the lavaan-syntax, 1. The semicolon operator (“:”), and 2. Parceling Functions (see chapter x).

The semicolon operator works the same way as in the lm()-function. In order to specify an interaction effect between two variables, you join them by Var1:Var2,

library(modsem)
m1 <- '
  # Outer Model
  X =~ x1 + x2 +x3
  Y =~ y1 + y2 + y3
  Z =~ z1 + z2 + z3
  
  # Inner model
  Y ~ X + Z + X:Z 
'

est1 <- modsem(m1, oneInt)
summary(est1)
ModSEM: 
Method = rca 
lavaan 0.6.17.1913 ended normally after 198 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        60

  Number of observations                          1000

Model Test User Model:
                                                      
  Test statistic                                46.634
  Degrees of freedom                               111
  P-value (Chi-square)                           1.000

Parameter Estimates:

  Standard errors                             Standard
  Information                                 Expected
  Information saturated (h1) model          Structured

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  X =~                                                
    x1                1.000                           
    x2                0.998    0.036   27.606    0.000
    x3                0.974    0.032   30.727    0.000
  Y =~                                                
    y1                1.000                           
    y2                0.998    0.026   38.147    0.000
    y3                1.008    0.023   43.788    0.000
  Z =~                                                
    z1                1.000                           
    z2                1.037    0.026   39.999    0.000
    z3                1.028    0.024   43.467    0.000
  XZ =~                                               
    x1z1              1.000                           
    x2z1              0.973    0.039   25.157    0.000
    x3z1              0.893    0.033   26.686    0.000
    x1z2              1.061    0.031   33.778    0.000
    x2z2              1.037    0.051   20.421    0.000
    x3z2              0.948    0.043   22.251    0.000
    x1z3              1.028    0.030   34.311    0.000
    x2z3              1.027    0.048   21.462    0.000
    x3z3              0.939    0.041   22.845    0.000

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)
  Y ~                                                 
    X                 0.398    0.038   10.365    0.000
    Z                 0.470    0.039   12.186    0.000
    XZ                0.088    0.019    4.538    0.000

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)
 .x1z1 ~~                                             
   .x2z1              3.096    0.297   10.426    0.000
   .x3z1              2.744    0.259   10.606    0.000
   .x1z2              6.883    0.547   12.577    0.000
   .x1z3              6.327    0.508   12.466    0.000
 .x2z1 ~~                                             
   .x3z1              2.957    0.270   10.960    0.000
   .x2z2              9.379    0.622   15.082    0.000
   .x2z3              9.404    0.605   15.541    0.000
 .x3z1 ~~                                             
   .x3z2              3.783    0.390    9.699    0.000
   .x3z3              3.971    0.383   10.363    0.000
 .x1z2 ~~                                             
   .x2z2              5.238    0.415   12.634    0.000
   .x3z2              4.586    0.346   13.255    0.000
   .x1z3              6.846    0.552   12.400    0.000
 .x2z2 ~~                                             
   .x3z2              5.272    0.381   13.821    0.000
   .x2z3              9.761    0.655   14.914    0.000
 .x3z2 ~~                                             
   .x3z3              3.662    0.395    9.259    0.000
 .x1z3 ~~                                             
   .x2z3              3.692    0.342   10.801    0.000
   .x3z3              3.664    0.300   12.195    0.000
 .x2z3 ~~                                             
   .x3z3              3.007    0.298   10.079    0.000
 .x1z1 ~~                                             
   .x2z2              0.000                           
   .x3z2              0.000                           
   .x2z3              0.000                           
   .x3z3              0.000                           
 .x2z1 ~~                                             
   .x1z2              0.000                           
   .x3z2              0.000                           
   .x1z3              0.000                           
   .x3z3              0.000                           
 .x3z1 ~~                                             
   .x1z2              0.000                           
   .x2z2              0.000                           
   .x1z3              0.000                           
   .x2z3              0.000                           
 .x1z2 ~~                                             
   .x2z3              0.000                           
   .x3z3              0.000                           
 .x2z2 ~~                                             
   .x1z3              0.000                           
   .x3z3              0.000                           
 .x3z2 ~~                                             
   .x1z3              0.000                           
   .x2z3              0.000                           
  X ~~                                                
    Z                -0.094    0.134   -0.700    0.484
    XZ                0.000    0.294    0.000    1.000
  Z ~~                                                
    XZ               -0.000    0.280   -0.000    1.000

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .x1                1.854    0.121   15.340    0.000
   .x2                2.486    0.142   17.504    0.000
   .x3                0.789    0.090    8.781    0.000
   .y1                1.382    0.097   14.234    0.000
   .y2                2.096    0.121   17.377    0.000
   .y3                0.931    0.086   10.805    0.000
   .z1                0.709    0.058   12.302    0.000
   .z2                1.324    0.079   16.758    0.000
   .z3                0.848    0.064   13.347    0.000
   .x1z1             10.295    0.615   16.730    0.000
   .x2z1             13.543    0.698   19.397    0.000
   .x3z1              7.464    0.478   15.618    0.000
   .x1z2             14.386    0.779   18.470    0.000
   .x2z2             19.046    0.912   20.880    0.000
   .x3z2              9.289    0.559   16.611    0.000
   .x1z3             12.003    0.674   17.819    0.000
   .x2z3             15.056    0.786   19.165    0.000
   .x3z3              7.663    0.504   15.216    0.000
    X                 3.989    0.263   15.170    0.000
   .Y                 4.284    0.250   17.146    0.000
    Z                 3.745    0.202   18.496    0.000
    XZ               15.988    1.196   13.371    0.000

2.3 Interactions between two observed variables

ModSEM does not only allow you to estimate interactions between latent variables, but also interactions between observed variables. Here we first run a regression with only observed variables, where there is an interaction between x1 and z2, and then run an equivalent model using modsem().

Regression

reg1 <- lm(y1 ~ x1*z1, oneInt)
summary(reg1)

Call:
lm(formula = y1 ~ x1 * z1, data = oneInt)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.5027 -1.7613 -0.0909  1.5949  8.8495 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  2.96519    0.46182   6.421  2.1e-10 ***
x1           0.02108    0.07934   0.266 0.790516    
z1           0.12449    0.08688   1.433 0.152210    
x1:z1        0.05328    0.01514   3.519 0.000452 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.462 on 996 degrees of freedom
Multiple R-squared:  0.1629,    Adjusted R-squared:  0.1604 
F-statistic:  64.6 on 3 and 996 DF,  p-value: < 2.2e-16

Using modsem() In general, when you have interactions between observed variables it is recommended that you use method = “pind”.

# Here we use "pind" as the method (see chapter 3)
est2 <- modsem('y1 ~ x1 + z1 + x1:z1', data = oneInt, method = "pind")
summary(est2)
ModSEM: 
Method = pind 
lavaan 0.6.17.1913 ended normally after 1 iteration

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                         4

  Number of observations                          1000

Model Test User Model:
                                                      
  Test statistic                                 0.000
  Degrees of freedom                                 0

Parameter Estimates:

  Standard errors                             Standard
  Information                                 Expected
  Information saturated (h1) model          Structured

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)
  y1 ~                                                
    x1                0.021    0.079    0.266    0.790
    z1                0.124    0.087    1.436    0.151
    x1z1              0.053    0.015    3.526    0.000

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .y1                6.039    0.270   22.361    0.000

2.4 Interactions between latent and observed variables

ModSEM also allows you to estimate interaction effects between latent and observed variables. To do so, you just join a latent and an observed variable by a colon, e.g., ‘latent:observer’. As with interactions between observed variables, it is generally recommended that you use method = “pind” for estimating the effect between observed x latent

m3 <- '
  # Outer Model
  X =~ x1 + x2 +x3
  Y =~ y1 + y2 + y3
  
  # Inner model
  Y ~ X + z1 + X:z1 
'

est3 <- modsem(m3, oneInt, method = "pind")
summary(est3)
ModSEM: 
Method = pind 
lavaan 0.6.17.1913 ended normally after 109 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                        22

  Number of observations                          1000

Model Test User Model:
                                                      
  Test statistic                              5646.047
  Degrees of freedom                                32
  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|)
  X =~                                                
    x1                1.000                           
    x2                1.009    0.036   27.875    0.000
    x3                0.983    0.030   32.411    0.000
  Y =~                                                
    y1                1.000                           
    y2                1.000    0.027   37.558    0.000
    y3                1.009    0.024   42.910    0.000
  Xz1 =~                                              
    x1z1              1.000                           
    x2z1              1.018    0.025   40.422    0.000
    x3z1              0.994    0.020   48.706    0.000

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)
  Y ~                                                 
    X                -0.011    0.056   -0.194    0.846
    z1                0.052    0.033    1.553    0.120
    Xz1               0.077    0.008   10.205    0.000

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)
  X ~~                                                
    Xz1              20.440    1.308   15.621    0.000

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .x1                1.911    0.114   16.706    0.000
   .x2                2.453    0.136   18.041    0.000
   .x3                0.769    0.077    9.920    0.000
   .y1                1.392    0.098   14.260    0.000
   .y2                2.086    0.120   17.313    0.000
   .y3                0.930    0.087   10.744    0.000
   .x1z1             50.114    3.175   15.786    0.000
   .x2z1             73.065    4.066   17.970    0.000
   .x3z1             23.359    2.392    9.767    0.000
    X                 3.933    0.258   15.220    0.000
   .Y                 4.393    0.254   17.321    0.000
    Xz1             216.376   11.919   18.154    0.000

2.5 Multiple Interactions

ModSEM also allows you to specify multiple interactionterms. This is done the same way as for single interactions.

m4 <- '
  # Outer Model
  X =~ x1 + x2 +x3
  Y =~ y1 + y2 + y3
  Z =~ z1 + z2 + z3
  G =~ g1 + g2 + g3
  H =~ h1 + h2 + h3
  
  # Inner model
  Y ~ X + Z + G + H + X:Z + G:H
'

est4 <- modsem(m4, twoInt)
summary(est4)
ModSEM: 
Method = rca 
lavaan 0.6.17.1913 ended normally after 1479 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                       123

  Number of observations                          1000

Model Test User Model:
                                                      
  Test statistic                               341.734
  Degrees of freedom                               438
  P-value (Chi-square)                           1.000

Parameter Estimates:

  Standard errors                             Standard
  Information                                 Expected
  Information saturated (h1) model          Structured

Latent Variables:
                   Estimate   Std.Err  z-value  P(>|z|)
  X =~                                                 
    x1                 1.000                           
    x2                 1.049    0.038   27.951    0.000
    x3                 1.006    0.033   30.577    0.000
  Y =~                                                 
    y1                 1.000                           
    y2                 0.981    0.026   38.148    0.000
    y3                 0.990    0.022   45.382    0.000
  Z =~                                                 
    z1                 1.000                           
    z2                 1.022    0.026   38.820    0.000
    z3                 0.965    0.023   41.369    0.000
  G =~                                                 
    g1                 1.000                           
    g2                 0.956    0.026   37.231    0.000
    g3                 1.000    0.024   41.566    0.000
  H =~                                                 
    h1                 1.000                           
    h2                 0.999    0.025   40.134    0.000
    h3                 1.007    0.023   43.070    0.000
  XZ =~                                                
    x1z1               1.000                           
    x2z1               1.224    0.059   20.728    0.000
    x3z1               1.261    0.057   21.977    0.000
    x1z2               1.180    0.046   25.902    0.000
    x2z2               1.359    0.077   17.591    0.000
    x3z2               1.388    0.075   18.557    0.000
    x1z3               1.092    0.040   27.439    0.000
    x2z3               1.244    0.070   17.681    0.000
    x3z3               1.302    0.069   18.911    0.000
  GH =~                                                
    g1h1               1.000                           
    g2h1               0.987    0.026   37.555    0.000
    g3h1               1.017    0.024   42.826    0.000
    g1h2               0.973    0.027   35.424    0.000
    g2h2               0.973    0.037   26.233    0.000
    g3h2               0.995    0.035   28.076    0.000
    g1h3               0.983    0.026   37.977    0.000
    g2h3               0.967    0.035   27.540    0.000
    g3h3               1.004    0.034   29.657    0.000

Regressions:
                   Estimate   Std.Err  z-value  P(>|z|)
  Y ~                                                  
    X                  0.970    0.605    1.603    0.109
    Z                 -0.092    0.585   -0.156    0.876
    G                  2.388    0.592    4.034    0.000
    H                  2.823    0.564    5.004    0.000
    XZ                 0.199    0.082    2.438    0.015
    GH                 1.996    0.075   26.477    0.000

Covariances:
                   Estimate   Std.Err  z-value  P(>|z|)
 .x1z1 ~~                                              
   .x2z1            1834.892  180.948   10.140    0.000
   .x3z1            2011.771  164.766   12.210    0.000
   .x1z2            4888.328  317.096   15.416    0.000
   .x1z3            4615.300  288.737   15.984    0.000
 .x2z1 ~~                                              
   .x3z1            1753.409  171.992   10.195    0.000
   .x2z2            6589.947  426.324   15.458    0.000
   .x2z3            6203.366  392.471   15.806    0.000
 .x3z1 ~~                                              
   .x3z2            1068.739  287.955    3.711    0.000
   .x3z3             971.411  267.256    3.635    0.000
 .x1z2 ~~                                              
   .x2z2            3213.479  267.518   12.012    0.000
   .x3z2            3029.751  233.952   12.950    0.000
   .x1z3            4713.459  316.735   14.881    0.000
 .x2z2 ~~                                              
   .x3z2            3466.848  252.099   13.752    0.000
   .x2z3            6537.015  421.808   15.498    0.000
 .x3z2 ~~                                              
   .x3z3             938.022  282.895    3.316    0.001
 .x1z3 ~~                                              
   .x2z3            2190.468  202.736   10.805    0.000
   .x3z3            1921.771  175.501   10.950    0.000
 .x2z3 ~~                                              
   .x3z3            2142.826  189.026   11.336    0.000
 .x1z1 ~~                                              
   .x2z2               0.000                           
   .x3z2               0.000                           
   .x2z3               0.000                           
   .x3z3               0.000                           
 .x2z1 ~~                                              
   .x1z2               0.000                           
   .x3z2               0.000                           
   .x1z3               0.000                           
   .x3z3               0.000                           
 .x3z1 ~~                                              
   .x1z2               0.000                           
   .x2z2               0.000                           
   .x1z3               0.000                           
   .x2z3               0.000                           
 .x1z2 ~~                                              
   .x2z3               0.000                           
   .x3z3               0.000                           
 .x2z2 ~~                                              
   .x1z3               0.000                           
   .x3z3               0.000                           
 .x3z2 ~~                                              
   .x1z3               0.000                           
   .x2z3               0.000                           
 .g1h1 ~~                                              
   .g2h1            1779.670  158.828   11.205    0.000
   .g3h1            2014.091  166.966   12.063    0.000
   .g1h2            1720.117  153.204   11.228    0.000
   .g1h3            1672.291  148.927   11.229    0.000
 .g2h1 ~~                                              
   .g3h1            1740.532  159.185   10.934    0.000
   .g2h2            3370.437  218.170   15.449    0.000
   .g2h3            3490.289  214.737   16.254    0.000
 .g3h1 ~~                                              
   .g3h2            2259.777  175.041   12.910    0.000
   .g3h3            2231.626  169.216   13.188    0.000
 .g1h2 ~~                                              
   .g2h2            3359.156  222.209   15.117    0.000
   .g3h2            3408.485  221.010   15.422    0.000
   .g1h3            1834.741  162.240   11.309    0.000
 .g2h2 ~~                                              
   .g3h2            3335.617  223.792   14.905    0.000
   .g2h3            3410.152  226.305   15.069    0.000
 .g3h2 ~~                                              
   .g3h3            2264.842  180.567   12.543    0.000
 .g1h3 ~~                                              
   .g2h3            2435.070  181.969   13.382    0.000
   .g3h3            2642.417  188.485   14.019    0.000
 .g2h3 ~~                                              
   .g3h3            2431.423  181.993   13.360    0.000
 .g1h1 ~~                                              
   .g2h2               0.000                           
   .g3h2               0.000                           
   .g2h3               0.000                           
   .g3h3               0.000                           
 .g2h1 ~~                                              
   .g1h2               0.000                           
   .g3h2               0.000                           
   .g1h3               0.000                           
   .g3h3               0.000                           
 .g3h1 ~~                                              
   .g1h2               0.000                           
   .g2h2               0.000                           
   .g1h3               0.000                           
   .g2h3               0.000                           
 .g1h2 ~~                                              
   .g2h3               0.000                           
   .g3h3               0.000                           
 .g2h2 ~~                                              
   .g1h3               0.000                           
   .g3h3               0.000                           
 .g3h2 ~~                                              
   .g1h3               0.000                           
   .g2h3               0.000                           
  X ~~                                                 
    Z                  1.438    3.296    0.436    0.663
    G                 -3.181    3.285   -0.968    0.333
    H                 -4.159    3.433   -1.211    0.226
    XZ                 0.498   25.788    0.019    0.985
    GH                65.856   35.261    1.868    0.062
  Z ~~                                                 
    G                 -6.025    3.314   -1.818    0.069
    H                 -1.766    3.455   -0.511    0.609
    XZ                 0.031   25.986    0.001    0.999
    GH                19.543   35.424    0.552    0.581
  G ~~                                                 
    H                 -1.825    3.442   -0.530    0.596
    XZ                34.906   25.953    1.345    0.179
    GH                 0.593   35.276    0.017    0.987
  H ~~                                                 
    XZ                40.615   27.126    1.497    0.134
    GH                 0.671   36.846    0.018    0.985
  XZ ~~                                                
    GH               116.212  277.225    0.419    0.675

Variances:
                   Estimate   Std.Err  z-value  P(>|z|)
   .x1                47.440    2.952   16.070    0.000
   .x2                60.764    3.535   17.188    0.000
   .x3                15.976    2.195    7.278    0.000
   .y1             15327.732  986.940   15.531    0.000
   .y2             22065.886 1225.271   18.009    0.000
   .y3              9018.424  784.020   11.503    0.000
   .z1                15.301    1.534    9.976    0.000
   .z2                37.145    2.195   16.924    0.000
   .z3                24.585    1.686   14.583    0.000
   .g1                17.233    1.588   10.850    0.000
   .g2                35.784    2.044   17.507    0.000
   .g3                22.524    1.715   13.130    0.000
   .h1                17.901    1.605   11.154    0.000
   .h2                35.185    2.101   16.749    0.000
   .h3                25.278    1.809   13.971    0.000
   .x1z1            7549.680  361.046   20.911    0.000
   .x2z1            9018.215  466.772   19.320    0.000
   .x3z1            3322.029  332.520    9.990    0.000
   .x1z2            9831.213  474.481   20.720    0.000
   .x2z2           12556.428  599.066   20.960    0.000
   .x3z2            4880.141  411.512   11.859    0.000
   .x1z3            7401.532  371.492   19.924    0.000
   .x2z3            9978.511  489.843   20.371    0.000
   .x3z3            3134.237  331.971    9.441    0.000
   .g1h1            3946.828  230.218   17.144    0.000
   .g2h1            5543.940  276.322   20.063    0.000
   .g3h1            4613.999  250.375   18.428    0.000
   .g1h2            5968.548  295.863   20.173    0.000
   .g2h2            7960.768  359.478   22.145    0.000
   .g3h2            6555.669  315.907   20.752    0.000
   .g1h3            4969.074  262.027   18.964    0.000
   .g2h3            6659.781  310.506   21.448    0.000
   .g3h3            5399.116  274.564   19.664    0.000
    X                 93.667    6.288   14.897    0.000
   .Y              19344.599 1495.128   12.938    0.000
    Z                 97.397    5.179   18.808    0.000
    G                 96.360    5.210   18.496    0.000
    H                105.619    5.640   18.727    0.000
    XZ              5485.787  524.965   10.450    0.000
    GH             10275.491  639.480   16.069    0.000

2.6 Interactionterms with more than two varaibles

In some rare cases, you might want an interactionterm between more than two variables (e.g., var1:var2:var3). This can be done in modsem by just adding the extra variable with an extra colon. Note that the more variables you have in your interaction term, the more difficult it will be to estimate your model. It is therefore a good idea to standardize your data before computing your model, this makes it a lot easier for lavaan to estimate your model. This can be done in modsem by adding: standardizeData = TRUE.

m5 <- '
  # Outer Model
  X =~ x1 + x2 +x3
  Y =~ y1 + y2 + y3
  Z =~ z1 + z2 + z3
  G =~ g1 + g2 + g3
  
  # Inner model
  Y ~ X + Z + G + X:Z:G
'

est5 <- modsem(m5, tripleInt, standardizeData = TRUE)
summary(est5)
ModSEM: 
Method = rca 
lavaan 0.6.17.1913 ended normally after 901 iterations

  Estimator                                         ML
  Optimization method                           NLMINB
  Number of model parameters                       331

  Number of observations                          1000

Model Test User Model:
                                                      
  Test statistic                               178.709
  Degrees of freedom                               449
  P-value (Chi-square)                           1.000

Parameter Estimates:

  Standard errors                             Standard
  Information                                 Expected
  Information saturated (h1) model          Structured

Latent Variables:
                   Estimate  Std.Err  z-value  P(>|z|)
  X =~                                                
    x1                1.000                           
    x2                1.008    0.036   27.654    0.000
    x3                1.183    0.039   29.973    0.000
  Y =~                                                
    y1                1.000                           
    y2                0.946    0.025   37.545    0.000
    y3                1.033    0.024   43.379    0.000
  Z =~                                                
    z1                1.000                           
    z2                0.920    0.024   38.503    0.000
    z3                0.962    0.023   41.729    0.000
  G =~                                                
    g1                1.000                           
    g2                0.930    0.023   39.949    0.000
    g3                0.955    0.023   41.919    0.000
  XZG =~                                              
    x1z1g1            1.000                           
    x2z1g1            1.104    0.044   24.874    0.000
    x3z1g1            1.108    0.041   27.106    0.000
    x1z2g1            0.950    0.037   25.432    0.000
    x2z2g1            1.011    0.054   18.826    0.000
    x3z2g1            1.022    0.052   19.685    0.000
    x1z3g1            0.858    0.032   27.234    0.000
    x2z3g1            0.983    0.049   20.247    0.000
    x3z3g1            0.964    0.047   20.449    0.000
    x1z1g2            1.013    0.034   29.481    0.000
    x2z1g2            1.134    0.053   21.501    0.000
    x3z1g2            1.139    0.052   21.759    0.000
    x1z2g2            0.991    0.046   21.398    0.000
    x2z2g2            1.055    0.059   18.019    0.000
    x3z2g2            1.075    0.059   18.197    0.000
    x1z3g2            0.894    0.045   20.086    0.000
    x2z3g2            1.032    0.057   18.147    0.000
    x3z3g2            1.016    0.056   18.081    0.000
    x1z1g3            1.061    0.034   31.298    0.000
    x2z1g3            1.137    0.053   21.390    0.000
    x3z1g3            1.152    0.051   22.516    0.000
    x1z2g3            0.975    0.045   21.497    0.000
    x2z2g3            1.020    0.057   17.762    0.000
    x3z2g3            1.018    0.056   18.219    0.000
    x1z3g3            0.891    0.042   21.258    0.000
    x2z3g3            1.005    0.056   17.991    0.000
    x3z3g3            0.988    0.053   18.491    0.000

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)
  Y ~                                                 
    X                 0.272    0.037    7.390    0.000
    Z                 0.218    0.031    7.062    0.000
    G                 0.222    0.031    7.191    0.000
    XZG               0.075    0.045    1.651    0.099

Covariances:
                   Estimate  Std.Err  z-value  P(>|z|)
 .x1z1g1 ~~                                           
   .x2z1g1            0.194    0.015   12.916    0.000
   .x3z1g1            0.233    0.017   14.066    0.000
   .x1z2g1            0.297    0.017   17.173    0.000
   .x2z2g1            0.076    0.009    8.475    0.000
   .x3z2g1            0.093    0.009    9.822    0.000
   .x1z3g1            0.307    0.017   18.074    0.000
   .x2z3g1            0.097    0.009   10.233    0.000
   .x3z3g1            0.122    0.010   11.969    0.000
   .x1z1g2            0.343    0.021   16.647    0.000
   .x2z1g2            0.076    0.011    7.014    0.000
   .x3z1g2            0.080    0.011    7.061    0.000
   .x1z2g2            0.205    0.015   13.686    0.000
   .x1z3g2            0.197    0.015   13.184    0.000
   .x1z1g3            0.350    0.020   17.255    0.000
   .x2z1g3            0.089    0.011    8.121    0.000
   .x3z1g3            0.088    0.011    7.859    0.000
   .x1z2g3            0.208    0.015   14.162    0.000
   .x1z3g3            0.193    0.014   13.594    0.000
 .x2z1g1 ~~                                           
   .x3z1g1            0.243    0.017   14.302    0.000
   .x1z2g1            0.075    0.009    8.657    0.000
   .x2z2g1            0.315    0.019   16.198    0.000
   .x3z2g1            0.105    0.010   10.741    0.000
   .x1z3g1            0.097    0.009   10.406    0.000
   .x2z3g1            0.315    0.019   16.634    0.000
   .x3z3g1            0.123    0.010   11.773    0.000
   .x1z1g2            0.078    0.011    7.101    0.000
   .x2z1g2            0.285    0.020   14.013    0.000
   .x3z1g2            0.079    0.011    6.938    0.000
   .x2z2g2            0.165    0.015   10.792    0.000
   .x2z3g2            0.160    0.015   10.672    0.000
   .x1z1g3            0.088    0.011    7.969    0.000
   .x2z1g3            0.311    0.021   14.958    0.000
   .x3z1g3            0.084    0.011    7.463    0.000
   .x2z2g3            0.175    0.015   11.405    0.000
   .x2z3g3            0.172    0.015   11.222    0.000
 .x3z1g1 ~~                                           
   .x1z2g1            0.092    0.010    9.392    0.000
   .x2z2g1            0.106    0.011   10.094    0.000
   .x3z2g1            0.216    0.017   12.774    0.000
   .x1z3g1            0.122    0.011   11.531    0.000
   .x2z3g1            0.123    0.011   11.176    0.000
   .x3z3g1            0.271    0.018   15.228    0.000
   .x1z1g2            0.084    0.012    7.238    0.000
   .x2z1g2            0.079    0.011    6.963    0.000
   .x3z1g2            0.196    0.018   10.678    0.000
   .x3z2g2            0.070    0.012    5.871    0.000
   .x3z3g2            0.099    0.012    7.923    0.000
   .x1z1g3            0.089    0.012    7.689    0.000
   .x2z1g3            0.086    0.011    7.464    0.000
   .x3z1g3            0.181    0.018   10.154    0.000
   .x3z2g3            0.057    0.011    4.995    0.000
   .x3z3g3            0.083    0.012    6.942    0.000
 .x1z2g1 ~~                                           
   .x2z2g1            0.267    0.017   15.638    0.000
   .x3z2g1            0.328    0.019   17.366    0.000
   .x1z3g1            0.248    0.016   15.785    0.000
   .x2z3g1            0.077    0.009    8.780    0.000
   .x3z3g1            0.087    0.009    9.410    0.000
   .x1z1g2            0.205    0.015   13.276    0.000
   .x1z2g2            0.407    0.021   18.982    0.000
   .x2z2g2            0.146    0.013   11.160    0.000
   .x3z2g2            0.195    0.015   13.063    0.000
   .x1z3g2            0.168    0.014   11.825    0.000
   .x1z1g3            0.209    0.015   13.894    0.000
   .x1z2g3            0.416    0.021   19.576    0.000
   .x2z2g3            0.159    0.013   11.835    0.000
   .x3z2g3            0.204    0.014   14.066    0.000
   .x1z3g3            0.160    0.013   11.938    0.000
 .x2z2g1 ~~                                           
   .x3z2g1            0.324    0.019   17.399    0.000
   .x1z3g1            0.077    0.009    8.686    0.000
   .x2z3g1            0.295    0.018   16.002    0.000
   .x3z3g1            0.099    0.010    9.927    0.000
   .x2z1g2            0.164    0.015   10.632    0.000
   .x1z2g2            0.146    0.013   11.149    0.000
   .x2z2g2            0.381    0.022   17.468    0.000
   .x3z2g2            0.179    0.014   12.511    0.000
   .x2z3g2            0.158    0.015   10.590    0.000
   .x2z1g3            0.176    0.016   11.176    0.000
   .x1z2g3            0.161    0.013   12.161    0.000
   .x2z2g3            0.398    0.022   18.047    0.000
   .x3z2g3            0.189    0.014   13.646    0.000
   .x2z3g3            0.158    0.015   10.435    0.000
 .x3z2g1 ~~                                           
   .x1z3g1            0.087    0.009    9.478    0.000
   .x2z3g1            0.098    0.010   10.048    0.000
   .x3z3g1            0.192    0.016   12.306    0.000
   .x3z1g2            0.073    0.012    5.970    0.000
   .x1z2g2            0.195    0.015   13.214    0.000
   .x2z2g2            0.179    0.014   12.725    0.000
   .x3z2g2            0.314    0.021   15.323    0.000
   .x3z3g2            0.066    0.011    5.779    0.000
   .x3z1g3            0.056    0.012    4.768    0.000
   .x1z2g3            0.199    0.015   13.592    0.000
   .x2z2g3            0.184    0.014   12.890    0.000
   .x3z2g3            0.306    0.020   15.525    0.000
   .x3z3g3            0.054    0.011    4.990    0.000
 .x1z3g1 ~~                                           
   .x2z3g1            0.213    0.014   15.115    0.000
   .x3z3g1            0.266    0.016   17.123    0.000
   .x1z1g2            0.198    0.015   13.497    0.000
   .x1z2g2            0.171    0.014   12.566    0.000
   .x1z3g2            0.347    0.019   18.569    0.000
   .x2z3g2            0.111    0.010   10.781    0.000
   .x3z3g2            0.138    0.011   12.399    0.000
   .x1z1g3            0.195    0.014   13.750    0.000
   .x1z2g3            0.162    0.013   12.371    0.000
   .x1z3g3            0.319    0.018   18.091    0.000
   .x2z3g3            0.094    0.010    9.194    0.000
   .x3z3g3            0.118    0.010   11.298    0.000
 .x2z3g1 ~~                                           
   .x3z3g1            0.263    0.016   16.889    0.000
   .x2z1g2            0.160    0.015   10.906    0.000
   .x2z2g2            0.158    0.014   10.981    0.000
   .x1z3g2            0.111    0.010   10.554    0.000
   .x2z3g2            0.300    0.018   16.291    0.000
   .x3z3g2            0.133    0.011   12.271    0.000
   .x2z1g3            0.171    0.015   11.462    0.000
   .x2z2g3            0.156    0.014   10.937    0.000
   .x1z3g3            0.096    0.010    9.599    0.000
   .x2z3g3            0.293    0.019   15.789    0.000
   .x3z3g3            0.115    0.010   11.293    0.000
 .x3z3g1 ~~                                           
   .x3z1g2            0.100    0.012    8.033    0.000
   .x3z2g2            0.065    0.011    5.817    0.000
   .x1z3g2            0.138    0.011   12.043    0.000
   .x2z3g2            0.132    0.011   12.126    0.000
   .x3z3g2            0.264    0.017   15.374    0.000
   .x3z1g3            0.083    0.012    7.013    0.000
   .x3z2g3            0.056    0.011    5.303    0.000
   .x1z3g3            0.119    0.011   10.990    0.000
   .x2z3g3            0.113    0.011   10.525    0.000
   .x3z3g3            0.230    0.016   14.122    0.000
 .x1z1g2 ~~                                           
   .x2z1g2            0.179    0.016   11.458    0.000
   .x3z1g2            0.221    0.017   13.165    0.000
   .x1z2g2            0.381    0.021   18.099    0.000
   .x2z2g2            0.081    0.011    7.497    0.000
   .x3z2g2            0.114    0.011    9.967    0.000
   .x1z3g2            0.401    0.022   18.553    0.000
   .x2z3g2            0.094    0.011    8.471    0.000
   .x3z3g2            0.122    0.011   10.632    0.000
   .x1z1g3            0.355    0.021   16.683    0.000
   .x2z1g3            0.076    0.011    7.088    0.000
   .x3z1g3            0.083    0.011    7.490    0.000
   .x1z2g3            0.217    0.016   13.623    0.000
   .x1z3g3            0.213    0.016   13.609    0.000
 .x2z1g2 ~~                                           
   .x3z1g2            0.208    0.017   12.632    0.000
   .x1z2g2            0.080    0.010    7.755    0.000
   .x2z2g2            0.295    0.020   14.833    0.000
   .x3z2g2            0.110    0.011    9.837    0.000
   .x1z3g2            0.093    0.011    8.819    0.000
   .x2z3g2            0.318    0.020   15.729    0.000
   .x3z3g2            0.124    0.011   10.921    0.000
   .x1z1g3            0.072    0.011    6.842    0.000
   .x2z1g3            0.264    0.020   13.100    0.000
   .x3z1g3            0.070    0.011    6.463    0.000
   .x2z2g3            0.146    0.015    9.634    0.000
   .x2z3g3            0.151    0.015    9.894    0.000
 .x3z1g2 ~~                                           
   .x1z2g2            0.113    0.011   10.291    0.000
   .x2z2g2            0.111    0.011    9.822    0.000
   .x3z2g2            0.221    0.018   12.350    0.000
   .x1z3g2            0.120    0.011   10.702    0.000
   .x2z3g2            0.124    0.012   10.662    0.000
   .x3z3g2            0.266    0.019   14.350    0.000
   .x1z1g3            0.080    0.011    7.169    0.000
   .x2z1g3            0.071    0.011    6.470    0.000
   .x3z1g3            0.182    0.018   10.184    0.000
   .x3z2g3            0.059    0.012    5.042    0.000
   .x3z3g3            0.087    0.012    7.054    0.000
 .x1z2g2 ~~                                           
   .x2z2g2            0.235    0.017   14.058    0.000
   .x3z2g2            0.332    0.019   17.406    0.000
   .x1z3g2            0.355    0.020   17.761    0.000
   .x2z3g2            0.092    0.011    8.564    0.000
   .x3z3g2            0.121    0.011   10.977    0.000
   .x1z1g3            0.217    0.016   13.685    0.000
   .x1z2g3            0.387    0.021   18.480    0.000
   .x2z2g3            0.129    0.012   10.332    0.000
   .x3z2g3            0.172    0.013   12.823    0.000
   .x1z3g3            0.178    0.014   12.384    0.000
 .x2z2g2 ~~                                           
   .x3z2g2            0.318    0.019   17.004    0.000
   .x1z3g2            0.093    0.011    8.626    0.000
   .x2z3g2            0.322    0.020   16.063    0.000
   .x3z3g2            0.130    0.012   11.264    0.000
   .x2z1g3            0.148    0.015    9.578    0.000
   .x1z2g3            0.130    0.012   10.675    0.000
   .x2z2g3            0.336    0.021   16.186    0.000
   .x3z2g3            0.160    0.013   12.513    0.000
   .x2z3g3            0.141    0.015    9.426    0.000
 .x3z2g2 ~~                                           
   .x1z3g2            0.121    0.011   10.714    0.000
   .x2z3g2            0.129    0.012   10.966    0.000
   .x3z3g2            0.227    0.017   13.150    0.000
   .x3z1g3            0.057    0.012    4.799    0.000
   .x1z2g3            0.168    0.014   12.190    0.000
   .x2z2g3            0.155    0.013   11.541    0.000
   .x3z2g3            0.271    0.019   14.318    0.000
   .x3z3g3            0.055    0.011    4.939    0.000
 .x1z3g2 ~~                                           
   .x2z3g2            0.236    0.016   15.021    0.000
   .x3z3g2            0.291    0.017   17.351    0.000
   .x1z1g3            0.213    0.016   13.422    0.000
   .x1z2g3            0.179    0.015   12.135    0.000
   .x1z3g3            0.349    0.019   18.348    0.000
   .x2z3g3            0.101    0.010    9.846    0.000
   .x3z3g3            0.122    0.010   11.619    0.000
 .x2z3g2 ~~                                           
   .x3z3g2            0.291    0.017   17.443    0.000
   .x2z1g3            0.151    0.015    9.922    0.000
   .x2z2g3            0.139    0.015    9.544    0.000
   .x1z3g3            0.103    0.010   10.453    0.000
   .x2z3g3            0.282    0.019   15.110    0.000
   .x3z3g3            0.117    0.010   11.721    0.000
 .x3z3g2 ~~                                           
   .x3z1g3            0.087    0.012    7.048    0.000
   .x3z2g3            0.056    0.011    5.155    0.000
   .x1z3g3            0.123    0.011   11.600    0.000
   .x2z3g3            0.116    0.010   11.071    0.000
   .x3z3g3            0.226    0.016   13.938    0.000
 .x1z1g3 ~~                                           
   .x2z1g3            0.196    0.016   12.427    0.000
   .x3z1g3            0.223    0.017   13.446    0.000
   .x1z2g3            0.368    0.020   18.339    0.000
   .x2z2g3            0.078    0.010    7.752    0.000
   .x3z2g3            0.107    0.010   10.280    0.000
   .x1z3g3            0.361    0.020   18.227    0.000
   .x2z3g3            0.088    0.011    8.213    0.000
   .x3z3g3            0.107    0.011    9.936    0.000
 .x2z1g3 ~~                                           
   .x3z1g3            0.200    0.016   12.312    0.000
   .x1z2g3            0.080    0.010    8.095    0.000
   .x2z2g3            0.309    0.020   15.357    0.000
   .x3z2g3            0.096    0.010    9.334    0.000
   .x1z3g3            0.090    0.010    8.947    0.000
   .x2z3g3            0.332    0.021   15.917    0.000
   .x3z3g3            0.101    0.011    9.504    0.000
 .x3z1g3 ~~                                           
   .x1z2g3            0.104    0.010   10.108    0.000
   .x2z2g3            0.093    0.010    8.932    0.000
   .x3z2g3            0.188    0.016   11.592    0.000
   .x1z3g3            0.108    0.011   10.203    0.000
   .x2z3g3            0.101    0.011    9.068    0.000
   .x3z3g3            0.221    0.017   12.957    0.000
 .x1z2g3 ~~                                           
   .x2z2g3            0.238    0.016   14.515    0.000
   .x3z2g3            0.313    0.018   17.645    0.000
   .x1z3g3            0.301    0.018   16.683    0.000
   .x2z3g3            0.064    0.010    6.504    0.000
   .x3z3g3            0.091    0.010    9.262    0.000
 .x2z2g3 ~~                                           
   .x3z2g3            0.284    0.017   16.426    0.000
   .x1z3g3            0.065    0.009    6.872    0.000
   .x2z3g3            0.289    0.020   14.739    0.000
   .x3z3g3            0.082    0.010    8.182    0.000
 .x3z2g3 ~~                                           
   .x1z3g3            0.094    0.010    9.669    0.000
   .x2z3g3            0.083    0.010    8.116    0.000
   .x3z3g3            0.179    0.015   11.738    0.000
 .x1z3g3 ~~                                           
   .x2z3g3            0.193    0.015   13.259    0.000
   .x3z3g3            0.233    0.015   15.655    0.000
 .x2z3g3 ~~                                           
   .x3z3g3            0.227    0.015   14.862    0.000
 .x1z1g1 ~~                                           
   .x2z2g2            0.000                           
   .x3z2g2            0.000                           
   .x2z3g2            0.000                           
   .x3z3g2            0.000                           
   .x2z2g3            0.000                           
   .x3z2g3            0.000                           
   .x2z3g3            0.000                           
   .x3z3g3            0.000                           
 .x2z1g1 ~~                                           
   .x1z2g2            0.000                           
   .x3z2g2            0.000                           
   .x1z3g2            0.000                           
   .x3z3g2            0.000                           
   .x1z2g3            0.000                           
   .x3z2g3            0.000                           
   .x1z3g3            0.000                           
   .x3z3g3            0.000                           
 .x3z1g1 ~~                                           
   .x1z2g2            0.000                           
   .x2z2g2            0.000                           
   .x1z3g2            0.000                           
   .x2z3g2            0.000                           
   .x1z2g3            0.000                           
   .x2z2g3            0.000                           
   .x1z3g3            0.000                           
   .x2z3g3            0.000                           
 .x1z2g1 ~~                                           
   .x2z1g2            0.000                           
   .x3z1g2            0.000                           
   .x2z3g2            0.000                           
   .x3z3g2            0.000                           
   .x2z1g3            0.000                           
   .x3z1g3            0.000                           
   .x2z3g3            0.000                           
   .x3z3g3            0.000                           
 .x2z2g1 ~~                                           
   .x1z1g2            0.000                           
   .x3z1g2            0.000                           
   .x1z3g2            0.000                           
   .x3z3g2            0.000                           
   .x1z1g3            0.000                           
   .x3z1g3            0.000                           
   .x1z3g3            0.000                           
   .x3z3g3            0.000                           
 .x3z2g1 ~~                                           
   .x1z1g2            0.000                           
   .x2z1g2            0.000                           
   .x1z3g2            0.000                           
   .x2z3g2            0.000                           
   .x1z1g3            0.000                           
   .x2z1g3            0.000                           
   .x1z3g3            0.000                           
   .x2z3g3            0.000                           
 .x1z3g1 ~~                                           
   .x2z1g2            0.000                           
   .x3z1g2            0.000                           
   .x2z2g2            0.000                           
   .x3z2g2            0.000                           
   .x2z1g3            0.000                           
   .x3z1g3            0.000                           
   .x2z2g3            0.000                           
   .x3z2g3            0.000                           
 .x2z3g1 ~~                                           
   .x1z1g2            0.000                           
   .x3z1g2            0.000                           
   .x1z2g2            0.000                           
   .x3z2g2            0.000                           
   .x1z1g3            0.000                           
   .x3z1g3            0.000                           
   .x1z2g3            0.000                           
   .x3z2g3            0.000                           
 .x3z3g1 ~~                                           
   .x1z1g2            0.000                           
   .x2z1g2            0.000                           
   .x1z2g2            0.000                           
   .x2z2g2            0.000                           
   .x1z1g3            0.000                           
   .x2z1g3            0.000                           
   .x1z2g3            0.000                           
   .x2z2g3            0.000                           
 .x1z1g2 ~~                                           
   .x2z2g3            0.000                           
   .x3z2g3            0.000                           
   .x2z3g3            0.000                           
   .x3z3g3            0.000                           
 .x2z1g2 ~~                                           
   .x1z2g3            0.000                           
   .x3z2g3            0.000                           
   .x1z3g3            0.000                           
   .x3z3g3            0.000                           
 .x3z1g2 ~~                                           
   .x1z2g3            0.000                           
   .x2z2g3            0.000                           
   .x1z3g3            0.000                           
   .x2z3g3            0.000                           
 .x1z2g2 ~~                                           
   .x2z1g3            0.000                           
   .x3z1g3            0.000                           
   .x2z3g3            0.000                           
   .x3z3g3            0.000                           
 .x2z2g2 ~~                                           
   .x1z1g3            0.000                           
   .x3z1g3            0.000                           
   .x1z3g3            0.000                           
   .x3z3g3            0.000                           
 .x3z2g2 ~~                                           
   .x1z1g3            0.000                           
   .x2z1g3            0.000                           
   .x1z3g3            0.000                           
   .x2z3g3            0.000                           
 .x1z3g2 ~~                                           
   .x2z1g3            0.000                           
   .x3z1g3            0.000                           
   .x2z2g3            0.000                           
   .x3z2g3            0.000                           
 .x2z3g2 ~~                                           
   .x1z1g3            0.000                           
   .x3z1g3            0.000                           
   .x1z2g3            0.000                           
   .x3z2g3            0.000                           
 .x3z3g2 ~~                                           
   .x1z1g3            0.000                           
   .x2z1g3            0.000                           
   .x1z2g3            0.000                           
   .x2z2g3            0.000                           
  X ~~                                                
    Z                -0.011    0.025   -0.423    0.672
    G                 0.011    0.025    0.440    0.660
    XZG              -0.000    0.020   -0.000    1.000
  Z ~~                                                
    G                 0.025    0.029    0.862    0.389
    XZG               0.000    0.023    0.000    1.000
  G ~~                                                
    XZG               0.000    0.023    0.000    1.000

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)
   .x1                0.370    0.021   17.250    0.000
   .x2                0.360    0.021   16.950    0.000
   .x3                0.119    0.020    6.051    0.000
   .y1                0.190    0.014   13.870    0.000
   .y2                0.275    0.016   17.545    0.000
   .y3                0.136    0.013   10.493    0.000
   .z1                0.140    0.014   10.359    0.000
   .z2                0.273    0.016   17.141    0.000
   .z3                0.204    0.014   14.168    0.000
   .g1                0.136    0.013   10.334    0.000
   .g2                0.252    0.015   16.615    0.000
   .g3                0.212    0.014   14.861    0.000
   .x1z1g1            0.484    0.023   20.779    0.000
   .x2z1g1            0.487    0.025   19.376    0.000
   .x3z1g1            0.422    0.024   17.375    0.000
   .x1z2g1            0.557    0.025   22.368    0.000
   .x2z2g1            0.589    0.027   21.900    0.000
   .x3z2g1            0.499    0.025   19.921    0.000
   .x1z3g1            0.468    0.021   22.266    0.000
   .x2z3g1            0.467    0.022   20.783    0.000
   .x3z3g1            0.449    0.022   20.346    0.000
   .x1z1g2            0.577    0.027   21.061    0.000
   .x2z1g2            0.444    0.025   17.737    0.000
   .x3z1g2            0.392    0.024   16.255    0.000
   .x1z2g2            0.598    0.026   22.576    0.000
   .x2z2g2            0.552    0.026   20.924    0.000
   .x3z2g2            0.504    0.026   19.569    0.000
   .x1z3g2            0.590    0.026   22.956    0.000
   .x2z3g2            0.510    0.025   20.715    0.000
   .x3z3g2            0.462    0.023   20.179    0.000
   .x1z1g3            0.555    0.026   21.088    0.000
   .x2z1g3            0.484    0.026   18.561    0.000
   .x3z1g3            0.347    0.023   15.270    0.000
   .x1z2g3            0.579    0.025   22.750    0.000
   .x2z2g3            0.541    0.026   20.837    0.000
   .x3z2g3            0.445    0.023   19.456    0.000
   .x1z3g3            0.497    0.023   21.974    0.000
   .x2z3g3            0.491    0.025   19.835    0.000
   .x3z3g3            0.380    0.021   18.406    0.000
    X                 0.629    0.044   14.394    0.000
   .Y                 0.674    0.038   17.529    0.000
    Z                 0.859    0.046   18.733    0.000
    G                 0.863    0.046   18.850    0.000
    XZG               0.453    0.040   11.279    0.000