modsem_pi | R Documentation |
modsem_pi()
is a function for estimating interaction effects between latent variables,
in structural equation models (SEMs), using product indicators.
Methods for estimating interaction effects in SEMs can basically be split into
two frameworks:
1. Product Indicator based approaches ("dblcent"
, "rca"
, "uca"
,
"ca"
, "pind"
), and
2. Distributionally based approaches ("lms"
, "qml"
).
modsem_pi()
is essentially a fancy wrapper for lavaan::sem()
which generates the
necessary syntax and variables for the estimation of models with latent product indicators.
Use default_settings_pi()
to get the default settings for the different methods.
modsem_pi(
model.syntax = NULL,
data = NULL,
method = "dblcent",
match = NULL,
standardize.data = FALSE,
center.data = FALSE,
first.loading.fixed = TRUE,
center.before = NULL,
center.after = NULL,
residuals.prods = NULL,
residual.cov.syntax = NULL,
constrained.prod.mean = NULL,
constrained.loadings = NULL,
constrained.var = NULL,
constrained.res.cov.method = NULL,
auto.scale = "none",
auto.center = "none",
estimator = "ML",
group = NULL,
run = TRUE,
na.rm = FALSE,
suppress.warnings.lavaan = FALSE,
suppress.warnings.match = FALSE,
...
)
model.syntax |
|
data |
dataframe |
method |
method to use:
|
match |
should the product indicators be created by using the match-strategy |
standardize.data |
should data be scaled before fitting model |
center.data |
should data be centered before fitting model |
first.loading.fixed |
Should the first factor loading in the latent product be fixed to one? |
center.before |
should indicators in products be centered before computing products (overwritten by |
center.after |
should indicator products be centered after they have been computed? |
residuals.prods |
should indicator products be centered using residuals (overwritten by |
residual.cov.syntax |
should syntax for residual covariances be produced (overwritten by |
constrained.prod.mean |
should syntax for product mean be produced (overwritten by |
constrained.loadings |
should syntax for constrained loadings be produced (overwritten by |
constrained.var |
should syntax for constrained variances be produced (overwritten by |
constrained.res.cov.method |
method for constraining residual covariances |
auto.scale |
methods which should be scaled automatically (usually not useful) |
auto.center |
methods which should be centered automatically (usually not useful) |
estimator |
estimator to use in |
group |
group variable for multigroup analysis |
run |
should the model be run via |
na.rm |
should missing values be removed (case-wise)? Defaults to FALSE. If |
suppress.warnings.lavaan |
should warnings from |
suppress.warnings.match |
should warnings from |
... |
arguments passed to other functions, e.g., |
modsem
object
library(modsem)
# For more examples, check README and/or GitHub.
# One interaction
m1 <- '
# Outer Model
X =~ x1 + x2 +x3
Y =~ y1 + y2 + y3
Z =~ z1 + z2 + z3
# Inner model
Y ~ X + Z + X:Z
'
# Double centering approach
est1 <- modsem_pi(m1, oneInt)
summary(est1)
## Not run:
# The Constrained Approach
est1Constrained <- modsem_pi(m1, oneInt, method = "ca")
summary(est1Constrained)
## End(Not run)
# Theory Of Planned Behavior
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)
# Covariances
ATT ~~ SN + PBC
PBC ~~ SN
# Causal Relationships
INT ~ ATT + SN + PBC
BEH ~ INT + PBC
BEH ~ INT:PBC
'
# Double centering approach
estTpb <- modsem_pi(tpb, data = TPB)
summary(estTpb)
## Not run:
# The Constrained Approach
estTpbConstrained <- modsem_pi(tpb, data = TPB, method = "ca")
summary(estTpbConstrained)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.