| Title: | Dyadic Structural Equation Modeling |
|---|---|
| Description: | Scripting of structural equation models via 'lavaan' for Dyadic Data Analysis, and helper functions for supplemental calculations, tabling, and model visualization. |
| Authors: | John Sakaluk [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-2515-9822>), Omar Camanto [aut] (ORCID: <https://orcid.org/0009-0009-4012-9777>), Christopher Quinn-Nilas [ctb] (ORCID: <https://orcid.org/0000-0002-8056-2008>), Merissa Prine [ctb], Robyn Kilshaw [ctb], Alexandra Fisher [ctb] |
| Maintainer: | John Sakaluk <[email protected]> |
| License: | GPL-3 |
| Version: | 2.1.0 |
| Built: | 2026-05-25 19:36:36 UTC |
| Source: | https://github.com/jsakaluk/dysem |
Creates a dvn structure for use with dySEM population scripters and simulation
workflows. Variable names are generated directly from naming conventions without
requiring an actual data frame. Compatible with scrapeVarCross naming patterns.
build_dvn( n_items_x, x_order = "sip", x_stem = "x", x_delim1 = "", x_delim2 = "_", distinguish_1 = "A", distinguish_2 = "B", n_items_y = NULL, y_order = NULL, y_stem = NULL, y_delim1 = NULL, y_delim2 = NULL )build_dvn( n_items_x, x_order = "sip", x_stem = "x", x_delim1 = "", x_delim2 = "_", distinguish_1 = "A", distinguish_2 = "B", n_items_y = NULL, y_order = NULL, y_stem = NULL, y_delim1 = NULL, y_delim2 = NULL )
n_items_x |
Number of indicators per partner (X construct; future Y support). |
x_order |
Order of (S)tem, (I)tem, (P)artner in variable names. One of |
x_stem |
Character stem of indicator variables (e.g., |
x_delim1 |
Character separating stem from item or partner. Use |
x_delim2 |
Character separating item from partner (sip) or partner from item (spi). |
distinguish_1 |
Character identifying the first partner (e.g., |
distinguish_2 |
Character identifying the second partner (e.g., |
n_items_y |
Optional number of Y indicators per partner. When non- |
y_order, y_stem, y_delim1, y_delim2
|
Y naming (default |
A list compatible with dySEM dvn structure:
p1xvarnames |
Character vector of variable names for partner 1 |
p2xvarnames |
Character vector of variable names for partner 2 |
xindper |
Number of indicators per partner |
dist1 |
First partner distinguisher |
dist2 |
Second partner distinguisher |
indnum |
Total number of indicators |
p1yvarnames, p2yvarnames, yindper
|
Included when |
Other variable-scraping functions:
scrapeVarCross()
dvn <- build_dvn( n_items_x = 3, x_order = "sip", x_stem = "x", x_delim1 = "", x_delim2 = "_", distinguish_1 = "A", distinguish_2 = "B" ) # Produces x1_A, x2_A, x3_A and x1_B, x2_B, x3_Bdvn <- build_dvn( n_items_x = 3, x_order = "sip", x_stem = "x", x_delim1 = "", x_delim2 = "_", distinguish_1 = "A", distinguish_2 = "B" ) # Produces x1_A, x2_A, x3_A and x1_B, x2_B, x3_B
A data set containing 5 ratings of satisfaction and 5 ratings of commitment for each member of a mixed-sex romantic dyad. Measured using the Investment Model Scale subscales (Rusbult, Martz, & Agnew, 1998). Data are from Sakaluk, Fisher, and Kilshaw's (2021) study of dyadic invariance. Variable names have been re-coded to follow a stem-item-partner ("sip") order, with a delimiter ("_") between the item number and partner distinguishing character.
data(commitmentM)data(commitmentM)
A data frame with 282 rows and 20 variables:
Satisfaction item 1 for female partner
Satisfaction item 2 for female partner
Satisfaction item 3 for female partner
Satisfaction item 4 for female partner
Satisfaction item 5 for female partner
Commitment items item 1 for female partner
Commitment items item 2 for female partner
Commitment items item 3 for female partner
Commitment items item 4 for female partner
Commitment items item 5 for female partner
Satisfaction item 1 for male partner
Satisfaction item 2 for male partner
Satisfaction item 3 for male partner
Satisfaction item 4 for male partner
Satisfaction item 5 for male partner
Commitment items item 1 for male partner
Commitment items item 2 for male partner
Commitment items item 3 for male partner
Commitment items item 4 for male partner
Commitment items item 5 for male partner
Sakaluk, J. K., Fisher, A. N., & Kilshaw, R. E.(2021). Dyadic measurement invariance and its importance for replicability in romantic relationship research. Personal Relationships, 28(1), 190-226. .
A data set containing 5 ratings of satisfaction and 5 ratings of commitment for each member of a dyad in which one or more members identify as LGBTQ+. Measured using the Investment Model Scale subscales (Rusbult, Martz, & Agnew, 1998). Data are from Sakaluk, Fisher, and Kilshaw (2021). Variable names follow a stem-partner-item ("spi") order, with a delimiter (".") between the stem and distinguishing partner character, and another delimiter ("_") between the distinguishing partner character and item number.
data(commitmentQ)data(commitmentQ)
A data frame with 118 rows and 20 variables:
Satisfaction item 1 for partner1
Satisfaction item 2 for partner1
Satisfaction item 3 for partner1
Satisfaction item 4 for partner1
Satisfaction item 5 for partner1
Commitment items item 1 for partner1
Commitment items item 2 for partner1
Commitment items item 3 for partner1
Commitment items item 4 for partner1
Commitment items item 5 for partner1
Satisfaction item 1 for partner 2
Satisfaction item 2 for partner 2
Satisfaction item 3 for partner 2
Satisfaction item 4 for partner 2
Satisfaction item 5 for partner 2
Commitment items item 1 for partner 2
Commitment items item 2 for partner 2
Commitment items item 3 for partner 2
Commitment items item 4 for partner 2
Commitment items item 5 for partner 2
Sakaluk, J. K., Fisher, A. N., & Kilshaw, R. E.(2021). Dyadic measurement invariance and its importance for replicability in romantic relationship research. Personal Relationships, 28(1), 190-226. .#'
A dataset containing 9 observed indicators of relationship quality (PRQC) and 5 observed indicators of sexual satisfaction from 121 couples in the DRES (Daily Relationship Experiences Study; Raposo, Impett, & Muise, 2020)
data(DRES)data(DRES)
A data frame with 121 rows and 28 variables:
PRQC item 1 for partner 1
PRQC item 2 for partner 1
PRQC item 3 for partner 1
PRQC item 4 for partner 1
PRQC item 5 for partner 1
PRQC item 6 for partner 1
PRQC item 7 for partner 1
PRQC item 8 for partner 1
PRQC item 9 for partner 1
PRQC item 1 for partner 2
PRQC item 2 for partner 2
PRQC item 3 for partner 2
PRQC item 4 for partner 2
PRQC item 5 for partner 2
PRQC item 6 for partner 2
PRQC item 7 for partner 2
PRQC item 8 for partner 2
PRQC item 9 for partner 2
sexual satisfaction item 1 for partner 1
sexual satisfaction item 2 for partner 1
sexual satisfaction item 3 for partner 1
sexual satisfaction item 4 for partner 1
sexual satisfaction item 5 for partner 1
sexual satisfaction item 1 for partner 2
sexual satisfaction item 2 for partner 2
sexual satisfaction item 3 for partner 2
sexual satisfaction item 4 for partner 2
sexual satisfaction item 5 for partner 2
Raposo, S., Impett, E. A., & Muise, A. (2020). Avoidantly Attached Individuals Are More Exchange‐Oriented and Less Communal in the Bedroom. Archives of Sexual Behavior, 49, 2863–2881. https://doi.org/10.1007/s10508-020-01813-9
A function that performs a score test for relaxing each invariance equality constraint between partners in a given dyadic SEM model.
getConstraintTests(constrainFit, filterSig = FALSE)getConstraintTests(constrainFit, filterSig = FALSE)
constrainFit |
fitted lavaan model with dyadic invariance equality constraints |
filterSig |
logical indicating whether to filter for significant constraints (default is FALSE) |
a data frame with rows of equality constraints (now with readable param labels) and test statistic, df, and p for whether constraint worsens model fit
dvn <- scrapeVarCross(dat = commitmentM, x_order = "sip", x_stem = "sat.g", x_delim2="_", distinguish_1="f", distinguish_2="m") sat.resids.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none") sat.resids.mod <- lavaan::cfa(sat.resids.script, data = commitmentM, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) getConstraintTests(sat.resids.mod)dvn <- scrapeVarCross(dat = commitmentM, x_order = "sip", x_stem = "sat.g", x_delim2="_", distinguish_1="f", distinguish_2="m") sat.resids.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none") sat.resids.mod <- lavaan::cfa(sat.resids.script, data = commitmentM, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) getConstraintTests(sat.resids.mod)
Calculates dmacs difference in expected indicator scores for between dyad members
getDydmacs(dat, dvn, fit, nodewidth = 0.01, lowerLV = -5, upperLV = 5)getDydmacs(dat, dvn, fit, nodewidth = 0.01, lowerLV = -5, upperLV = 5)
dat |
data frame of indicators |
dvn |
input dvn list from scrapeVarCross |
fit |
outputted dyadic cfa lavaan object; should be from a partial-invariance model |
nodewidth |
space between nodes during quadrature approximation (default = .01) |
lowerLV |
lowest latent variable value evaluated (default = -5) |
upperLV |
greatest latent variable value evaluated (default = 5) |
For single LV models: a matrix with one column "dMACS" containing d_macs values. For multiple LV models: a named list of matrices, where each element corresponds to one LV and contains a matrix with one column "dMACS" containing d_macs values for that LV.
Other supplemental model calculators:
getDyReliability(),
getIndistFit()
dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2") sat.config.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none") sat.config.mod <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) getDydmacs(commitmentQ, dvn, sat.config.mod)dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2") sat.config.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none") sat.config.mod <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) getDydmacs(commitmentQ, dvn, sat.config.mod)
This function takes the model from fitted scriptCor() scripts and returns omega total coefficients for each dyad member, adapted following Formula 2 in McNeish (2018).
getDyReliability(dvn, fit)getDyReliability(dvn, fit)
dvn |
input dvn list from scrapeVarCross |
fit |
outputted dyadic cfa lavaan object based on the default (i.e., "configural") dyadCFA() function |
a tibble/data frame with calculated omega total coefficients for dyad Member 1 and Member 2
Other supplemental model calculators:
getDydmacs(),
getIndistFit()
dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2") sat.indist.script <- scriptCor(dvn, lvname = "Sat") sat.indist.mod <- lavaan::cfa(sat.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) getDyReliability(dvn, sat.indist.mod)dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2") sat.indist.script <- scriptCor(dvn, lvname = "Sat") sat.indist.mod <- lavaan::cfa(sat.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) getDyReliability(dvn, sat.indist.mod)
This function takes the outputted model fit using scriptCor() with model = "indist", as well as scriptISAT(), and scriptINULL() and computes corrected model fit indexes according to the approach outlined by Olsen & Kenny (2006)
getIndistFit(indmodel, isatmod, inullmod)getIndistFit(indmodel, isatmod, inullmod)
indmodel |
input lavaan model object fitted using dyadCFA(model = "indistinguishable") |
isatmod |
input lavaan model object fitted using ISAT() |
inullmod |
input lavaan model object fitted using INULL() |
A data frame of the original and corrected chi sq, df, p, rmsea, and tli
Other supplemental model calculators:
getDyReliability(),
getDydmacs()
dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.indist.script <- scriptCor(dvn, lvname = "Sat") sat.indist.mod <- lavaan::cfa(sat.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.isat.script <- scriptISAT(dvn, lvxname = "Sat") sat.isat.mod <- lavaan::cfa(sat.isat.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = FALSE ) sat.inull.script <- scriptINULL(dvn, lvxname = "Sat") sat.inull.mod <- lavaan::cfa(sat.inull.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = FALSE ) getIndistFit(sat.indist.mod, sat.isat.mod, sat.inull.mod)dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.indist.script <- scriptCor(dvn, lvname = "Sat") sat.indist.mod <- lavaan::cfa(sat.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.isat.script <- scriptISAT(dvn, lvxname = "Sat") sat.isat.mod <- lavaan::cfa(sat.isat.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = FALSE ) sat.inull.script <- scriptINULL(dvn, lvxname = "Sat") sat.inull.mod <- lavaan::cfa(sat.inull.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = FALSE ) getIndistFit(sat.indist.mod, sat.isat.mod, sat.inull.mod)
Compare model fit of nested dyadic invariance models in order from most parsimonious (residual) to least parsimonious (configural)
getInvarCompTable(mods)getInvarCompTable(mods)
mods |
a list of neted lavaan dyadic invariance models, in the order of residual, intercept, loading, configural |
a data frame of model fit statistics for each model, as well as the difference in fit statistics between each model and the previous model
dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.residual.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none" ) sat.intercept.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none" ) sat.loading.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none" ) sat.config.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none" ) sat.residual.fit <- lavaan::cfa(sat.residual.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.intercept.fit <- lavaan::cfa(sat.intercept.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.loading.fit <- lavaan::cfa(sat.loading.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.config.fit <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) mods <- list(sat.residual.fit, sat.intercept.fit, sat.loading.fit, sat.config.fit) getInvarCompTable(mods)dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.residual.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none" ) sat.intercept.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none" ) sat.loading.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none" ) sat.config.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none" ) sat.residual.fit <- lavaan::cfa(sat.residual.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.intercept.fit <- lavaan::cfa(sat.intercept.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.loading.fit <- lavaan::cfa(sat.loading.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.config.fit <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) mods <- list(sat.residual.fit, sat.intercept.fit, sat.loading.fit, sat.config.fit) getInvarCompTable(mods)
A data set containing 5 ratings for each of (1) satisfaction, (2) quality of alternatives, (3) investment, and 4 (commitment) for each member of a mixed-sex romantic dyad. Measured using the Investment Model Scale subscales (Rusbult, Martz, & Agnew, 1998). Data are from Sakaluk, Fisher, and Kilshaw's (2021) study of dyadic invariance. Variable names have been re-coded to follow a stem-item-partner ("sip") order, with a delimiter ("_") between the item number and partner distinguishing character.
data(imsM)data(imsM)
A data frame with 282 rows and 40 variables:
Satisfaction item 1 for female partner
Satisfaction item 2 for female partner
Satisfaction item 3 for female partner
Satisfaction item 4 for female partner
Satisfaction item 5 for female partner
Quality of alternatives item 1 for female partner
Quality of alternatives item 2 for female partner
Quality of alternatives item 3 for female partner
Quality of alternatives item 4 for female partner
Quality of alternatives item 5 for female partner
Investment item 1 for female partner
Investment item 2 for female partner
Investment item 3 for female partner
Investment item 4 for female partner
Investment item 5 for female partner
Commitment items item 1 for female partner
Commitment items item 2 for female partner
Commitment items item 3 for female partner
Commitment items item 4 for female partner
Commitment items item 5 for female partner
Satisfaction item 1 for male partner
Satisfaction item 2 for male partner
Satisfaction item 3 for male partner
Satisfaction item 4 for male partner
Satisfaction item 5 for male partner
Quality of alternatives item 1 for male partner
Quality of alternatives item 2 for male partner
Quality of alternatives item 3 for male partner
Quality of alternatives item 4 for male partner
Quality of alternatives item 5 for male partner
Investment item 1 for male partner
Investment item 2 for male partner
Investment item 3 for male partner
Investment item 4 for male partner
Investment item 5 for male partner
Commitment items item 1 for male partner
Commitment items item 2 for male partner
Commitment items item 3 for male partner
Commitment items item 4 for male partner
Commitment items item 5 for male partner
Sakaluk, J. K., Fisher, A. N., & Kilshaw, R. E.(2021). Dyadic measurement invariance and its importance for replicability in romantic relationship research. Personal Relationships, 28(1), 190-226. .
Opens a Shiny application that guides researchers through selecting a dyadic model, configuring invariance constraints and variable naming patterns, previewing a path diagram, and generating the corresponding lavaan syntax.
launchScripter(launch.browser = TRUE)launchScripter(launch.browser = TRUE)
launch.browser |
Logical; if |
The app supports uni-construct (unidimensional, correlated, hierarchical, bifactor), bi-construct (L-APIM, Common Fate, Mutual Influence, Two-Construct), and multi-construct (multiple correlated factors) models.
No data upload is required. The app constructs variable names from naming patterns you specify, generates lavaan syntax via dySEM scripters, and provides a path diagram preview, copy-to-clipboard, download, and reproducible R code.
Requires the shiny, bslib, and shinyjs packages (listed in Suggests).
Called for its side effect (launching the app). Returns the value
from runApp invisibly.
## Not run: launchScripter() ## End(Not run)## Not run: launchScripter() ## End(Not run)
outputConstraintTab() is used to perform a score test for relaxing each
invariance equality constraint between partners in a given dyadic SEM model.
outputConstraintTab( constrainFit, filterSig = FALSE, gtTab = FALSE, writeTo = NULL, fileName = NULL )outputConstraintTab( constrainFit, filterSig = FALSE, gtTab = FALSE, writeTo = NULL, fileName = NULL )
constrainFit |
A fitted |
filterSig |
A logical indicating whether to filter for significant constraints (default is |
gtTab |
A logical input indicating whether to generate the table(s) in
|
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
If gtTab = TRUE and writeTo is specified, then output will simultaneously be saved as a .rtf file to the user's specified directory.
If output file is successfully saved, a confirmation message will be printed to the console.
If a file with the same name already exists in the user's chosen directory, it will be overwritten.
A tibble::tibble() if gtTab = FALSE (default), or gt::gt() object if gtTab = TRUE, with
rows of equality constraints (now with readable param labels) and test statistic, df, and p for whether constraint worsens model fit.
dvn <- scrapeVarCross( dat = commitmentM, x_order = "sip", x_stem = "sat.g", x_delim2 = "_", distinguish_1 = "f", distinguish_2 = "m" ) sat.resids.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none" ) sat.resids.mod <- lavaan::cfa(sat.resids.script, data = commitmentM, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputConstraintTab(sat.resids.mod, filterSig = FALSE, gtTab = TRUE, writeTo = tempdir(), fileName = "dCFA_Residual" )dvn <- scrapeVarCross( dat = commitmentM, x_order = "sip", x_stem = "sat.g", x_delim2 = "_", distinguish_1 = "f", distinguish_2 = "m" ) sat.resids.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none" ) sat.resids.mod <- lavaan::cfa(sat.resids.script, data = commitmentM, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputConstraintTab(sat.resids.mod, filterSig = FALSE, gtTab = TRUE, writeTo = tempdir(), fileName = "dCFA_Residual" )
outputInvarCompTab() is used to compare the model fit of nested dyadic invariance models
in order from most parsimonious (residual) to least parsimonious (configural)
outputInvarCompTab( mods, parsimonyFirst = FALSE, gtTab = FALSE, writeTo = NULL, fileName = NULL )outputInvarCompTab( mods, parsimonyFirst = FALSE, gtTab = FALSE, writeTo = NULL, fileName = NULL )
mods |
A list of nested |
parsimonyFirst |
A logical input indicating whether to prioritize the residual dyadic invariance (i.e. most parsimonious measurement model) as the baseline model for nested comparisons, or to prioritize the configural dyadic invariance (i.e. least parsimonious measurement model). Defaults to FALSE (i.e., configural dyadic invariance is the baseline model). |
gtTab |
A logical input indicating whether to generate the table(s) in
|
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
If gtTab = TRUE and writeTo is specified, then output will simultaneously be saved as a .rtf file to the user's specified directory.
If output file is successfully saved, a confirmation message will be printed to the console.
If a file with the same name already exists in the user's chosen directory, it will be overwritten.
A tibble::tibble() if gtTab = FALSE (default), or gt::gt() object if gtTab = TRUE, of model fit statistics for each model, as well as the difference in fit statistics between each model and the previous model
dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.residual.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none" ) sat.intercept.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none" ) sat.loading.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none" ) sat.config.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none" ) sat.residual.fit <- lavaan::cfa(sat.residual.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.intercept.fit <- lavaan::cfa(sat.intercept.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.loading.fit <- lavaan::cfa(sat.loading.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.config.fit <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) mods <- list(sat.residual.fit, sat.intercept.fit, sat.loading.fit, sat.config.fit) outputInvarCompTab(mods, parsimonyFirst = FALSE, gtTab = TRUE, writeTo = tempdir(), fileName = "dCFA_Invar_Standard" ) mods <- list(sat.config.fit, sat.loading.fit, sat.intercept.fit, sat.residual.fit) outputInvarCompTab(mods, parsimonyFirst = TRUE, gtTab = TRUE, writeTo = tempdir(), fileName = "dCFA_Invar_Reverse" )dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.residual.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none" ) sat.intercept.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none" ) sat.loading.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none" ) sat.config.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none" ) sat.residual.fit <- lavaan::cfa(sat.residual.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.intercept.fit <- lavaan::cfa(sat.intercept.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.loading.fit <- lavaan::cfa(sat.loading.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) sat.config.fit <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) mods <- list(sat.residual.fit, sat.intercept.fit, sat.loading.fit, sat.config.fit) outputInvarCompTab(mods, parsimonyFirst = FALSE, gtTab = TRUE, writeTo = tempdir(), fileName = "dCFA_Invar_Standard" ) mods <- list(sat.config.fit, sat.loading.fit, sat.intercept.fit, sat.residual.fit) outputInvarCompTab(mods, parsimonyFirst = TRUE, gtTab = TRUE, writeTo = tempdir(), fileName = "dCFA_Invar_Reverse" )
outputInvarItem() generates a summary table showing which items exhibit
noninvariance in loadings and/or intercepts based on a partial invariance model script,
along with dMACS effect sizes for each item.
outputInvarItem( dvn, fit, partialScript, dat, nodewidth = 0.01, lowerLV = -5, upperLV = 5, gtTab = FALSE, writeTo = NULL, fileName = NULL )outputInvarItem( dvn, fit, partialScript, dat, nodewidth = 0.01, lowerLV = -5, upperLV = 5, gtTab = FALSE, writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross |
fit |
outputted dyadic cfa lavaan object from the partial invariance model |
partialScript |
character string containing the lavaan syntax for the partial invariance model |
dat |
data frame of indicators used to fit the model (needed for dMACS calculation) |
nodewidth |
space between nodes during quadrature approximation for dMACS (default = .01) |
lowerLV |
lowest latent variable value evaluated for dMACS (default = -5) |
upperLV |
greatest latent variable value evaluated for dMACS (default = 5) |
gtTab |
A logical input indicating whether to generate the output in |
writeTo |
A character string specifying a directory path to where the |
fileName |
A character string specifying a desired base name for the output |
The function parses the lavaan syntax to determine which loadings and intercepts are constrained to equality across partners (invariant) versus freed (noninvariant).
LoadingNoninvariance = "Yes" indicates the loading was freed in the partial invariance model.
InterceptNoninvariance = "Yes" indicates the intercept was freed in the partial invariance model.
dMACS values are calculated using the getDydmacs() function.
If gtTab = TRUE and writeTo is specified, then output will simultaneously be saved as a .rtf file to the user's specified directory.
If output file is successfully saved, a confirmation message will be printed to the console.
If a file with the same name already exists in the user's chosen directory, it will be overwritten.
A tibble::tibble() if gtTab = FALSE (default), or gt::gt() object if gtTab = TRUE, with
columns for Item, LoadingNoninvariance, InterceptNoninvariance, and dMACS. For multi-LV structures,
an additional LV column is included; in gt tables, this is used as the row group label with Item names
as row labels within each group.
## Not run: dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2") # Create and fit a partial invariance model partial.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none") partial.fit <- lavaan::cfa(partial.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE) outputInvarItem(dvn, partial.fit, partial.script, dat = commitmentQ, gtTab = TRUE, writeTo = tempdir(), fileName = "item_invar") ## End(Not run)## Not run: dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2") # Create and fit a partial invariance model partial.script <- scriptCor(dvn, lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none") partial.fit <- lavaan::cfa(partial.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE) outputInvarItem(dvn, partial.fit, partial.script, dat = commitmentQ, gtTab = TRUE, writeTo = tempdir(), fileName = "item_invar") ## End(Not run)
This function takes the model from fitted dySEM() scripts and exports table(s) and/or a path diagram figure of expected output.
outputModel( dvn, model = NULL, fit, table = TRUE, tabletype = NULL, figure = TRUE, figtype = NULL, writeTo = NULL, fileName = NULL )outputModel( dvn, model = NULL, fit, table = TRUE, tabletype = NULL, figure = TRUE, figtype = NULL, writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross |
model |
character input specifying type of model to output (e.g., "cfa", "apim", "cfm") |
fit |
input object from fitted lavaan model |
table |
logical input of whether table output is desired. Default is TRUE |
tabletype |
character input of what type of table(s) is(are) desired. options are "measurement" (i.e,, loadings, intercepts,), "structural" (i.e., latent slopes, such as actor/partner effects, k parameters), or "both" (i.e., both measurement and structural tables) |
figure |
logical input of whether figure output is desired. Default is TRUE |
figtype |
character input of what type of figure is desired |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
If a file with the same name already exists in the user's chosen directory, it will be overwritten.
Ignore console (prints unnecessary semPlot::semPaths details). More importantly, prints word files for the table(s) and/or figure, outputted to the users working directory
dvnx <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2") sat.config.script <- scriptCor(dvnx, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none") sat.config.mod <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) outputModel(dvnx, model = "cfa", fit = sat.config.mod, table = TRUE, tabletype = "measurement", figure = "TRUE", figtype = "standardized", writeTo = tempdir(), fileName = "dCFA_configural") dvnxy <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2", y_order="spi", y_stem="com", y_delim1 = ".", y_delim2="_") apim.indist.script <- scriptAPIM(dvnxy, lvxname = "Sat", lvyname = "Com", est_k = TRUE) apim.indist.mod <- lavaan::cfa(apim.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) outputModel(dvnxy, model = "apim", fit = apim.indist.mod, table = TRUE, tabletype = "measurement", figure = "TRUE", figtype = "standardized", writeTo = tempdir(), fileName = "APIM_indist")dvnx <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2") sat.config.script <- scriptCor(dvnx, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none") sat.config.mod <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) outputModel(dvnx, model = "cfa", fit = sat.config.mod, table = TRUE, tabletype = "measurement", figure = "TRUE", figtype = "standardized", writeTo = tempdir(), fileName = "dCFA_configural") dvnxy <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2", y_order="spi", y_stem="com", y_delim1 = ".", y_delim2="_") apim.indist.script <- scriptAPIM(dvnxy, lvxname = "Sat", lvyname = "Com", est_k = TRUE) apim.indist.mod <- lavaan::cfa(apim.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first= FALSE, meanstructure = TRUE) outputModel(dvnxy, model = "apim", fit = apim.indist.mod, table = TRUE, tabletype = "measurement", figure = "TRUE", figtype = "standardized", writeTo = tempdir(), fileName = "APIM_indist")
This function takes the model from fitted dySEM scripts and exports .png path diagram figures of expected output.
outputParamFig(fit, figtype = NULL, writeTo = NULL, fileName = NULL)outputParamFig(fit, figtype = NULL, writeTo = NULL, fileName = NULL)
fit |
Input object from fitted |
figtype |
A character input of what type of model is desired:
|
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
The function uses semPlot::semPaths() to create a qgraph object of the desired SEM path diagram.
After execution, a semPlot::semPaths() message will be printed to the console confirming the directory path of the saved output file.
If a file with the same name already exists in the user's chosen directory, it will be overwritten.
A qgraph object of the desired SEM path diagram, which is simultaneously exported as a .png file to the specified directory.
dvnx <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.config.script <- scriptCor(dvnx, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none" ) sat.config.mod <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputParamFig(sat.config.mod, figtype = "standardized", writeTo = tempdir(), fileName = "dCFA_configural" ) dvnxy <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" ) apim.indist.script <- scriptAPIM(dvnxy, lvxname = "Sat", lvyname = "Com", est_k = TRUE) apim.indist.mod <- lavaan::cfa(apim.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputParamFig(apim.indist.mod, figtype = "standardized", writeTo = tempdir(), fileName = "APIM_indist" )dvnx <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.config.script <- scriptCor(dvnx, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none" ) sat.config.mod <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputParamFig(sat.config.mod, figtype = "standardized", writeTo = tempdir(), fileName = "dCFA_configural" ) dvnxy <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" ) apim.indist.script <- scriptAPIM(dvnxy, lvxname = "Sat", lvyname = "Com", est_k = TRUE) apim.indist.mod <- lavaan::cfa(apim.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputParamFig(apim.indist.mod, figtype = "standardized", writeTo = tempdir(), fileName = "APIM_indist" )
This function takes the model from fitted dySEM scripts and
creates tables of expected output and/or exports them as .rtfs.
outputParamTab( dvn, model = NULL, fit, tabletype = NULL, gtTab = FALSE, writeTo = NULL, fileName = NULL )outputParamTab( dvn, model = NULL, fit, tabletype = NULL, gtTab = FALSE, writeTo = NULL, fileName = NULL )
dvn |
Input dvn list from |
model |
A character input specifying type of model to output: "cfa", "bidyc", "apim", "mim", "cfm", or "bidys". |
fit |
input object from fitted |
tabletype |
A character input of what type of table(s) is(are) desired. Options are "measurement" (i.e., loadings, intercepts, etc.), "structural" (i.e., latent slopes, such as actor/partner effects, k parameters), "both" (i.e., both measurement and structural tables), or "correlation" (for a table of factor correlations). |
gtTab |
A logical input indicating whether to generate the table(s) in
|
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
If gtTab = TRUE and writeTo is specified, then output will simultaneously be saved as a .rtf file to the user's specified directory.
If output file(s) is(are) successfully saved, a confirmation message will be printed to the console.
If a file with the same name already exists in the user's chosen directory, it will be overwritten.
A tibble::tibble() if gtTab = FALSE (default), or gt::gt() object if gtTab = TRUE, of specified model parameter estimates and corresponding statistical tests.
dvnx <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.config.script <- scriptCor(dvnx, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none" ) sat.config.mod <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputParamTab(dvnx, model = "cfa", sat.config.mod, tabletype = "measurement", writeTo = tempdir(), fileName = "dCFA_configural" ) dvnxy <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" ) apim.indist.script <- scriptAPIM(dvnxy, lvxname = "Sat", lvyname = "Com", est_k = TRUE) apim.indist.mod <- lavaan::cfa(apim.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputParamTab(dvnxy, model = "cfa", sat.config.mod, tabletype = "measurement", writeTo = tempdir(), fileName = "APIM_indist" )dvnx <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.config.script <- scriptCor(dvnx, lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none" ) sat.config.mod <- lavaan::cfa(sat.config.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputParamTab(dvnx, model = "cfa", sat.config.mod, tabletype = "measurement", writeTo = tempdir(), fileName = "dCFA_configural" ) dvnxy <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" ) apim.indist.script <- scriptAPIM(dvnxy, lvxname = "Sat", lvyname = "Com", est_k = TRUE) apim.indist.mod <- lavaan::cfa(apim.indist.script, data = commitmentQ, std.lv = FALSE, auto.fix.first = FALSE, meanstructure = TRUE ) outputParamTab(dvnxy, model = "cfa", sat.config.mod, tabletype = "measurement", writeTo = tempdir(), fileName = "APIM_indist" )
This function takes the outputted object from scrapeVarCross()
along with the corresponding dataset and automatically tests competing
uni-construct dyadic models for the latent variable under consideration.
It inspects four possible model variants:
Bifactor (scripted via dySEM::scriptBifac)
Hierarchical (scripted via dySEM::scriptHier)
Correlated Factors (scripted via dySEM::scriptCor)
Unidimensional (scripted via dySEM::scriptUni)
outputUniConstructComp( dvn, dat, indexes = c("df", "chisq", "cfi", "rmsea", "bic", "GenTEFI"), ..., gtTab = FALSE, writeTo = NULL, fileName = NULL )outputUniConstructComp( dvn, dat, indexes = c("df", "chisq", "cfi", "rmsea", "bic", "GenTEFI"), ..., gtTab = FALSE, writeTo = NULL, fileName = NULL )
dvn |
Input dvn list from |
dat |
Input data frame containing the dataset for model estimation. |
indexes |
Input character vector specifying which index(es) to return.
Default is
|
... |
Additional arguments to be passed to |
gtTab |
A logical input indicating whether to generate the table(s) in
|
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
If "chisq" is included in indexes, the specific form of the applied
chi-squared difference test (e.g., standard vs. robust) is determined
automatically by lavaan::lavTestLRT(), based on the model estimation
method used.
If gtTab = TRUE and writeTo is specified, then output will simultaneously
be saved as a .rtf file to the user's specified directory.
If output file is successfully saved, a confirmation message will be printed to the console.
If a file with the same name already exists in the user's chosen directory, it will be overwritten.
A list containing up to two components:
Indexes: A tibble::tibble() if gtTab = FALSE (default), or gt::gt()
object if gtTab = TRUE, with the desired index(es) for each fitted model
(requested via the indexes argument).
GenTEFI: A tibble::tibble() of the GenTEFI (if "GenTEFI" is included in
the indexes argument).
dvn <- scrapeVarCross( commitmentM, x_order = "sip", x_stem = "sat.g", x_delim1 = "", x_delim2 = "_", distinguish_1 = "f", distinguish_2 = "m" ) # Quick example for CRAN checks outputUniConstructComp( dvn, commitmentM, indexes = c("df", "bic"), missing = "listwise" ) # More comprehensive examples (slower due to FIML estimation) outputUniConstructComp( dvn, commitmentM, missing = "fiml" ) outputUniConstructComp( dvn, commitmentM, indexes = c("df", "bic"), missing = "fiml" ) outputUniConstructComp( dvn, commitmentM, indexes = c("df", "bic"), estimator = "ml", missing = "fiml" ) outputUniConstructComp( dvn, commitmentM, indexes = c("df", "bic"), missing = "fiml", gtTab = TRUE, writeTo = tempdir(), fileName = "uni-construct-dyad-models" )dvn <- scrapeVarCross( commitmentM, x_order = "sip", x_stem = "sat.g", x_delim1 = "", x_delim2 = "_", distinguish_1 = "f", distinguish_2 = "m" ) # Quick example for CRAN checks outputUniConstructComp( dvn, commitmentM, indexes = c("df", "bic"), missing = "listwise" ) # More comprehensive examples (slower due to FIML estimation) outputUniConstructComp( dvn, commitmentM, missing = "fiml" ) outputUniConstructComp( dvn, commitmentM, indexes = c("df", "bic"), missing = "fiml" ) outputUniConstructComp( dvn, commitmentM, indexes = c("df", "bic"), estimator = "ml", missing = "fiml" ) outputUniConstructComp( dvn, commitmentM, indexes = c("df", "bic"), missing = "fiml", gtTab = TRUE, writeTo = tempdir(), fileName = "uni-construct-dyad-models" )
A data set containing ratings on items (4 each) assessing romantic (1) satisfaction and (2) dissatisfaction for each member of a mixed-sex dyad . Positive-Negative Relationship Quality Scale (Rogge et al., 2017). Data are from Prine et al. (Under Review). Variable names follow a stem-item-partner ("sip") order, with a delimiter ("_") between the item number and distinguishing partner character.
data(pnrqM)data(pnrqM)
A data frame with 219 rows and 16 variables. Participants responded–on a six-point scale (1 = "Not at all true", 6 = "Completely true")–to the prompt, "My relationship is...":
Enjoyable for partner w
Pleasant for partner w
Strong for partner w
Alive for partner w
Miserable for partner w
Bad for partner w
Empty for partner w
Lifeless for partner w
Enjoyable for partner m
Pleasant for partner m
Strong for partner m
Alive for partner m
Miserable for partner m
Bad for partner m
Empty for partner m
Lifeless for partner m
Prine, M., Sakaluk, J. K., Camanto, O. J., & Quinn-Nilas, C. (Under Review).
A data set containing ratings on items (3 each) assessing romantic: (1) satisfaction, (2) commitment, (3) intimacy, (4) trust, (5) passion, and (6) love for each member of a dyad in which one or more members identify as LGBTQ+. Perceived Relationship Quality Components (PRQC) Inventory (Fletcher, Simpson, & Thomas, 2000). Data are from Sakaluk, Fisher, and Kilshaw (2021). Variable names follow a stem-partner-item ("spi") order, with a delimiter (".") between the stem and distinguishing partner character, and another delimiter ("_") between the distinguishing partner character and item number.
data(prqcQ)data(prqcQ)
A data frame with 118 rows and 36 variables:
Satisfaction item 1 for partner 1
Satisfaction item 2 for partner 1
Satisfaction item 3 for partner 1
Commitment item 1 for partner 1
Commitment item 2 for partner 1
Commitment item 3 for partner 1
Intimacy item 1 for partner 1
Intimacy item 2 for partner 1
Intimacy item 3 for partner 1
Trust item 1 for partner 1
Trust item 2 for partner 1
Trust item 3 for partner 1
Passion item 1 for partner 1
Passion item 2 for partner 1
Passion item 3 for partner 1
Love item 1 for partner 1
Love item 2 for partner 1
Love item 3 for partner 1
Satisfaction item 1 for partner 2
Satisfaction item 2 for partner 2
Satisfaction item 3 for partner 2
Commitment item 1 for partner 2
Commitment item 2 for partner 2
Commitment item 3 for partner 2
Intimacy item 1 for partner 2
Intimacy item 2 for partner 2
Intimacy item 3 for partner 2
Trust item 1 for partner 2
Trust item 2 for partner 2
Trust item 3 for partner 2
Passion item 1 for partner 2
Passion item 2 for partner 2
Passion item 3 for partner 2
Love item 1 for partner 2
Love item 2 for partner 2
Love item 3 for partner 2
Sakaluk, J. K., Fisher, A. N., & Kilshaw, R. E.(2021). Dyadic measurement invariance and its importance for replicability in romantic relationship research. Personal Relationships, 28(1), 190-226. .#'
This function scrapes the names of indicator variables in a wide-format data set used for dyadic analyses of two latent variables (LV; X and Y), and indexes which indicators correspond to which partner, for which LV. It is used primarily to guide the syntax-writing of the other dySEM functions.
scrapeVarCross( dat, x_order = "spi", x_stem, x_delim1 = NULL, x_delim2 = NULL, x_item_num = "\\d+", distinguish_1 = "1", distinguish_2 = "2", y_order = NULL, y_stem = NULL, y_delim1 = NULL, y_delim2 = NULL, y_item_num = "\\d+", var_list = NULL, var_list_order = NULL, var_list_item_num = "\\d+", group = NULL, covs_order = NULL, covs_stem = NULL, covs_delim1 = NULL, covs_delim2 = NULL, verbose = TRUE )scrapeVarCross( dat, x_order = "spi", x_stem, x_delim1 = NULL, x_delim2 = NULL, x_item_num = "\\d+", distinguish_1 = "1", distinguish_2 = "2", y_order = NULL, y_stem = NULL, y_delim1 = NULL, y_delim2 = NULL, y_item_num = "\\d+", var_list = NULL, var_list_order = NULL, var_list_item_num = "\\d+", group = NULL, covs_order = NULL, covs_stem = NULL, covs_delim1 = NULL, covs_delim2 = NULL, verbose = TRUE )
dat |
input data frame of indicators of a particular LV |
x_order |
input character for order of (S)tem, (P)artner number, and (I)tem number when creating variable names. Defaults to "spi" (Qualtrics-friendly), but can alternatively take "sip" or "psi" |
x_stem |
input character stem of indicator variables for LV X |
x_delim1 |
optional character to separate stem from partner number (spi) or item number (sip) |
x_delim2 |
optional character to separate stem/partner number (spi) or stem/item number (sip) from from final element of variable name |
x_item_num |
defaults to scrape all items that match the stem with any digits that follow. Will be updated to allow particular range of values, to make more sub-scale friendly. |
distinguish_1 |
input character used as the identifier for the first partner |
distinguish_2 |
input character used as the identifier for the first partner |
y_order |
optional character for order of (S)tem, (P)artner number, and (I)tem number when creating variable names. Defaults to "spi" (Qualtrics-friendly), but can alternatively take "sip" or "psi". This and other Y-arguments only necessary if there is a latent Y variable to model |
y_stem |
optional input character stem of indicator variables for LV X |
y_delim1 |
optional character to separate stem from partner number (spi) or item number (sip) |
y_delim2 |
optional character to separate stem/partner number (spi) or stem/item number (sip) from from final element of variable name |
y_item_num |
defaults to scrape all items that match the stem with any digits that follow. Will be updated to allow particular range of values, to make more sub-scale friendly. |
var_list |
optional named list of indicator variable information, if more than one LV is to be scripted (e.g., a dyadic CFA with multiple sub-scales from the same measure). If supplied, this list must contain the following elements: "stem" (a vector of stems), "delim1" (a vector of delimiting characters), and"delim2" (a vector of subsequently delimiting characters). Optionally may include numeric vectors "min_num" and "max_num" if indicators for different LVs share the same stem and must be separated by range of item numbers within a measure. |
var_list_order |
optional character for order of (S)tem, (P)artner number, and (I)tem number for any of the indicator variables of a multi-LV model (i.e., this functionality assumes the same ordering of elements throughout) |
var_list_item_num |
optional character for item number of any of the indicator variables of a multi-LV model |
group |
optional character naming a column in |
covs_order |
optional character for order of (S)tem, (P)artner number, and (I)tem number for any covariate(s). Defaults to NULL. This and other covariate arguments only necessary if there are covariates to be scripted in your model(s). |
covs_stem |
optional input character stem(s) of indicator variables for covariate(s). Can accept a single stem (e.g., "anx"), or a vector of stems (e.g., c("anx", "dep")). Defaults to NULL. |
covs_delim1 |
optional character to separate stem from partner number (spi) or item number (sip) for covariate(s). Defaults to NULL. |
covs_delim2 |
optional character to separate stem/partner number (spi) or stem/item number (sip) from |
verbose |
logical indicating whether to print a summary of scraped variables to the console. Defaults to TRUE. |
a list, referred in short-hand as a "dvn" (dyad variable names list) containing variable names for p1, p2, # of items per LV, characters distinguishing partners, and total number of indicators
Other variable-scraping functions:
build_dvn()
dvnx <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) dvnxy <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" )dvnx <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) dvnxy <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" )
This function takes the outputted object from scrapeVarCross() and automatically writes, returns, and exports (.txt) lavaan() syntax for specifying Actor-Partner Interdependence Models (APIMs). Users can also invoke configural, loading, and/or intercept invariant measurement models, and particular types of structural comparisons.
scriptAPIM( dvn, scaleset = "FF", lvxname, lvyname, constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = c("actors", "partners"), includeMeanStruct = FALSE, model = lifecycle::deprecated(), equate = lifecycle::deprecated(), est_k = FALSE, writeTo = NULL, fileName = NULL )scriptAPIM( dvn, scaleset = "FF", lvxname, lvyname, constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = c("actors", "partners"), includeMeanStruct = FALSE, model = lifecycle::deprecated(), equate = lifecycle::deprecated(), est_k = FALSE, writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross |
scaleset |
Input character to specify how to set the scale of the latent
variable(s). Default is |
lvxname |
input character to (arbitrarily) name LV X in lavaan syntax |
lvyname |
input character to (arbitrarily) name LV Y in lavaan syntax |
constr_dy_x_meas |
input character vector detailing which measurement model parameters to constrain across dyad members for latent X. Default is c("loadings", "intercepts", "residuals"), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model |
constr_dy_x_struct |
input character vector detailing which structural model parameters to constrain across dyad members for latent X. Default is c("variances", "means"), but user can specify any combination of "variances", "means", and/or "orthogonal" (zero dyadic covariance between partners' latent X), or "none". |
constr_dy_y_meas |
input character vector detailing which measurement model parameters to constrain across dyad members for latent X. Default is c("loadings", "intercepts", "residuals"), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model |
constr_dy_y_struct |
input character vector detailing which structural model parameters to constrain across dyad members for latent Y. Default is c("variances", "means"), but user can specify any combination of "variances", "means", and/or "orthogonal" (zero dyadic covariance between partners' latent Y), or "none". |
constr_dy_xy_struct |
input character vector detailing which structural model parameters to constrain for modeling the predictive association(s) between partners' latent x and y. Default is c("actors", "partners"), but users can also specify "all", "actors_zero", "partners_zero", or "none". |
includeMeanStruct |
input logical for whether the user wants to include the mean structure in the model. Defaults FALSE, to support subsequent calculation of dynamic fit indexes (see Details) |
model |
Deprecated input character used to specify which level of invariance is modeled. Users should rely upon constr_dy_x_meas/constr_dy_y_meas and constr_dy_x_struct/constr_dy_y_struct instead, for making constraints to the measurement and/or structural portions of the model for latent x and y. |
equate |
Deprecated input character to specify which type of structural parameters are constrained to equivalency between partners. Users should rely upon constr_dy_xy_struct for making constraints to the structural portion of the model for associative relationship between latent x and y. |
est_k |
input logical for whether Kenny & Ledermann's (2010) k parameter should be calculated to characterize the dyadic pattern in the APIM. Defaults FALSE, and requires at least a loading-invariant model to be specified, otherwise a warning is returned. |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
character object of lavaan script that can be passed immediately to lavaan functions. Users will receive message if structural comparisons are specified when the recommended level of invariance is not also specified. If user supplies dvn with containing X or Y variables, they are alerted to respecify the dvn object.
scrapeVarCross which this function relies on
Other bi-construct script-writing functions:
scriptBiDy(),
scriptCFM(),
scriptMIM(),
scriptObsAPIM(),
scriptTwoCross()
dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" ) apim.script.indist <- scriptAPIM(dvn, lvxname = "Sat", lvyname = "Com", est_k = TRUE, writeTo = tempdir(), fileName = "latAPIM_indist" )dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" ) apim.script.indist <- scriptAPIM(dvn, lvxname = "Sat", lvyname = "Com", est_k = TRUE, writeTo = tempdir(), fileName = "latAPIM_indist" )
This function takes the outputted object from scrapeVarCross() and automatically writes, returns, and exports (.txt) lavaan() syntax for specifying dyadic configural, loading, and intercept invariant BiDy CFA (BiDy-C) or SEM (BiDy-S) Model. Currently only uses fixed-factor scale-setting
scriptBiDy( dvn, type = "CFA", lvxname, lvyname, constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = c("actors"), model = lifecycle::deprecated(), equate = lifecycle::deprecated(), writeTo = NULL, fileName = NULL )scriptBiDy( dvn, type = "CFA", lvxname, lvyname, constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = c("actors"), model = lifecycle::deprecated(), equate = lifecycle::deprecated(), writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross |
type |
input character to specify whether to script a BiDy-CFA ("CFA", default) or BiDy-SEM ("SEM") model |
lvxname |
input character to (arbitrarily) name LV X in lavaan syntax |
lvyname |
input character to (arbitrarily) name LV Y in lavaan syntax |
constr_dy_x_meas |
input character vector detailing which measurement model parameters to constrain across dyad members for latent X. Default is c("loadings", "intercepts", "residuals"), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model. Users may also specify more boutique patterns of bifactor loading constraints with "loadings_source" or "loadings_mutual". |
constr_dy_x_struct |
input character vector detailing which structural model parameters to constrain across dyad members for latent X. Default is c("variances", "means"), but user can specify any combination of "variances" and "means", or "none". |
constr_dy_y_meas |
input character vector detailing which measurement model parameters to constrain across dyad members for latent X. Default is c("loadings", "intercepts", "residuals"), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model. Users may also specify more boutique patterns of bifactor loading constraints with "loadings_source" or "loadings_mutual". |
constr_dy_y_struct |
input character vector detailing which structural model parameters to constrain across dyad members for latent X. Default is c("variances", "means"), but user can specify any combination of "variances" and "means", or "none". |
constr_dy_xy_struct |
input character vector detailing which structural model parameters to constrain for modeling the predictive association(s) between partners' latent x and y. Default is c("actors"), but users can also specify "dyadic_zero" or "none". |
model |
Deprecated input character used to specify which level of invariance is modeled. Users should rely upon constr_dy_x_meas/constr_dy_y_meas and constr_dy_x_struct/constr_dy_y_struct instead, for making constraints to the measurement and/or structural portions of the model for latent x and y. |
equate |
Deprecated input character to specify which type of structural parameters are constrained to equivalency between partners. Users should rely upon constr_dy_xy_struct for making constraints to the structural portion of the model for associative relationship between latent x and y. |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
character object of lavaan script that can be passed immediately to lavaan functions
Other bi-construct script-writing functions:
scriptAPIM(),
scriptCFM(),
scriptMIM(),
scriptObsAPIM(),
scriptTwoCross()
dvn <- scrapeVarCross(DRES, x_order = "sip", x_stem = "sexsat", x_delim2=".", distinguish_1="1", distinguish_2="2") sexsat.bidyc.script <- scriptBiDy(dvn, lvxname = "SexSat", type = "CFA", writeTo = tempdir(), fileName = "BiDy_C") dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2", y_order="spi", y_stem="com", y_delim1 = ".", y_delim2="_") comsat.bidys.config.script <- scriptBiDy(dvn, lvxname = "Sat", lvyname = "Com", type = "SEM", writeTo = tempdir(), fileName = "BiDy_S")dvn <- scrapeVarCross(DRES, x_order = "sip", x_stem = "sexsat", x_delim2=".", distinguish_1="1", distinguish_2="2") sexsat.bidyc.script <- scriptBiDy(dvn, lvxname = "SexSat", type = "CFA", writeTo = tempdir(), fileName = "BiDy_C") dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2", y_order="spi", y_stem="com", y_delim1 = ".", y_delim2="_") comsat.bidys.config.script <- scriptBiDy(dvn, lvxname = "Sat", lvyname = "Com", type = "SEM", writeTo = tempdir(), fileName = "BiDy_S")
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
bifactor models.
scriptBifac( dvn, scaleset = "FF", lvname = "X", lvar = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), constr_group_meas = NULL, constr_group_struct = NULL, writeTo = NULL, fileName = NULL, outputType = "lavaan script" )scriptBifac( dvn, scaleset = "FF", lvname = "X", lvar = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), constr_group_meas = NULL, constr_group_struct = NULL, writeTo = NULL, fileName = NULL, outputType = "lavaan script" )
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent
variable(s). Default is |
lvname |
Input character to (arbitrarily) name the latent variable in |
lvar |
Input character to specify whether the latent variable represents
"X" or "Y" in the model. Default is |
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.
Default is |
constr_group_meas |
Optional character vector detailing which measurement model parameters to constrain across groups.
Valid values: |
constr_group_struct |
Optional character vector detailing which structural model parameters to constrain across groups.
Valid values: |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
outputType |
Character string specifying the type of output to return.
Options are |
By default, many dySEM:: functions (including scriptBifac()) 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 (when outputType = "lavaan script"), or a structured list
of model components (when outputType = "syntax components").
scrapeVarCross which this function relies on.
Other uni-construct script-writing functions:
scriptCor(),
scriptHier(),
scriptUni()
dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.indist.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat" ) sat.lvars.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "loadings", constr_dy_struct = "variances" ) sat.resids.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_residual" ) sat.ints.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_intercept" ) sat.loads.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_loading" ) sat.config.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_configural" ) sat.source.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "loadings_source", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_source" )dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.indist.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat" ) sat.lvars.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "loadings", constr_dy_struct = "variances" ) sat.resids.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_residual" ) sat.ints.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_intercept" ) sat.loads.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_loading" ) sat.config.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_configural" ) sat.source.script <- scriptBifac( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "loadings_source", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dBiFac_source" )
This function takes the outputted object from scrapeVarCross() when the var_list argument has been used, and automatically writes, returns, and exports (.txt) lavaan() syntax for specifying dyadic configural, loading, and intercept invariant measurement models for either a group of latent variables (e.g., different sub-scales from a self-report measures).
scriptMultiCor() is a thin wrapper around scriptCFA() provided
as a synonym for users who think of these models as dyadic multi-factor
correlated-factor models. It takes the same arguments as scriptCFA()
and returns the identical lavaan syntax.
scriptCFA( dvn, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL ) scriptMultiCor( dvn, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL )scriptCFA( dvn, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL ) scriptMultiCor( dvn, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross(); scrapeVarCross must have been run with the var_list argument |
scaleset |
Input character to specify how to set the scale of the latent
variable(s). Default is |
constr_dy_meas |
input character vector detailing which measurement model parameters to constrain across dyad members. Default is c("loadings", "intercepts", "residuals")(in combination with defaults for constr_dy_struct, an indistinguishable dyadic CFA), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model |
constr_dy_struct |
input character vector detailing which structural model parameters to constrain across dyad members. Default is c("variances", "means")(in combination with defaults for constr_dy_meas, an indistinguishable dyadic CFA), but user can specify any combination of "variances" and "means", or "none". |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
By default, many dySEM:: functions (including scriptCFA() 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
character object of lavaan script that can be passed immediately to lavaan functions
scrapeVarCross which this function relies on
Other multi-construct script-writing functions:
scriptDyEFA()
# When different factor use distinct stems: imsList <- list( lvnames = c("Sat", "Q_Alt", "Invest", "Comm"), stem = c("sat.g", "qalt.g", "invest.g", "com"), delim1 = c("", "", "", ""), delim2 = c("_", "_", "_", "_") ) dvnIMS <- scrapeVarCross(imsM, var_list = imsList, var_list_order = "sip", distinguish_1 = "f", distinguish_2 = "m" ) script.ims.config <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "ims_config" ) script.ims.load <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "ims_load" ) script.ims.int <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "ims_int" ) script.ims.res <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "ims_res" ) script.ims.indist <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = tempdir(), fileName = "ims_indist" ) # When different factor use the same stem and muse be detected through numeric position prqcList <- list( lvnames = c("Sat", "Comm", "Intim", "Trust", "Pass", "Love"), stem = c("prqc", "prqc", "prqc", "prqc", "prqc", "prqc"), delim1 = c(".", ".", ".", ".", ".", "."), delim2 = c("_", "_", "_", "_", "_", "_"), min_num = c(1, 4, 7, 10, 13, 16), max_num = c(3, 6, 9, 12, 15, 18) ) dvnPRQC <- scrapeVarCross(prqcQ, var_list = prqcList, var_list_order = "spi", distinguish_1 = "1", distinguish_2 = "2" ) script.prqc.config <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "prqc_config" ) script.prqc.load <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "prqc_load" ) script.prqc.int <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "prqc_int" ) script.prqc.res <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "prqc_res" ) script.prqc.indist <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = tempdir(), fileName = "prqc_indist" )# When different factor use distinct stems: imsList <- list( lvnames = c("Sat", "Q_Alt", "Invest", "Comm"), stem = c("sat.g", "qalt.g", "invest.g", "com"), delim1 = c("", "", "", ""), delim2 = c("_", "_", "_", "_") ) dvnIMS <- scrapeVarCross(imsM, var_list = imsList, var_list_order = "sip", distinguish_1 = "f", distinguish_2 = "m" ) script.ims.config <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "ims_config" ) script.ims.load <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "ims_load" ) script.ims.int <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "ims_int" ) script.ims.res <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "ims_res" ) script.ims.indist <- scriptCFA(dvnIMS, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = tempdir(), fileName = "ims_indist" ) # When different factor use the same stem and muse be detected through numeric position prqcList <- list( lvnames = c("Sat", "Comm", "Intim", "Trust", "Pass", "Love"), stem = c("prqc", "prqc", "prqc", "prqc", "prqc", "prqc"), delim1 = c(".", ".", ".", ".", ".", "."), delim2 = c("_", "_", "_", "_", "_", "_"), min_num = c(1, 4, 7, 10, 13, 16), max_num = c(3, 6, 9, 12, 15, 18) ) dvnPRQC <- scrapeVarCross(prqcQ, var_list = prqcList, var_list_order = "spi", distinguish_1 = "1", distinguish_2 = "2" ) script.prqc.config <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "prqc_config" ) script.prqc.load <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "prqc_load" ) script.prqc.int <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "prqc_int" ) script.prqc.res <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "prqc_res" ) script.prqc.indist <- scriptCFA(dvnPRQC, scaleset = "FF", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = tempdir(), fileName = "prqc_indist" )
This function takes the outputted object from scrapeVarCross() and automatically writes, returns, and exports (.txt) lavaan() syntax for specifying Common Fate Models (CFMs). Users can also invoke configural, loading, and/or intercept invariant measurement models, and particular types of structural comparisons.
scriptCFM( dvn, scaleset = "FF", lvxname, lvyname, constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = "none", model = lifecycle::deprecated(), writeTo = NULL, fileName = NULL )scriptCFM( dvn, scaleset = "FF", lvxname, lvyname, constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = "none", model = lifecycle::deprecated(), writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross |
scaleset |
Input character to specify how to set the scale of the latent
variable(s). Default is |
lvxname |
input character to (arbitrarily) name LV X in lavaan syntax |
lvyname |
input character to (arbitrarily) name LV Y in lavaan syntax |
constr_dy_x_meas |
input character vector detailing which measurement model parameters to constrain across dyad members for latent X. Default is c("loadings", "intercepts", "residuals"), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model |
constr_dy_x_struct |
input character vector detailing which structural model parameters to constrain across dyad members for latent X. Default is c("variances", "means"), but user can specify any combination of "variances" and "means", or "none". |
constr_dy_y_meas |
input character vector detailing which measurement model parameters to constrain across dyad members for latent X. Default is c("loadings", "intercepts", "residuals"), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model |
constr_dy_y_struct |
input character vector detailing which structural model parameters to constrain across dyad members for latent X. Default is c("variances", "means"), but user can specify any combination of "variances" and "means", or "none". |
constr_dy_xy_struct |
input character vector detailing which structural model parameters to constrain for modeling the predictive association(s) between partners' latent x and y. Defaults to "none". Options include "p1_zero" or "p2_zero" (to constrain within-person latent residual covariances between X and Y to zero), or "covar_zero" (to constrain both within-person latent residual correlations to zero), and/or "dyadic_zero" (to constrain the dyadic effect to zero). |
model |
Deprecated input character used to specify which level of invariance is modeled. Users should rely upon constr_dy_x_meas/constr_dy_y_meas and constr_dy_x_struct/constr_dy_y_struct instead, for making constraints to the measurement and/or structural portions of the model for latent x and y. |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
character object of lavaan script that can be passed immediately to lavaan functions. Users will receive message if structural comparisons are specified when the recommended level of invariance is not also specified. If user supplies dvn with containing X or Y variables, they are alerted to respecify the dvn object.
scrapeVarCross which this function relies on
Other bi-construct script-writing functions:
scriptAPIM(),
scriptBiDy(),
scriptMIM(),
scriptObsAPIM(),
scriptTwoCross()
dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2", y_order="spi", y_stem="com", y_delim1 = ".", y_delim2="_") cfm.script.indist <- scriptCFM(dvn, lvxname = "Sat", lvyname = "Com", writeTo = tempdir(), fileName = "CFM_indist")dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2", y_order="spi", y_stem="com", y_delim1 = ".", y_delim2="_") cfm.script.indist <- scriptCFM(dvn, lvxname = "Sat", lvyname = "Com", writeTo = tempdir(), fileName = "CFM_indist")
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
two-factor models.
scriptCor( dvn, scaleset = "FF", lvname = "X", lvar = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), constr_group_meas = NULL, constr_group_struct = NULL, writeTo = NULL, fileName = NULL, outputType = "lavaan script" )scriptCor( dvn, scaleset = "FF", lvname = "X", lvar = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), constr_group_meas = NULL, constr_group_struct = NULL, writeTo = NULL, fileName = NULL, outputType = "lavaan script" )
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent
variable(s). Default is |
lvname |
Input character to (arbitrarily) name the latent variable in |
lvar |
Input character to specify whether the latent variable represents
"X" or "Y" in the model. Default is |
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.
Default is |
constr_group_meas |
Optional character vector detailing which measurement model parameters to constrain across groups.
Valid values: |
constr_group_struct |
Optional character vector detailing which structural model parameters to constrain across groups.
Valid values: |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
outputType |
Character string specifying the type of output to return.
Options are |
By default, many dySEM:: functions (including scriptCor()) 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 (when outputType = "lavaan script"), or a structured list
of model components (when outputType = "syntax components").
scrapeVarCross which this function relies on.
Other uni-construct script-writing functions:
scriptBifac(),
scriptHier(),
scriptUni()
dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.indist.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat" ) sat.lvars.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "loadings", constr_dy_struct = "variances" ) sat.resids.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dCor_residual" ) sat.ints.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dCor_intercept" ) sat.loads.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dCor_loading" ) sat.config.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dCor_configural" )dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2" ) sat.indist.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat" ) sat.lvars.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "loadings", constr_dy_struct = "variances" ) sat.resids.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dCor_residual" ) sat.ints.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dCor_intercept" ) sat.loads.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dCor_loading" ) sat.config.script <- scriptCor( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dCor_configural" )
This function takes the outputted object from scrapeVarCross() and automatically writes, returns, and exports (.txt) lavaan() syntax for specifying a dyadic EFA model of a given number of exploratory factors.
scriptDyEFA( dvn, nFactor = 1, constr_dy_meas = "none", writeTo = NULL, fileName = NULL )scriptDyEFA( dvn, nFactor = 1, constr_dy_meas = "none", writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross |
nFactor |
numeric argument for number of exploratory factors to extract. Defaults to 1. Note that higher values may cause estimation problems as solution becomes over-factored and/or in the presence of insufficient data. |
constr_dy_meas |
input character vector detailing which measurement model parameters to constrain across dyad members. Default is "none" but user can specify "loadings" and/or "residuals", to fit an exploratory model with loadings and/or residuals constrained across partners |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
character object of lavaan script that can be passed immediately to lavaan functions
scrapeVarCross which this function relies on
Other multi-construct script-writing functions:
scriptCFA()
dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2") sat.defa1.script <- scriptDyEFA(dvn, nFactor = 1, writeTo = tempdir(), fileName = "DEFA_1fac")dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2") sat.defa1.script <- scriptDyEFA(dvn, nFactor = 1, writeTo = tempdir(), fileName = "DEFA_1fac")
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
hierarchical models.
scriptHier( dvn, scaleset = "FF", lvname = "X", lvar = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), constr_group_meas = NULL, constr_group_struct = NULL, writeTo = NULL, fileName = NULL, outputType = "lavaan script" )scriptHier( dvn, scaleset = "FF", lvname = "X", lvar = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), constr_group_meas = NULL, constr_group_struct = NULL, writeTo = NULL, fileName = NULL, outputType = "lavaan script" )
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent
variable(s). Default is |
lvname |
Input character to (arbitrarily) name the latent variable in |
lvar |
Input character to specify whether the latent variable represents
"X" or "Y" in the model. Default is |
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.
Default is |
constr_group_meas |
Optional character vector detailing which measurement model parameters to constrain across groups.
Valid values: |
constr_group_struct |
Optional character vector detailing which structural model parameters to constrain across groups.
Valid values: |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
outputType |
Character string specifying the type of output to return.
Options are |
By default, many dySEM:: functions (including scriptHier()) 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 (when outputType = "lavaan script"), or a structured list
of model components (when outputType = "syntax components").
scrapeVarCross which this function relies on.
Other uni-construct script-writing functions:
scriptBifac(),
scriptCor(),
scriptUni()
dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2" ) sat.indist.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat" ) sat.lvars.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "loadings", constr_dy_struct = "variances" ) sat.resids.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dHier_residual" ) sat.ints.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dHier_intercept" ) sat.loads.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dHier_loading" ) sat.config.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dHier_configural" )dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2" ) sat.indist.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat" ) sat.lvars.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "loadings", constr_dy_struct = "variances" ) sat.resids.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dHier_residual" ) sat.ints.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dHier_intercept" ) sat.loads.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dHier_loading" ) sat.config.script <- scriptHier( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dHier_configural" )
This function takes the outputted object from scrapeVarCross() and automatically writes, returns, and exports (.txt) lavaan() syntax for the I-NULL model described in Olsen & Kenny (2006)
scriptINULL( dvn, lvxname = "X", lvyname = NULL, writeTo = NULL, fileName = NULL )scriptINULL( dvn, lvxname = "X", lvyname = NULL, writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross |
lvxname |
input character to (arbitrarily) name X LV in lavaan syntax |
lvyname |
(optional) input character to (arbitrarily) name Y LV in lavaan syntax |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
character object of lavaan script that can be passed immediately to lavaan functions
scrapeVarCross which this function relies on
Other indistinguishable script-writing functions:
scriptISAT()
dvn <- scrapeVarCross(dat = DRES, x_order = "sip", x_stem = "PRQC", x_delim1 = "_", x_delim2=".", x_item_num="\\d+", distinguish_1="1", distinguish_2="2") qual.inull.script <- scriptINULL(dvn, lvxname = "Qual", writeTo = tempdir(), fileName = "I-NULL_script")dvn <- scrapeVarCross(dat = DRES, x_order = "sip", x_stem = "PRQC", x_delim1 = "_", x_delim2=".", x_item_num="\\d+", distinguish_1="1", distinguish_2="2") qual.inull.script <- scriptINULL(dvn, lvxname = "Qual", writeTo = tempdir(), fileName = "I-NULL_script")
This function takes the outputted object from scrapeVarCross() and automatically writes, returns, and exports (.txt) lavaan() syntax for the I-SAT model described in Olsen & Kenny (2006)
scriptISAT(dvn, lvxname = "X", lvyname = NULL, writeTo = NULL, fileName = NULL)scriptISAT(dvn, lvxname = "X", lvyname = NULL, writeTo = NULL, fileName = NULL)
dvn |
input dvn list from scrapeVarCross |
lvxname |
input character to (arbitrarily) name X LV in lavaan syntax |
lvyname |
(optional) input character to (arbitrarily) name X LV in lavaan syntax |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
character object of lavaan script that can be passed immediately to lavaan functions
scrapeVarCross which this function relies on
Other indistinguishable script-writing functions:
scriptINULL()
dvn <- scrapeVarCross(dat = DRES, x_order = "sip", x_stem = "PRQC", x_delim1 = "_", x_delim2=".", x_item_num="\\d+", distinguish_1="1", distinguish_2="2") qual.isat.script <- scriptISAT(dvn, lvxname = "Qual", writeTo = tempdir(), fileName = "I-SAT_script")dvn <- scrapeVarCross(dat = DRES, x_order = "sip", x_stem = "PRQC", x_delim1 = "_", x_delim2=".", x_item_num="\\d+", distinguish_1="1", distinguish_2="2") qual.isat.script <- scriptISAT(dvn, lvxname = "Qual", writeTo = tempdir(), fileName = "I-SAT_script")
This function takes the outputted object from scrapeVarCross() and automatically writes, returns, and exports (.txt) lavaan() syntax for specifying Mutual Influence Models (MIMs). Users can also invoke configural, loading, and/or intercept invariant measurement models, and particular types of structural comparisons.
scriptMIM( dvn, scaleset = "FF", lvxname, lvyname, constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = c("actors", "partners"), model = lifecycle::deprecated(), equate = lifecycle::deprecated(), est_k = FALSE, writeTo = NULL, fileName = NULL )scriptMIM( dvn, scaleset = "FF", lvxname, lvyname, constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = c("actors", "partners"), model = lifecycle::deprecated(), equate = lifecycle::deprecated(), est_k = FALSE, writeTo = NULL, fileName = NULL )
dvn |
input dvn list from scrapeVarCross |
scaleset |
Input character to specify how to set the scale of the latent
variable(s). Default is |
lvxname |
input character to (arbitrarily) name LV X in lavaan syntax |
lvyname |
input character to (arbitrarily) name LV Y in lavaan syntax |
constr_dy_x_meas |
input character vector detailing which measurement model parameters to constrain across dyad members for latent X. Default is c("loadings", "intercepts", "residuals"), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model |
constr_dy_x_struct |
input character vector detailing which structural model parameters to constrain across dyad members for latent X. Default is c("variances", "means"), but user can specify any combination of "variances" and "means", or "none". |
constr_dy_y_meas |
input character vector detailing which measurement model parameters to constrain across dyad members for latent X. Default is c("loadings", "intercepts", "residuals"), but user can specify any combination of "loadings", "intercepts", and "residuals", or "none" to specify an otherwise unconstrained dyadic configural invariance model |
constr_dy_y_struct |
input character vector detailing which structural model parameters to constrain across dyad members for latent X. Default is c("variances", "means"), but user can specify any combination of "variances" and "means", or "none". |
constr_dy_xy_struct |
input character vector detailing which structural model parameters to constrain for modeling the predictive association(s) between partners' latent x and y. Default is c("actors", "partners"), but users can also specify "all", "actors_zero", "partners_zero", or "none". |
model |
Deprecated input character used to specify which level of invariance is modeled. Users should rely upon constr_dy_x_meas/constr_dy_y_meas and constr_dy_x_struct/constr_dy_y_struct instead, for making constraints to the measurement and/or structural portions of the model for latent x and y. |
equate |
Deprecated input character to specify which type of structural parameters are constrained to equivalency between partners. Users should rely upon constr_dy_xy_struct for making constraints to the structural portion of the model for associative relationship between latent x and y. |
est_k |
input logical for whether Kenny & Ledermann's (2010) k parameter should be calculated to characterize the dyadic pattern in the APIM. Defaults FALSE, and requires at least a loading-invariant model to be specified, otherwise a warning is returned. |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
character object of lavaan script that can be passed immediately to lavaan functions. Users will receive message if structural comparisons are specified when the recommended level of invariance is not also specified. If user supplies dvn with containing X or Y variables, they are alerted to respecify the dvn object.
scrapeVarCross which this function relies on
Other bi-construct script-writing functions:
scriptAPIM(),
scriptBiDy(),
scriptCFM(),
scriptObsAPIM(),
scriptTwoCross()
dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2", y_order="spi", y_stem="com", y_delim1 = ".", y_delim2="_") mim.script.indist <- scriptMIM(dvn, lvxname = "Sat", lvyname = "Com", est_k = TRUE, writeTo = tempdir(), fileName = "MIM_indist")dvn <- scrapeVarCross(dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2", y_order="spi", y_stem="com", y_delim1 = ".", y_delim2="_") mim.script.indist <- scriptMIM(dvn, lvxname = "Sat", lvyname = "Com", est_k = TRUE, writeTo = tempdir(), fileName = "MIM_indist")
Writes lavaan syntax for an APIM with one observed (or composite) X and Y per
partner. Structural constraints mirror scriptAPIM() (dyadic variances/means,
actor/partner paths, optional orthogonal dyadic covariances).
scriptObsAPIM( X1 = NULL, Y1 = NULL, X2 = NULL, Y2 = NULL, constr_dy_x_struct = c("variances", "means"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = c("actors", "partners"), includeMeanStruct = FALSE, equate = lifecycle::deprecated(), k = lifecycle::deprecated(), est_k = FALSE, writeTo = NULL, fileName = NULL )scriptObsAPIM( X1 = NULL, Y1 = NULL, X2 = NULL, Y2 = NULL, constr_dy_x_struct = c("variances", "means"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = c("actors", "partners"), includeMeanStruct = FALSE, equate = lifecycle::deprecated(), k = lifecycle::deprecated(), est_k = FALSE, writeTo = NULL, fileName = NULL )
X1, X2, Y1, Y2
|
Character names of variables for partners 1 and 2. |
constr_dy_x_struct |
Character vector: any of |
constr_dy_y_struct |
Same allowed values as |
constr_dy_xy_struct |
Character vector: |
includeMeanStruct |
Logical; if |
equate |
|
k |
|
est_k |
Logical; if |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
Character string of lavaan model syntax.
Other bi-construct script-writing functions:
scriptAPIM(),
scriptBiDy(),
scriptCFM(),
scriptMIM(),
scriptTwoCross()
scriptObsAPIM( X1 = "SexSatA", Y1 = "RelSatA", X2 = "SexSatB", Y2 = "RelSatB", constr_dy_xy_struct = "none", constr_dy_x_struct = "none", constr_dy_y_struct = "none", writeTo = tempdir(), fileName = "obsAPIM_script" )scriptObsAPIM( X1 = "SexSatA", Y1 = "RelSatA", X2 = "SexSatB", Y2 = "RelSatB", constr_dy_xy_struct = "none", constr_dy_x_struct = "none", constr_dy_y_struct = "none", writeTo = tempdir(), fileName = "obsAPIM_script" )
Writes a fully specified population model with fixed numeric parameters for use
with lavaan::simulateData(). Measurement blocks follow the same conventions
as scriptPopCor() for each construct; structural paths use a single actor
and partner coefficient on both partners' equations.
scriptPopAPIM(dvn, lvxname, lvyname, pop_values)scriptPopAPIM(dvn, lvxname, lvyname, pop_values)
dvn |
List from |
lvxname, lvyname
|
Base names for latent X and Y (partner suffixes from
|
pop_values |
Named list; see Population values below. |
Single string of lavaan model syntax.
X measurement (lengths nx = dvn$xindper): x_loadings_p1, x_loadings_p2
(optional recycle), x_residuals_p1, x_residuals_p2, x_coresids,
optional x_intercepts_p1 / x_intercepts_p2.
Y measurement (ny = dvn$yindper): y_loadings_p1, y_loadings_p2,
y_residuals_p1, y_residuals_p2, y_coresids, optional y_intercepts_*.
Latent X: x_lv_var (scalar or length 2, default c(1,1)), x_lv_cov
(default 0), x_lv_means (optional, default c(0,0)).
Structural: actor, partner (numeric), y_lv_var (scalar or length 2,
default c(0.5, 0.5)), y_lv_cov (default 0; covariance between latent Y
residuals).
Vectors of length 1 are recycled to nx or ny for measurement slots.
Other population-scripting functions:
scriptPopCor(),
scriptPopUni()
Produces lavaan syntax with fixed numeric values for data generation in
Monte Carlo simulations. Used with lavaan::simulateData().
scriptPopCor(dvn, lvname = "X", pop_values, lvar = "X")scriptPopCor(dvn, lvname = "X", pop_values, lvar = "X")
dvn |
Input dvn list from |
lvname |
Character name for the latent variable |
pop_values |
Named list of population parameter values:
|
lvar |
Character |
Character string of lavaan syntax
Other population-scripting functions:
scriptPopAPIM(),
scriptPopUni()
dvn <- dySEM::build_dvn(n_items_x = 3, x_stem = "x", x_delim1 = "", x_delim2 = "_", distinguish_1 = "A", distinguish_2 = "B") scriptPopCor(dvn, "X", list( loadings_p1 = c(.75, .80, .55), loadings_p2 = c(.70, .85, .50), residuals_p1 = c(.44, .36, .70), residuals_p2 = c(.51, .28, .75), coresids = c(.10, .12, .08), lv_cov = 0.3 ))dvn <- dySEM::build_dvn(n_items_x = 3, x_stem = "x", x_delim1 = "", x_delim2 = "_", distinguish_1 = "A", distinguish_2 = "B") scriptPopCor(dvn, "X", list( loadings_p1 = c(.75, .80, .55), loadings_p2 = c(.70, .85, .50), residuals_p1 = c(.44, .36, .70), residuals_p2 = c(.51, .28, .75), coresids = c(.10, .12, .08), lv_cov = 0.3 ))
Produces lavaan syntax with fixed numeric values for data generation in
Monte Carlo simulations. Used with lavaan::simulateData().
scriptPopUni(dvn, lvname = "X", pop_values, lvar = "X")scriptPopUni(dvn, lvname = "X", pop_values, lvar = "X")
dvn |
Input dvn list from |
lvname |
Character name for the latent variable |
pop_values |
Named list of population parameter values:
|
lvar |
Character |
Character string of lavaan syntax
Other population-scripting functions:
scriptPopAPIM(),
scriptPopCor()
dvn <- dySEM::build_dvn(n_items_x = 3, x_stem = "x", x_delim1 = "", x_delim2 = "_", distinguish_1 = "A", distinguish_2 = "B") scriptPopUni(dvn, "X", list( loadings = c(.75, .80, .55), residuals = c(.44, .36, .70), coresids = c(.10, .12, .08) ))dvn <- dySEM::build_dvn(n_items_x = 3, x_stem = "x", x_delim1 = "", x_delim2 = "_", distinguish_1 = "A", distinguish_2 = "B") scriptPopUni(dvn, "X", list( loadings = c(.75, .80, .55), residuals = c(.44, .36, .70), coresids = c(.10, .12, .08) ))
This function takes the outputted object from scrapeVarCross() with both
X and Y indicators and automatically writes, returns, and exports (.txt)
lavaan syntax for specifying a two-construct model where the measurement
structure of X and Y can differ (e.g., X as correlated factors, Y as
unidimensional).
scriptTwoCross( dvn, x_scaleset = "FF", y_scaleset = "FF", lvxname = "X", lvyname = "Y", x_model = "cor", y_model = "cor", constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = "free", includeMeanStruct = FALSE, writeTo = NULL, fileName = NULL )scriptTwoCross( dvn, x_scaleset = "FF", y_scaleset = "FF", lvxname = "X", lvyname = "Y", x_model = "cor", y_model = "cor", constr_dy_x_meas = c("loadings", "intercepts", "residuals"), constr_dy_x_struct = c("variances", "means"), constr_dy_y_meas = c("loadings", "intercepts", "residuals"), constr_dy_y_struct = c("variances", "means"), constr_dy_xy_struct = "free", includeMeanStruct = FALSE, writeTo = NULL, fileName = NULL )
dvn |
Input dvn list from |
x_scaleset |
Character string specifying how to set the scale of latent X.
Options are |
y_scaleset |
Character string specifying how to set the scale of latent Y.
Options are |
lvxname |
Input character to (arbitrarily) name latent variable X in
|
lvyname |
Input character to (arbitrarily) name latent variable Y in
|
x_model |
Character string specifying the measurement model for X.
Options are |
y_model |
Character string specifying the measurement model for Y.
Same options as |
constr_dy_x_meas |
Input character vector detailing which measurement model parameters to constrain across dyad members for latent X. |
constr_dy_x_struct |
Input character vector detailing which structural model parameters to constrain across dyad members for latent X. |
constr_dy_y_meas |
Input character vector detailing which measurement model parameters to constrain across dyad members for latent Y. |
constr_dy_y_struct |
Input character vector detailing which structural model parameters to constrain across dyad members for latent Y. |
constr_dy_xy_struct |
Character string for the X-to-Y regression paths.
Options are |
includeMeanStruct |
Logical for whether to include the mean structure
(intercepts and latent means) in the model. Defaults to |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
Character object of lavaan script that can be passed immediately to
lavaan functions.
scrapeVarCross which this function relies on;
scriptUni, scriptCor, scriptHier,
scriptBifac for the underlying scripters;
scriptAPIM for a related two-construct function.
Other bi-construct script-writing functions:
scriptAPIM(),
scriptBiDy(),
scriptCFM(),
scriptMIM(),
scriptObsAPIM()
dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" ) # Correlated X, unidimensional Y scriptTwoCross(dvn, lvxname = "Sat", lvyname = "Com", x_model = "cor", y_model = "uni") # Both correlated scriptTwoCross(dvn, lvxname = "Sat", lvyname = "Com", x_model = "cor", y_model = "cor", writeTo = tempdir(), fileName = "twoCross_cor_cor")dvn <- scrapeVarCross( dat = commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2 = "_", distinguish_1 = "1", distinguish_2 = "2", y_order = "spi", y_stem = "com", y_delim1 = ".", y_delim2 = "_" ) # Correlated X, unidimensional Y scriptTwoCross(dvn, lvxname = "Sat", lvyname = "Com", x_model = "cor", y_model = "uni") # Both correlated scriptTwoCross(dvn, lvxname = "Sat", lvyname = "Com", x_model = "cor", y_model = "cor", writeTo = tempdir(), fileName = "twoCross_cor_cor")
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", lvar = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", constr_group_meas = NULL, constr_group_struct = NULL, writeTo = NULL, fileName = NULL, outputType = "lavaan script" )scriptUni( dvn, scaleset = "FF", lvname = "X", lvar = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", constr_group_meas = NULL, constr_group_struct = NULL, writeTo = NULL, fileName = NULL, outputType = "lavaan script" )
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent
variable(s). Default is |
lvname |
Input character to (arbitrarily) name the latent variable in
|
lvar |
Input character to specify whether the latent variable represents
"X" or "Y" in the model. Default is |
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 |
constr_group_meas |
Optional character vector for cross-group measurement constraints (e.g. |
constr_group_struct |
Optional character vector for cross-group structural constraints (e.g. |
writeTo |
A character string specifying a directory path to where the
output file(s) should be saved. If set to |
fileName |
A character string specifying a desired base name for the
output file. The default is |
outputType |
Character string specifying the type of output to return.
Options are |
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 (when outputType = "lavaan script"), or a structured list
of model components (when outputType = "syntax components").
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" )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" )