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. Current models supported include Dyadic Confirmatory Factor Analysis, the Actor–Partner Interdependence Model (observed and latent), the Common Fate Model (observed and latent), Mutual Influence Model (latent), and the Bifactor Dyadic Model (latent). |
Authors: | John Sakaluk [aut, cre, cph] |
Maintainer: | John Sakaluk <[email protected]> |
License: | GPL-3 |
Version: | 1.3.1 |
Built: | 2025-02-20 22:24:55 UTC |
Source: | https://github.com/jsakaluk/dysem |
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, in press)
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) |
vector of d_macs values
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. .
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 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 |
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, gtTab = FALSE, writeTo = NULL, fileName = NULL)
outputInvarCompTab(mods, gtTab = FALSE, writeTo = NULL, fileName = NULL)
mods |
A list of nested |
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 |
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, gtTab = TRUE, writeTo = tempdir(), fileName = "dCFA_Invar")
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, gtTab = TRUE, writeTo = tempdir(), fileName = "dCFA_Invar")
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 file(s) should be saved. If set to “.”, the file(s) will be written to the current working directory. The default is NULL (which will throw an error), and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the output file(s).
If a |
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 of the path diagram should be saved.
If set to “.”, the file will be written to the current working directory.
The default is |
fileName |
A character string specifying a desired base name for the output file.
If a |
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 .rtf
s.
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), or "both" (i.e., both measurement and structural tables). |
gtTab |
A logical input indicating whether to generate the table(s) in |
writeTo |
A character string specifying a directory path to where the |
fileName |
A character string specifying a desired base name for the output |
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")
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+", covs_order = NULL, covs_stem = NULL, covs_delim1 = NULL, covs_delim2 = NULL )
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+", covs_order = NULL, covs_stem = NULL, covs_delim1 = NULL, covs_delim2 = NULL )
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 |
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 |
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
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"), 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"), 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 "FF" (fixed-factor; see Details for rationale), but user can specify "MV" (Marker Variable) |
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 a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
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()
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 a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
character object of lavaan script that can be passed immediately to lavaan functions
Other bi-construct script-writing functions:
scriptAPIM()
,
scriptCFM()
,
scriptMIM()
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", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL )
scriptBifac( dvn, scaleset = "FF", lvname = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL )
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent variable. Default is
|
lvname |
Input character to (arbitrarily) name the latent variable in |
constr_dy_meas |
Input character vector detailing which measurement model parameters to constrain across dyad members. |
constr_dy_struct |
Input character vector detailing which structural model parameters to constrain across dyad members.
Default is |
writeTo |
A character string specifying a directory path to where a |
fileName |
A character string specifying a desired base name for the |
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.
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).
scriptCFA( 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 )
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 "FF" (fixed-factor; see Details for rationale), but user can specify "MV" (Marker Variable) |
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 a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
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
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 "FF" (fixed-factor; see Details for rationale), but user can specify "MV" (Marker Variable) |
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 a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
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()
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", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL )
scriptCor( dvn, scaleset = "FF", lvname = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL )
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent variable. Default is
|
lvname |
Input character to (arbitrarily) name the latent variable in |
constr_dy_meas |
Input character vector detailing which measurement model parameters to constrain across dyad members. |
constr_dy_struct |
Input character vector detailing which structural model parameters to constrain across dyad members.
Default is |
writeTo |
A character string specifying a directory path to where a |
fileName |
A character string specifying a desired base name for the |
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.
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 a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
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", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL )
scriptHier( dvn, scaleset = "FF", lvname = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = c("variances", "means"), writeTo = NULL, fileName = NULL )
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent variable. Default is
|
lvname |
Input character to (arbitrarily) name the latent variable in |
constr_dy_meas |
Input character vector detailing which measurement model parameters to constrain across dyad members. |
constr_dy_struct |
Input character vector detailing which structural model parameters to constrain across dyad members.
Default is |
writeTo |
A character string specifying a directory path to where a |
fileName |
A character string specifying a desired base name for the |
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.
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 a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
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 a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
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 "FF" (fixed-factor; see Details for rationale), but user can specify "MV" (Marker Variable) |
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 a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
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()
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")
A Function That Writes, Saves, and Exports Syntax for Fitting Observed Actor-Partner Interdependence Models
scriptObsAPIM( X1 = NULL, Y1 = NULL, X2 = NULL, Y2 = NULL, equate = "none", k = FALSE, writeTo = NULL, fileName = NULL )
scriptObsAPIM( X1 = NULL, Y1 = NULL, X2 = NULL, Y2 = NULL, equate = "none", k = FALSE, writeTo = NULL, fileName = NULL )
X1 |
character of vector name containing X variable/composite for partner 1 |
Y1 |
character of vector name containing Y variable/composite for partner 1 |
X2 |
character of vector name containing X variable/composite for partner 2 |
Y2 |
character of vector name containing Y variable/composite for partner 2 |
equate |
character of what parameter(s) to constrain ("actor", "partner", "all"); default is "none" (all freely estimated) |
k |
input logical for whether Kenny & Ledermann's (2010) k parameter should be calculated to characterize the dyadic pattern in the APIM. Default to FALSE |
writeTo |
A character string specifying a directory path to where a .txt file of the resulting lavaan script should be written. If set to “.”, the .txt file will be written to the current working directory. The default is NULL, and examples use a temporary directory created by tempdir(). |
fileName |
A character string specifying a desired base name for the .txt output file. The default is NULL. The specified name will be automatically appended with the .txt file extension. If a file with the same name already exists in the user's chosen directory, it will be overwritten. |
character object of lavaan script that can be passed immediately to lavaan functions.
obsAPIMScript <- scriptObsAPIM (X1 = "SexSatA", Y1 = "RelSatA", X2 = "SexSatB", Y2 = "RelSatB", equate = "none", writeTo = tempdir(), fileName = "obsAPIM_script")
obsAPIMScript <- scriptObsAPIM (X1 = "SexSatA", Y1 = "RelSatA", X2 = "SexSatB", Y2 = "RelSatB", equate = "none", writeTo = tempdir(), fileName = "obsAPIM_script")
This function takes the outputted object from scrapeVarCross()
and automatically writes, returns, and exports (.txt
) lavaan
syntax
for specifying dyadic configural, loading, intercept, and residual invariant
one-factor models.
scriptUni( dvn, scaleset = "FF", lvname = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = NULL, fileName = NULL )
scriptUni( dvn, scaleset = "FF", lvname = "X", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = NULL, fileName = NULL )
dvn |
Input dvn list from |
scaleset |
Input character to specify how to set the scale of the latent variable. Default is
|
lvname |
Input character to (arbitrarily) name the latent variable in |
constr_dy_meas |
Input character vector detailing which measurement model parameters to constrain across dyad members. |
constr_dy_struct |
Input character vector detailing which structural model parameters to constrain across dyad members.
Note: Within the context of |
writeTo |
A character string specifying a directory path to where a |
fileName |
A character string specifying a desired base name for the |
Users do not need to modify constr_dy_struct
when using scriptUni()
.
By default, many dySEM::
functions (including scriptUni()
) default to
a fixed-factor method of scale-setting, whereby the latent variance of
a given factor is constrained to 1 for both partners in the configurally invariant
model, and then one of these variances is freely estimated in subsequent
models of the invariance testing sequence.
We have selected this default for two reasons:
(1) the selection of a marker-variable is usually arbitrary,
yet can have a large influence on the estimation and testing of of structural parameters
(see https://stats.stackexchange.com/questions/402133/in-cfa-does-it-matter-which-factor-loading-is-set-to-1/402732#402732);
and (2) the selection of a non-invariant marker-variable
can have disastrous down-stream consequences for the identification of
non-invariant measurement parameters, following a the rejection of an omnibus
invariance constraint set (see Lee, Preacher, & Little, 2011).
Character object of lavaan
script that can be passed immediately to
lavaan
functions.
scrapeVarCross
which this function relies on.
Other uni-construct script-writing functions:
scriptBifac()
,
scriptCor()
,
scriptHier()
dvn <- scrapeVarCross( commitmentQ, x_order = "spi", x_stem = "sat.g", x_delim1 = ".", x_delim2="_", distinguish_1="1", distinguish_2="2" ) sat.resids.script <- scriptUni( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts", "residuals"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dUni_residual" ) sat.ints.script <- scriptUni( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings", "intercepts"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dUni_intercept" ) sat.loads.script <- scriptUni( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = c("loadings"), constr_dy_struct = "none", writeTo = tempdir(), fileName = "dUni_loading" ) sat.config.script <- scriptUni( dvn, scaleset = "FF", lvname = "Sat", constr_dy_meas = "none", constr_dy_struct = "none", writeTo = tempdir(), fileName = "dUni_configural" )
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" )