Evaluate Invariance Equality Constraints in a specified Dyadic Invariance Model
Source:R/outputConstraintTab.R
outputConstraintTab.Rd
outputConstraintTab()
is used to perform a score test for relaxing each
invariance equality constraint between partners in a given dyadic SEM model.
Usage
outputConstraintTab(
constrainFit,
filterSig = FALSE,
gtTab = FALSE,
writeTo = NULL,
fileName = NULL
)
Arguments
- constrainFit
A fitted
lavaan
model with dyadic invariance equality constraints- filterSig
A logical indicating whether to filter for significant constraints (default is
FALSE
)- gtTab
A logical input indicating whether to generate the output in
gt::gt()
table object format (TRUE
). By default (FALSE
), the output is generated intibble::tibble()
format. Users can also apply thewriteTo
argument if they wish to export thegt:gt()
table object.- writeTo
A character string specifying a directory path to where the
gt::gt()
table object should be saved. If set to ".", the file will be written to the current working directory. The default isNULL
, and examples use a temporary directory created bytempdir()
.writeTo
is only relevant ifgtTab = TRUE
.- fileName
A character string specifying a desired base name for the output
gt::gt()
file. If afileName
is not provided (i.e.,fileName = NULL
), then a default will be used (i.e., "dySEM_table"). The resulting base name will automatically be appended with a.rtf
file extension.fileName
is only relevant ifgtTab = TRUE
andwriteTo
is specified.
Value
A list. More specifically, a 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.
Details
If
gtTab = TRUE
andwriteTo
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.
Examples
dvn <- scrapeVarCross(dat = commitmentM, x_order = "sip", x_stem = "sat.g",
x_delim2="_", distinguish_1="f", distinguish_2="m")
sat.resids.script <- scriptCFA(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")
#> Output stored in: /tmp/Rtmpu7vXEu/dCFA_Residual.rtf
param1
constraint
param2
chi2
df
pvalue
sig