get_add {modelbpp} | R Documentation |
Models That Are Less Restricted
Description
Generate a list of models with one or more fixed parameter freed.
Usage
get_add(
sem_out,
must_add = NULL,
must_not_add = NULL,
remove_constraints = TRUE,
exclude_error_cov = TRUE,
df_change = 1,
model_id = NA,
keep_correct_df_change = TRUE,
remove_duplicated = TRUE,
progress = FALSE
)
Arguments
sem_out |
The original model, which is the output from an structural equation modeling function. Currently support lavaan::lavaan objects only. |
must_add |
A character vector
of parameters, named in
|
must_not_add |
A character
vector of parameters, named in
|
remove_constraints |
Whether
equality constraints will be
removed. Default is |
exclude_error_cov |
Exclude
error covariances of indicators.
Default is |
df_change |
How many degrees of freedom (df) away in the list. All models with df change less than or equal to this number will be included, taking into account requirements set by other arguments. Default is 1. |
model_id |
The identification
number of the starting model.
Default is |
keep_correct_df_change |
Keep only models with actual df change equal to expected df change. |
remove_duplicated |
If |
progress |
Whether a progress
bar will be displayed, implemented
by the |
Details
It generates a list of models with one or more fixed parameter freed (and the degrees of freedom, df, increases by one or more). If a model has equality constraints, models with one or more of the constraints between two free parameters released will also be included.
Graphically, paths or covariances are "added" to form the list of models.
The models to be included are
identified by
lavaan::modificationIndices()
.
The models will be checked by lavaan
to make sure that the decrease in
model degrees of freedom is of the
expected value.
This function is called by
model_set()
and usually users do
not need to call it. It is exported
for advanced users.
Value
An object of the class
partables
, a named list of parameter
tables, each of them to be used by
lavaan::lavaan()
or update()
for fitting a model with the added
parameters.
Author(s)
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448
See Also
Examples
library(lavaan)
dat <- dat_path_model
mod <-
"
x3 ~ a*x1 + b*x2
x4 ~ a*x1
ab := a*b
"
fit <- sem(mod, dat_path_model, fixed.x = TRUE)
mod_to_add <- get_add(fit)
mod_to_add