scriptUni | R Documentation |
This function takes the outputted object from scrapeVarCross()
and automatically writes, returns, and exports (.txt
) lavaan
syntax
for specifying dyadic configural, loading, intercept, and residual invariant
one-factor models.
scriptUni(
dvn,
scaleset = "FF",
lvname = "X",
constr_dy_meas = c("loadings", "intercepts", "residuals"),
constr_dy_struct = "none",
writeTo = NULL,
fileName = NULL
)
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent variable. Default is
|
lvname |
Input character to (arbitrarily) name the latent variable in |
constr_dy_meas |
Input character vector detailing which measurement model parameters to constrain across dyad members. |
constr_dy_struct |
Input character vector detailing which structural model parameters to constrain across dyad members.
Note: Within the context of |
writeTo |
A character string specifying a directory path to where a |
fileName |
A character string specifying a desired base name for the |
Users do not need to modify constr_dy_struct
when using scriptUni()
.
By default, many dySEM::
functions (including scriptUni()
) default to
a fixed-factor method of scale-setting, whereby the latent variance of
a given factor is constrained to 1 for both partners in the configurally invariant
model, and then one of these variances is freely estimated in subsequent
models of the invariance testing sequence.
We have selected this default for two reasons:
(1) the selection of a marker-variable is usually arbitrary,
yet can have a large influence on the estimation and testing of of structural parameters
(see https://stats.stackexchange.com/questions/402133/in-cfa-does-it-matter-which-factor-loading-is-set-to-1/402732#402732);
and (2) the selection of a non-invariant marker-variable
can have disastrous down-stream consequences for the identification of
non-invariant measurement parameters, following a the rejection of an omnibus
invariance constraint set (see Lee, Preacher, & Little, 2011).
Character object of lavaan
script that can be passed immediately to
lavaan
functions.
scrapeVarCross
which this function relies on.
Other uni-construct script-writing functions:
scriptBifac()
,
scriptCor()
,
scriptHier()
dvn <- scrapeVarCross(
commitmentQ,
x_order = "spi",
x_stem = "sat.g",
x_delim1 = ".",
x_delim2="_",
distinguish_1="1",
distinguish_2="2"
)
sat.resids.script <- scriptUni(
dvn,
scaleset = "FF",
lvname = "Sat",
constr_dy_meas = c("loadings", "intercepts", "residuals"),
constr_dy_struct = "none",
writeTo = tempdir(),
fileName = "dUni_residual"
)
sat.ints.script <- scriptUni(
dvn,
scaleset = "FF",
lvname = "Sat",
constr_dy_meas = c("loadings", "intercepts"),
constr_dy_struct = "none",
writeTo = tempdir(),
fileName = "dUni_intercept"
)
sat.loads.script <- scriptUni(
dvn,
scaleset = "FF",
lvname = "Sat",
constr_dy_meas = c("loadings"),
constr_dy_struct = "none",
writeTo = tempdir(),
fileName = "dUni_loading"
)
sat.config.script <- scriptUni(
dvn,
scaleset = "FF",
lvname = "Sat",
constr_dy_meas = "none",
constr_dy_struct = "none",
writeTo = tempdir(),
fileName = "dUni_configural"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.