This vignette shows how to estimate interaction models, with both continuous and ordered (categorical) data.
m <- '
X =~ x1 + x2 + x3
Z =~ z1 + z2 + z3
Y =~ y1 + y2 + y3
Y ~ X + Z + X:Z
'fit_cont <- pls(
m,
data = modsem::oneInt,
bootstrap = TRUE,
sample = 50
)
summary(fit_cont)
#> plssem (0.1.0) ended normally after 3 iterations
#>
#> Estimator PLSc
#> Link LINEAR
#>
#> Number of observations 2000
#> Number of iterations 3
#> Number of latent variables 3
#> Number of observed variables 9
#>
#> R-squared (indicators):
#> x1 0.863
#> x2 0.819
#> x3 0.809
#> z1 0.830
#> z2 0.827
#> z3 0.843
#> y1 0.934
#> y2 0.919
#> y3 0.923
#>
#> R-squared (latents):
#> Y 0.604
#>
#> Latent Variables:
#> Estimate Std.Error z.value P(>|z|)
#> X =~
#> x1 0.929 0.015 62.948 0.000
#> x2 0.905 0.013 70.005 0.000
#> x3 0.899 0.014 65.703 0.000
#> Z =~
#> z1 0.911 0.013 71.112 0.000
#> z2 0.909 0.015 62.539 0.000
#> z3 0.918 0.015 61.573 0.000
#> Y =~
#> y1 0.966 0.006 161.293 0.000
#> y2 0.959 0.007 133.159 0.000
#> y3 0.961 0.007 130.698 0.000
#>
#> Regressions:
#> Estimate Std.Error z.value P(>|z|)
#> Y ~
#> X 0.423 0.018 23.205 0.000
#> Z 0.361 0.017 20.967 0.000
#> X:Z 0.452 0.017 26.519 0.000
#>
#> Covariances:
#> Estimate Std.Error z.value P(>|z|)
#> X ~~
#> Z 0.201 0.022 9.225 0.000
#> X:Z 0.018 0.031 0.590 0.555
#> Z ~~
#> X:Z 0.060 0.039 1.561 0.119
#>
#> Variances:
#> Estimate Std.Error z.value P(>|z|)
#> X 1.000
#> Z 1.000
#> .Y 0.396 0.017 22.929 0.000
#> X:Z 1.013 0.046 22.024 0.000
#> .x1 0.137 0.027 5.009 0.000
#> .x2 0.181 0.023 7.710 0.000
#> .x3 0.191 0.025 7.778 0.000
#> .z1 0.170 0.023 7.322 0.000
#> .z2 0.173 0.026 6.547 0.000
#> .z3 0.157 0.027 5.723 0.000
#> .y1 0.066 0.012 5.716 0.000
#> .y2 0.081 0.014 5.881 0.000
#> .y3 0.077 0.014 5.479 0.000fit_ord <- pls(
m,
data = oneIntOrdered,
bootstrap = TRUE,
sample = 50,
ordered = colnames(oneIntOrdered) # explicitly specify variables as ordered
)
summary(fit_ord)
#> plssem (0.1.0) ended normally after 44 iterations
#>
#> Estimator MCOrdPLSc
#> Link PROBIT
#>
#> Number of observations 2000
#> Number of iterations 44
#> Number of latent variables 3
#> Number of observed variables 9
#>
#> R-squared (indicators):
#> x1 0.930
#> x2 0.899
#> x3 0.906
#> z1 0.935
#> z2 0.901
#> z3 0.912
#> y1 0.972
#> y2 0.951
#> y3 0.962
#>
#> R-squared (latents):
#> Y 0.558
#>
#> Latent Variables:
#> Estimate Std.Error z.value P(>|z|)
#> X =~
#> x1 0.930 0.008 120.685 0.000
#> x2 0.899 0.009 105.738 0.000
#> x3 0.906 0.008 106.666 0.000
#> Z =~
#> z1 0.935 0.007 137.890 0.000
#> z2 0.901 0.009 102.039 0.000
#> z3 0.912 0.009 105.202 0.000
#> Y =~
#> y1 0.972 0.004 268.018 0.000
#> y2 0.951 0.005 178.269 0.000
#> y3 0.962 0.005 206.572 0.000
#>
#> Regressions:
#> Estimate Std.Error z.value P(>|z|)
#> Y ~
#> X 0.417 0.024 17.534 0.000
#> Z 0.357 0.023 15.846 0.000
#> X:Z 0.445 0.021 21.072 0.000
#>
#> Covariances:
#> Estimate Std.Error z.value P(>|z|)
#> X ~~
#> Z 0.192 0.024 8.146 0.000
#> X:Z -0.011 0.010 -1.053 0.292
#> Z ~~
#> X:Z 0.015 0.009 1.743 0.081
#>
#> Variances:
#> Estimate Std.Error z.value P(>|z|)
#> X 1.000
#> Z 1.000
#> .Y 0.442 0.030 14.960 0.000
#> X:Z 1.028 0.018 55.700 0.000
#> .x1 0.070 0.008 9.065 0.000
#> .x2 0.101 0.009 11.866 0.000
#> .x3 0.094 0.008 11.127 0.000
#> .z1 0.065 0.007 9.548 0.000
#> .z2 0.099 0.009 11.208 0.000
#> .z3 0.088 0.009 10.173 0.000
#> .y1 0.028 0.004 7.792 0.000
#> .y2 0.049 0.005 9.089 0.000
#> .y3 0.038 0.005 8.073 0.000