non-centered interaction terms (LMS and QML)
meanstructure_lms_qml.Rmd
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 39
#> Loglikelihood -23423.26
#> Akaike (AIC) 46954.53
#> Bayesian (BIC) 47256.98
#>
#> 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 2969.96
#> Difference test (D) 5939.92
#> Degrees of freedom (D) 1
#> P-value (D) 0.000
#>
#> R-Squared Interaction Model (H1):
#> INT 0.366
#> BEH 0.262
#> R-Squared Baseline Model (H0):
#> INT 0.367
#> BEH 0.210
#> R-Squared Change (H1 - H0):
#> INT -0.001
#> BEH 0.052
#>
#> Parameter Estimates:
#> Coefficients unstandardized
#> Information observed
#> Standard errors standard
#>
#> Latent Variables:
#> Estimate Std.Error z.value P(>|z|)
#> PBC =~
#> pbc1 1.000
#> pbc2 0.912 0.013 69.536 0.000
#> pbc3 0.801 0.012 66.151 0.000
#> ATT =~
#> att1 1.000
#> att2 0.878 0.012 71.639 0.000
#> att3 0.789 0.012 66.432 0.000
#> att4 0.695 0.011 61.043 0.000
#> att5 0.887 0.013 70.924 0.000
#> SN =~
#> sn1 1.000
#> sn2 0.888 0.017 52.698 0.000
#> INT =~
#> int1 1.000
#> int2 0.913 0.015 59.156 0.000
#> int3 0.807 0.014 55.812 0.000
#> BEH =~
#> b1 1.000
#> b2 0.960 0.030 32.029 0.000
#>
#> Regressions:
#> Estimate Std.Error z.value P(>|z|)
#> INT ~
#> PBC 0.217 0.030 7.350 0.000
#> ATT 0.213 0.026 8.164 0.000
#> SN 0.176 0.028 6.386 0.000
#> BEH ~
#> PBC 0.025 0.029 0.869 0.385
#> INT -0.015 0.030 -0.499 0.618
#> PBC:INT 0.205 0.018 11.316 0.000
#>
#> Intercepts:
#> Estimate Std.Error z.value P(>|z|)
#> .pbc2 0.075 0.018 4.238 0.000
#> .pbc3 0.192 0.016 11.731 0.000
#> .att2 0.117 0.017 6.826 0.000
#> .att3 0.217 0.017 13.036 0.000
#> .att4 0.294 0.016 18.456 0.000
#> .att5 0.093 0.017 5.317 0.000
#> .sn2 0.117 0.021 5.612 0.000
#> .int2 0.087 0.020 4.385 0.000
#> .int3 0.187 0.019 9.997 0.000
#> .b2 0.058 0.035 1.641 0.101
#> .INT 0.403 0.027 14.696 0.000
#> .BEH 0.784 0.030 26.211 0.000
#> PBC 0.996 0.024 42.361 0.000
#> ATT 1.013 0.024 41.961 0.000
#> SN 1.004 0.024 41.612 0.000
#>
#> Covariances:
#> Estimate Std.Error z.value P(>|z|)
#> PBC ~~
#> ATT 0.678 0.029 23.740 0.000
#> SN 0.677 0.029 23.359 0.000
#> ATT ~~
#> SN 0.629 0.029 21.948 0.000
#>
#> Variances:
#> Estimate Std.Error z.value P(>|z|)
#> .pbc1 0.144 0.008 18.398 0.000
#> .pbc2 0.160 0.007 21.447 0.000
#> .pbc3 0.155 0.006 23.900 0.000
#> .att1 0.167 0.007 23.536 0.000
#> .att2 0.150 0.006 24.724 0.000
#> .att3 0.159 0.006 26.389 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.094 0.000
#> .sn2 0.157 0.012 13.270 0.000
#> .int1 0.157 0.009 18.111 0.000
#> .int2 0.160 0.008 20.423 0.000
#> .int3 0.168 0.007 23.560 0.000
#> .b1 0.186 0.018 10.178 0.000
#> .b2 0.135 0.016 8.190 0.000
#> PBC 0.962 0.035 27.315 0.000
#> ATT 0.998 0.037 27.147 0.000
#> SN 0.987 0.039 25.418 0.000
#> .INT 0.491 0.020 24.655 0.000
#> .BEH 0.455 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 39
#> Loglikelihood -23423.26
#> Akaike (AIC) 46954.53
#> Bayesian (BIC) 47256.98
#>
#> 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 2969.96
#> Difference test (D) 5939.92
#> Degrees of freedom (D) 1
#> P-value (D) 0.000
#>
#> R-Squared Interaction Model (H1):
#> INT 0.366
#> BEH 0.262
#> R-Squared Baseline Model (H0):
#> INT 0.367
#> BEH 0.210
#> R-Squared Change (H1 - H0):
#> INT -0.001
#> BEH 0.052
#>
#> 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.933 1.000
#> pbc2 0.912 0.013 69.536 0.000 0.913 0.912
#> pbc3 0.801 0.012 66.151 0.000 0.894 0.801
#> ATT =~
#> att1 1.000 0.925 1.000
#> att2 0.878 0.012 71.639 0.000 0.915 0.878
#> att3 0.789 0.012 66.432 0.000 0.892 0.789
#> att4 0.695 0.011 61.043 0.000 0.865 0.695
#> att5 0.887 0.013 70.924 0.000 0.912 0.887
#> SN =~
#> sn1 1.000 0.921 1.000
#> sn2 0.888 0.017 52.698 0.000 0.912 0.888
#> INT =~
#> int1 1.000 0.912 1.000
#> int2 0.913 0.015 59.156 0.000 0.895 0.913
#> int3 0.807 0.014 55.812 0.000 0.866 0.807
#> BEH =~
#> b1 1.000 0.877 1.000
#> b2 0.960 0.030 32.029 0.000 0.899 0.960
#>
#> Regressions:
#> Estimate Std.Error z.value P(>|z|) Std.all Cnt.all
#> INT ~
#> PBC 0.217 0.030 7.350 0.000 0.242 0.217
#> ATT 0.213 0.026 8.164 0.000 0.242 0.213
#> SN 0.176 0.028 6.386 0.000 0.199 0.176
#> BEH ~
#> PBC 0.025 0.029 0.869 0.385 0.290 0.232
#> INT -0.015 0.030 -0.499 0.618 0.212 0.189
#> PBC:INT 0.205 0.018 11.316 0.000 0.225 0.205
#>
#> Intercepts:
#> Estimate Std.Error z.value P(>|z|) Std.all Cnt.all
#> .pbc2 0.075 0.018 4.238 0.000
#> .pbc3 0.192 0.016 11.731 0.000
#> .att2 0.117 0.017 6.826 0.000
#> .att3 0.217 0.017 13.036 0.000
#> .att4 0.294 0.016 18.456 0.000
#> .att5 0.093 0.017 5.317 0.000
#> .sn2 0.117 0.021 5.612 0.000
#> .int2 0.087 0.020 4.385 0.000
#> .int3 0.187 0.019 9.997 0.000
#> .b2 0.058 0.035 1.641 0.101
#> .INT 0.403 0.027 14.696 0.000
#> .BEH 0.784 0.030 26.211 0.000
#> PBC 0.996 0.024 42.361 0.000
#> ATT 1.013 0.024 41.961 0.000
#> SN 1.004 0.024 41.612 0.000
#>
#> Covariances:
#> Estimate Std.Error z.value P(>|z|) Std.all Cnt.all
#> PBC ~~
#> ATT 0.678 0.029 23.740 0.000 0.692 0.678
#> SN 0.677 0.029 23.359 0.000 0.695 0.677
#> ATT ~~
#> SN 0.629 0.029 21.948 0.000 0.634 0.629
#>
#> Variances:
#> Estimate Std.Error z.value P(>|z|) Std.all Cnt.all
#> .pbc1 0.144 0.008 18.398 0.000 0.130 0.144
#> .pbc2 0.160 0.007 21.447 0.000 0.166 0.160
#> .pbc3 0.155 0.006 23.900 0.000 0.201 0.155
#> .att1 0.167 0.007 23.536 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.389 0.000 0.204 0.159
#> .att4 0.162 0.006 27.655 0.000 0.252 0.162
#> .att5 0.159 0.006 24.936 0.000 0.168 0.159
#> .sn1 0.178 0.015 12.094 0.000 0.153 0.178
#> .sn2 0.157 0.012 13.270 0.000 0.167 0.157
#> .int1 0.157 0.009 18.111 0.000 0.168 0.157
#> .int2 0.160 0.008 20.423 0.000 0.199 0.160
#> .int3 0.168 0.007 23.560 0.000 0.249 0.168
#> .b1 0.186 0.018 10.178 0.000 0.232 0.186
#> .b2 0.135 0.016 8.190 0.000 0.192 0.135
#> PBC 0.962 0.035 27.315 0.000 1.000 0.962
#> ATT 0.998 0.037 27.147 0.000 1.000 0.998
#> SN 0.987 0.039 25.418 0.000 1.000 0.987
#> .INT 0.491 0.020 24.655 0.000 0.634 0.491
#> .BEH 0.455 0.023 20.212 0.000 0.738 0.455
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.912 0.013 69.536 0 0.886 0.938
#> 3 PBC =~ pbc3 0.801 0.012 66.151 0 0.777 0.824
#> 4 ATT =~ att1 1.000 NA NA NA NA NA
#> 5 ATT =~ att2 0.878 0.012 71.639 0 0.854 0.902
#> 6 ATT =~ att3 0.789 0.012 66.432 0 0.765 0.812
#> 7 ATT =~ att4 0.695 0.011 61.043 0 0.672 0.717
#> 8 ATT =~ att5 0.887 0.013 70.924 0 0.862 0.911
#> 9 SN =~ sn1 1.000 NA NA NA NA NA
#> 10 SN =~ sn2 0.888 0.017 52.698 0 0.855 0.921
#> 11 INT =~ int1 1.000 NA NA NA NA NA
#> 12 INT =~ int2 0.913 0.015 59.156 0 0.883 0.943
#> 13 INT =~ int3 0.807 0.014 55.812 0 0.779 0.835
#> 14 BEH =~ b1 1.000 NA NA NA NA NA
#> 15 BEH =~ b2 0.960 0.030 32.029 0 0.902 1.019
#> 16 INT ~ PBC 0.217 0.030 7.350 0 0.159 0.275
#> 17 INT ~ ATT 0.213 0.026 8.164 0 0.162 0.265
#> 18 INT ~ SN 0.176 0.028 6.386 0 0.122 0.231
#> 19 BEH ~ PBC 0.232 0.022 10.404 0 0.189 0.276
#> 20 BEH ~ INT 0.189 0.025 7.666 0 0.141 0.237
#> 21 BEH ~ PBC:INT 0.205 0.018 11.316 0 0.169 0.240
#> 22 pbc1 ~~ pbc1 0.144 0.008 18.398 0 0.129 0.160
#> 23 pbc2 ~~ pbc2 0.160 0.007 21.447 0 0.145 0.174
#> 24 pbc3 ~~ pbc3 0.155 0.006 23.900 0 0.142 0.168
#> 25 att1 ~~ att1 0.167 0.007 23.536 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.389 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.094 0 0.149 0.207
#> 31 sn2 ~~ sn2 0.157 0.012 13.270 0 0.133 0.180
#> 32 int1 ~~ int1 0.157 0.009 18.111 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.560 0 0.154 0.182
#> 35 b1 ~~ b1 0.186 0.018 10.178 0 0.150 0.222
#> 36 b2 ~~ b2 0.135 0.016 8.190 0 0.103 0.167
#> 37 PBC ~~ PBC 0.962 0.035 27.315 0 0.893 1.031
#> 38 PBC ~~ ATT 0.678 0.029 23.740 0 0.622 0.733
#> 39 PBC ~~ SN 0.677 0.029 23.359 0 0.620 0.734
#> 40 ATT ~~ ATT 0.998 0.037 27.147 0 0.926 1.070
#> 41 ATT ~~ SN 0.629 0.029 21.948 0 0.573 0.685
#> 42 SN ~~ SN 0.987 0.039 25.418 0 0.911 1.063
#> 43 INT ~~ INT 0.491 0.020 24.655 0 0.452 0.530
#> 44 BEH ~~ BEH 0.455 0.023 20.212 0 0.411 0.499
#> 45 PBC:INT ~~ PBC:INT 0.969 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