Get lavaan
syntax for product indicator approaches
get_pi_syntax.Rd
get_pi_syntax()
is a function for creating the lavaan
syntax used for estimating
latent interaction models using one of the product indicator approaches.
Arguments
- model.syntax
lavaan
syntax- method
method to use:
"rca"
= residual centering approach,"uca"
= unconstrained approach,"dblcent"
= double centering approach,"pind"
= prod ind approach, with no constraints or centering,"custom"
= use parameters specified in the function call- match
should the product indicators be created by using the match-strategy
- data
Optional. Dataset to use, usually not relevant.
- ...
arguments passed to other functions (e.g., modsem_pi)
Examples
library(modsem)
library(lavaan)
m1 <- '
# Outer Model
X =~ x1 + x2 + x3
Y =~ y1 + y2 + y3
Z =~ z1 + z2 + z3
# Inner model
Y ~ X + Z + X:Z
'
syntax <- get_pi_syntax(m1)
data <- get_pi_data(m1, oneInt)
est <- sem(syntax, data)
summary(est)
#> lavaan 0.6-19 ended normally after 161 iterations
#>
#> Estimator ML
#> Optimization method NLMINB
#> Number of model parameters 60
#>
#> Number of observations 2000
#>
#> Model Test User Model:
#>
#> Test statistic 122.924
#> Degrees of freedom 111
#> P-value (Chi-square) 0.207
#>
#> 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.804 0.013 63.612 0.000
#> x3 0.916 0.014 67.144 0.000
#> Y =~
#> y1 1.000
#> y2 0.798 0.007 107.428 0.000
#> y3 0.899 0.008 112.453 0.000
#> Z =~
#> z1 1.000
#> z2 0.812 0.013 64.763 0.000
#> z3 0.882 0.013 67.014 0.000
#> XZ =~
#> x1z1 1.000
#> x2z1 0.805 0.013 60.636 0.000
#> x3z1 0.877 0.014 62.680 0.000
#> x1z2 0.793 0.013 59.343 0.000
#> x2z2 0.646 0.015 43.672 0.000
#> x3z2 0.706 0.016 44.292 0.000
#> x1z3 0.887 0.014 63.700 0.000
#> x2z3 0.716 0.016 45.645 0.000
#> x3z3 0.781 0.017 45.339 0.000
#>
#> Regressions:
#> Estimate Std.Err z-value P(>|z|)
#> Y ~
#> X 0.675 0.027 25.379 0.000
#> Z 0.561 0.026 21.606 0.000
#> XZ 0.702 0.027 26.360 0.000
#>
#> Covariances:
#> Estimate Std.Err z-value P(>|z|)
#> .x1z1 ~~
#> .x1z2 0.115 0.008 14.802 0.000
#> .x1z3 0.114 0.008 13.947 0.000
#> .x2z1 0.125 0.008 16.095 0.000
#> .x3z1 0.140 0.009 16.135 0.000
#> .x1z2 ~~
#> .x1z3 0.103 0.007 14.675 0.000
#> .x2z2 0.128 0.006 20.850 0.000
#> .x3z2 0.146 0.007 21.243 0.000
#> .x1z3 ~~
#> .x2z3 0.116 0.007 17.818 0.000
#> .x3z3 0.135 0.007 18.335 0.000
#> .x2z1 ~~
#> .x2z2 0.135 0.006 20.905 0.000
#> .x2z3 0.145 0.007 21.145 0.000
#> .x3z1 0.114 0.007 16.058 0.000
#> .x2z2 ~~
#> .x2z3 0.117 0.006 20.419 0.000
#> .x3z2 0.116 0.006 20.586 0.000
#> .x2z3 ~~
#> .x3z3 0.109 0.006 18.059 0.000
#> .x3z1 ~~
#> .x3z2 0.138 0.007 19.331 0.000
#> .x3z3 0.158 0.008 20.269 0.000
#> .x3z2 ~~
#> .x3z3 0.131 0.007 19.958 0.000
#> X ~~
#> Z 0.201 0.024 8.271 0.000
#> XZ 0.016 0.025 0.628 0.530
#> Z ~~
#> XZ 0.062 0.025 2.449 0.014
#>
#> Variances:
#> Estimate Std.Err z-value P(>|z|)
#> .x1 0.160 0.009 17.871 0.000
#> .x2 0.162 0.007 22.969 0.000
#> .x3 0.163 0.008 20.161 0.000
#> .y1 0.159 0.009 17.896 0.000
#> .y2 0.154 0.007 22.640 0.000
#> .y3 0.164 0.008 20.698 0.000
#> .z1 0.168 0.009 18.143 0.000
#> .z2 0.158 0.007 22.264 0.000
#> .z3 0.158 0.008 20.389 0.000
#> .x1z1 0.311 0.014 22.227 0.000
#> .x2z1 0.292 0.011 27.287 0.000
#> .x3z1 0.327 0.012 26.275 0.000
#> .x1z2 0.290 0.011 26.910 0.000
#> .x2z2 0.239 0.008 29.770 0.000
#> .x3z2 0.270 0.009 29.117 0.000
#> .x1z3 0.272 0.012 23.586 0.000
#> .x2z3 0.245 0.009 27.979 0.000
#> .x3z3 0.297 0.011 28.154 0.000
#> X 0.981 0.036 26.895 0.000
#> .Y 0.990 0.038 25.926 0.000
#> Z 1.016 0.038 26.856 0.000
#> XZ 1.045 0.044 24.004 0.000
#>