Skip to contents
library(modsem)
#> This is modsem (1.0.11). Please report any bugs!

Non-centered interaction terms

Using the LMS and QML approaches it is possible to estimate interaction terms where the means of the latent variables are not centered (i.e., they have non-zero means).

Here we can see an example using the TPB dataset:

tpb <- ' 
# Outer Model (Based on Hagger et al., 2007)
  ATT =~ att1 + att2 + att3 + att4 + att5
  SN =~ sn1 + sn2
  PBC =~ pbc1 + pbc2 + pbc3
  INT =~ int1 + int2 + int3
  BEH =~ b1 + b2

# Inner Model (Based on Steinmetz et al., 2011)
  INT ~ ATT + SN + PBC
  BEH ~ INT + PBC 
  BEH ~ INT:PBC

# Adding Latent Intercepts
  INT ~ 1
  BEH ~ 1
  PBC ~ 1
  SN  ~ 1
  ATT ~ 1
'

est <- modsem(tpb, TPB, method = "lms", nodes = 32)
summary(est)
#> 
#> modsem (version 1.0.11):
#> 
#>   Estimator                                         LMS
#>   Optimization method                        EMA-NLMINB
#>   Number of observations                           2000
#>   Number of iterations                               36
#>   Loglikelihood                               -23439.04
#>   Akaike (AIC)                                 46986.09
#>   Bayesian (BIC)                               47288.54
#>  
#> Numerical Integration:
#>   Points of integration (per dim)                    32
#>   Dimensions                                          1
#>   Total points of integration                        32
#>  
#> Fit Measures for Baseline Model (H0):
#>   Loglikelihood                               -26393.22
#>   Akaike (AIC)                                 52892.45
#>   Bayesian (BIC)                               53189.29
#>   Chi-square                                      66.27
#>   Degrees of Freedom (Chi-square)                    82
#>   P-value (Chi-square)                            0.897
#>   RMSEA                                           0.000
#>  
#> Comparative Fit to H0 (LRT test):
#>   Loglikelihood change                          2954.18
#>   Difference test (D)                           5908.36
#>   Degrees of freedom (D)                              1
#>   P-value (D)                                     0.000
#>  
#> R-Squared Interaction Model (H1):
#>   INT                                             0.364
#>   BEH                                             0.259
#> R-Squared Baseline Model (H0):
#>   INT                                             0.367
#>   BEH                                             0.210
#> R-Squared Change (H1 - H0):
#>   INT                                            -0.003
#>   BEH                                             0.048
#> 
#> Parameter Estimates:
#>   Coefficients                           unstandardized
#>   Information                                  observed
#>   Standard errors                              standard
#>  
#> Latent Variables:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>   PBC =~        
#>     pbc1            1.000                             
#>     pbc2            0.914      0.013   69.485    0.000
#>     pbc3            0.802      0.012   66.040    0.000
#>   ATT =~        
#>     att1            1.000                             
#>     att2            0.878      0.012   71.637    0.000
#>     att3            0.789      0.012   66.436    0.000
#>     att4            0.695      0.011   61.044    0.000
#>     att5            0.887      0.013   70.923    0.000
#>   SN =~         
#>     sn1             1.000                             
#>     sn2             0.889      0.017   52.718    0.000
#>   INT =~        
#>     int1            1.000                             
#>     int2            0.913      0.015   59.154    0.000
#>     int3            0.807      0.014   55.810    0.000
#>   BEH =~        
#>     b1              1.000                             
#>     b2              0.959      0.030   32.035    0.000
#> 
#> Regressions:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>   INT ~         
#>     PBC             0.218      0.030    7.335    0.000
#>     ATT             0.214      0.026    8.175    0.000
#>     SN              0.176      0.028    6.384    0.000
#>   BEH ~         
#>     PBC             0.026      0.029    0.889    0.374
#>     INT            -0.015      0.030   -0.511    0.609
#>     PBC:INT         0.205      0.018   11.308    0.000
#> 
#> Intercepts:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>    .pbc2            0.072      0.018    4.094    0.000
#>    .pbc3            0.191      0.016   11.582    0.000
#>    .att2            0.117      0.017    6.828    0.000
#>    .att3            0.217      0.017   13.036    0.000
#>    .att4            0.294      0.016   18.457    0.000
#>    .att5            0.093      0.017    5.318    0.000
#>    .sn2             0.117      0.021    5.596    0.000
#>    .int2            0.087      0.020    4.383    0.000
#>    .int3            0.187      0.019    9.995    0.000
#>    .b2              0.059      0.035    1.678    0.093
#>    .INT             0.403      0.027   14.675    0.000
#>    .BEH             0.784      0.030   26.169    0.000
#>     PBC             0.988      0.024   41.100    0.000
#>     ATT             1.007      0.024   41.288    0.000
#>     SN              0.999      0.024   40.944    0.000
#> 
#> Covariances:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>   PBC ~~        
#>     ATT             0.669      0.029   23.433    0.000
#>     SN              0.669      0.029   23.109    0.000
#>   ATT ~~        
#>     SN              0.624      0.029   21.797    0.000
#> 
#> Variances:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>    .pbc1            0.148      0.008   19.186    0.000
#>    .pbc2            0.159      0.007   21.257    0.000
#>    .pbc3            0.155      0.006   23.848    0.000
#>    .att1            0.167      0.007   23.535    0.000
#>    .att2            0.150      0.006   24.724    0.000
#>    .att3            0.159      0.006   26.387    0.000
#>    .att4            0.162      0.006   27.655    0.000
#>    .att5            0.159      0.006   24.936    0.000
#>    .sn1             0.178      0.015   12.126    0.000
#>    .sn2             0.156      0.012   13.252    0.000
#>    .int1            0.157      0.009   18.112    0.000
#>    .int2            0.160      0.008   20.423    0.000
#>    .int3            0.168      0.007   23.559    0.000
#>    .b1              0.185      0.018   10.132    0.000
#>    .b2              0.136      0.016    8.243    0.000
#>     PBC             0.949      0.035   27.057    0.000
#>     ATT             0.993      0.037   27.081    0.000
#>     SN              0.982      0.039   25.364    0.000
#>    .INT             0.491      0.020   24.653    0.000
#>    .BEH             0.456      0.023   20.212    0.000

Comparing this to the estimates we get when PBC and INT have zero means, we see that the coefficients BEH~PBC and BEH~INT are drastically changed. This is not a bug, and is a function of the interaction effect rescaling the coefficients, when not centered at zero. When using the standardized_estimates function, or summary(est, standardized = TRUE) the interaction effect is centered, and we can see that the coefficients BEH~PBC and BEH~INT are rescaled once again.

summary(est, standardized = TRUE, centered = TRUE)
#> 
#> modsem (version 1.0.11):
#> 
#>   Estimator                                         LMS
#>   Optimization method                        EMA-NLMINB
#>   Number of observations                           2000
#>   Number of iterations                               36
#>   Loglikelihood                               -23439.04
#>   Akaike (AIC)                                 46986.09
#>   Bayesian (BIC)                               47288.54
#>  
#> Numerical Integration:
#>   Points of integration (per dim)                    32
#>   Dimensions                                          1
#>   Total points of integration                        32
#>  
#> Fit Measures for Baseline Model (H0):
#>   Loglikelihood                               -26393.22
#>   Akaike (AIC)                                 52892.45
#>   Bayesian (BIC)                               53189.29
#>   Chi-square                                      66.27
#>   Degrees of Freedom (Chi-square)                    82
#>   P-value (Chi-square)                            0.897
#>   RMSEA                                           0.000
#>  
#> Comparative Fit to H0 (LRT test):
#>   Loglikelihood change                          2954.18
#>   Difference test (D)                           5908.36
#>   Degrees of freedom (D)                              1
#>   P-value (D)                                     0.000
#>  
#> R-Squared Interaction Model (H1):
#>   INT                                             0.364
#>   BEH                                             0.259
#> R-Squared Baseline Model (H0):
#>   INT                                             0.367
#>   BEH                                             0.210
#> R-Squared Change (H1 - H0):
#>   INT                                            -0.003
#>   BEH                                             0.048
#> 
#> Parameter Estimates:
#>   Coefficients                             standardized
#>   Information                                  observed
#>   Standard errors                              standard
#>  
#> Latent Variables:
#>                  Estimate  Std.Error  z.value  P(>|z|)  Std.all  Cnt.all
#>   PBC =~        
#>     pbc1            1.000                                 0.930    1.000
#>     pbc2            0.914      0.013   69.485    0.000    0.913    0.914
#>     pbc3            0.802      0.012   66.040    0.000    0.893    0.802
#>   ATT =~        
#>     att1            1.000                                 0.925    1.000
#>     att2            0.878      0.012   71.637    0.000    0.914    0.878
#>     att3            0.789      0.012   66.436    0.000    0.892    0.789
#>     att4            0.695      0.011   61.044    0.000    0.864    0.695
#>     att5            0.887      0.013   70.923    0.000    0.912    0.887
#>   SN =~         
#>     sn1             1.000                                 0.920    1.000
#>     sn2             0.889      0.017   52.718    0.000    0.912    0.889
#>   INT =~        
#>     int1            1.000                                 0.912    1.000
#>     int2            0.913      0.015   59.154    0.000    0.895    0.913
#>     int3            0.807      0.014   55.810    0.000    0.866    0.807
#>   BEH =~        
#>     b1              1.000                                 0.877    1.000
#>     b2              0.959      0.030   32.035    0.000    0.898    0.959
#> 
#> Regressions:
#>                  Estimate  Std.Error  z.value  P(>|z|)  Std.all  Cnt.all
#>   INT ~         
#>     PBC             0.218      0.030    7.335    0.000    0.241    0.218
#>     ATT             0.214      0.026    8.175    0.000    0.242    0.214
#>     SN              0.176      0.028    6.384    0.000    0.199    0.176
#>   BEH ~         
#>     PBC             0.026      0.029    0.889    0.374    0.289    0.232
#>     INT            -0.015      0.030   -0.511    0.609    0.210    0.187
#>     PBC:INT         0.205      0.018   11.308    0.000    0.224    0.205
#> 
#> Intercepts:
#>                  Estimate  Std.Error  z.value  P(>|z|)  Std.all  Cnt.all
#>    .pbc2            0.072      0.018    4.094    0.000                  
#>    .pbc3            0.191      0.016   11.582    0.000                  
#>    .att2            0.117      0.017    6.828    0.000                  
#>    .att3            0.217      0.017   13.036    0.000                  
#>    .att4            0.294      0.016   18.457    0.000                  
#>    .att5            0.093      0.017    5.318    0.000                  
#>    .sn2             0.117      0.021    5.596    0.000                  
#>    .int2            0.087      0.020    4.383    0.000                  
#>    .int3            0.187      0.019    9.995    0.000                  
#>    .b2              0.059      0.035    1.678    0.093                  
#>    .INT             0.403      0.027   14.675    0.000                  
#>    .BEH             0.784      0.030   26.169    0.000                  
#>     PBC             0.988      0.024   41.100    0.000                  
#>     ATT             1.007      0.024   41.288    0.000                  
#>     SN              0.999      0.024   40.944    0.000                  
#> 
#> Covariances:
#>                  Estimate  Std.Error  z.value  P(>|z|)  Std.all  Cnt.all
#>   PBC ~~        
#>     ATT             0.669      0.029   23.433    0.000    0.690    0.669
#>     SN              0.669      0.029   23.109    0.000    0.693    0.669
#>   ATT ~~        
#>     SN              0.624      0.029   21.797    0.000    0.632    0.624
#> 
#> Variances:
#>                  Estimate  Std.Error  z.value  P(>|z|)  Std.all  Cnt.all
#>    .pbc1            0.148      0.008   19.186    0.000    0.135    0.148
#>    .pbc2            0.159      0.007   21.257    0.000    0.167    0.159
#>    .pbc3            0.155      0.006   23.848    0.000    0.202    0.155
#>    .att1            0.167      0.007   23.535    0.000    0.144    0.167
#>    .att2            0.150      0.006   24.724    0.000    0.164    0.150
#>    .att3            0.159      0.006   26.387    0.000    0.205    0.159
#>    .att4            0.162      0.006   27.655    0.000    0.253    0.162
#>    .att5            0.159      0.006   24.936    0.000    0.169    0.159
#>    .sn1             0.178      0.015   12.126    0.000    0.154    0.178
#>    .sn2             0.156      0.012   13.252    0.000    0.168    0.156
#>    .int1            0.157      0.009   18.112    0.000    0.169    0.157
#>    .int2            0.160      0.008   20.423    0.000    0.199    0.160
#>    .int3            0.168      0.007   23.559    0.000    0.250    0.168
#>    .b1              0.185      0.018   10.132    0.000    0.231    0.185
#>    .b2              0.136      0.016    8.243    0.000    0.194    0.136
#>     PBC             0.949      0.035   27.057    0.000    1.000    0.949
#>     ATT             0.993      0.037   27.081    0.000    1.000    0.993
#>     SN              0.982      0.039   25.364    0.000    1.000    0.982
#>    .INT             0.491      0.020   24.653    0.000    0.636    0.491
#>    .BEH             0.456      0.023   20.212    0.000    0.741    0.456

It is also possible to get the centered solution using the centered_estimates() function. Note, that centered_estimates() removes the mean structure of the model all together.

centered_estimates(est)
#>        lhs op     rhs label   est std.error z.value p.value ci.lower ci.upper
#> 1      PBC =~    pbc1       1.000        NA      NA      NA       NA       NA
#> 2      PBC =~    pbc2       0.914     0.013  69.485       0    0.889    0.940
#> 3      PBC =~    pbc3       0.802     0.012  66.040       0    0.778    0.826
#> 4      ATT =~    att1       1.000        NA      NA      NA       NA       NA
#> 5      ATT =~    att2       0.878     0.012  71.637       0    0.854    0.902
#> 6      ATT =~    att3       0.789     0.012  66.436       0    0.765    0.812
#> 7      ATT =~    att4       0.695     0.011  61.044       0    0.672    0.717
#> 8      ATT =~    att5       0.887     0.013  70.923       0    0.862    0.911
#> 9       SN =~     sn1       1.000        NA      NA      NA       NA       NA
#> 10      SN =~     sn2       0.889     0.017  52.718       0    0.855    0.922
#> 11     INT =~    int1       1.000        NA      NA      NA       NA       NA
#> 12     INT =~    int2       0.913     0.015  59.154       0    0.883    0.943
#> 13     INT =~    int3       0.807     0.014  55.810       0    0.779    0.835
#> 14     BEH =~      b1       1.000        NA      NA      NA       NA       NA
#> 15     BEH =~      b2       0.959     0.030  32.035       0    0.901    1.018
#> 16     INT  ~     PBC       0.218     0.030   7.335       0    0.159    0.276
#> 17     INT  ~     ATT       0.214     0.026   8.175       0    0.162    0.265
#> 18     INT  ~      SN       0.176     0.028   6.384       0    0.122    0.231
#> 19     BEH  ~     PBC       0.232     0.022  10.375       0    0.188    0.276
#> 20     BEH  ~     INT       0.187     0.025   7.576       0    0.139    0.236
#> 21     BEH  ~ PBC:INT       0.205     0.018  11.308       0    0.169    0.240
#> 22    pbc1 ~~    pbc1       0.148     0.008  19.186       0    0.133    0.163
#> 23    pbc2 ~~    pbc2       0.159     0.007  21.257       0    0.144    0.173
#> 24    pbc3 ~~    pbc3       0.155     0.006  23.848       0    0.142    0.167
#> 25    att1 ~~    att1       0.167     0.007  23.535       0    0.153    0.181
#> 26    att2 ~~    att2       0.150     0.006  24.724       0    0.138    0.162
#> 27    att3 ~~    att3       0.159     0.006  26.387       0    0.148    0.171
#> 28    att4 ~~    att4       0.162     0.006  27.655       0    0.151    0.174
#> 29    att5 ~~    att5       0.159     0.006  24.936       0    0.146    0.171
#> 30     sn1 ~~     sn1       0.178     0.015  12.126       0    0.149    0.207
#> 31     sn2 ~~     sn2       0.156     0.012  13.252       0    0.133    0.179
#> 32    int1 ~~    int1       0.157     0.009  18.112       0    0.140    0.174
#> 33    int2 ~~    int2       0.160     0.008  20.423       0    0.145    0.176
#> 34    int3 ~~    int3       0.168     0.007  23.559       0    0.154    0.182
#> 35      b1 ~~      b1       0.185     0.018  10.132       0    0.149    0.221
#> 36      b2 ~~      b2       0.136     0.016   8.243       0    0.103    0.168
#> 37     PBC ~~     PBC       0.949     0.035  27.057       0    0.880    1.017
#> 38     PBC ~~     ATT       0.669     0.029  23.433       0    0.613    0.725
#> 39     PBC ~~      SN       0.669     0.029  23.109       0    0.612    0.726
#> 40     ATT ~~     ATT       0.993     0.037  27.081       0    0.921    1.065
#> 41     ATT ~~      SN       0.624     0.029  21.797       0    0.568    0.680
#> 42      SN ~~      SN       0.982     0.039  25.364       0    0.906    1.058
#> 43     INT ~~     INT       0.491     0.020  24.653       0    0.452    0.530
#> 44     BEH ~~     BEH       0.456     0.023  20.212       0    0.411    0.500
#> 45 PBC:INT ~~ PBC:INT       0.952        NA      NA      NA       NA       NA
#> 46     INT ~~ PBC:INT       0.000        NA      NA      NA       NA       NA
#> 47     PBC ~~ PBC:INT       0.000        NA      NA      NA       NA       NA