View source: R/compare_models.R
| compare_models | R Documentation |
This is the core function of the modelscompete4 package. It automatically fits a list of SEM models, determines their nesting relationship, and performs the appropriate statistical comparison (chi-square difference test for nested models, Vuong test for non-nested models).
compare_models(
model_list,
data,
estimator = "ML",
se = "standard",
bootstrap = 1000,
parallel = "no",
verbose = TRUE,
...
)
model_list |
A named list. Each element is a character string specifying the model syntax in lavaan format. |
data |
A data.frame containing the observed variables used in the models. |
estimator |
The estimator to be used (e.g., "ML"). Passed to
|
se |
Type of standard errors. Default is "standard". Use "bootstrap" for bootstrapped standard errors and confidence intervals. |
bootstrap |
Number of bootstrap draws if
|
parallel |
Method for parallel processing for bootstrapping ("multicore", "snow", or "no"). Recommended for large samples. |
verbose |
Logical; if TRUE, progress messages are printed. |
... |
Additional arguments passed to
|
An object of class modelscompete4. This is a list
containing:
fit_list: The list of fitted lavaan objects.
fit_table: A data.frame of key fit indices for all
models.
comparison_matrix: A matrix showing pairwise nesting
relationships and test results.
test_results: Detailed results of the statistical
tests performed.
bootstrap_summary: Summary of bootstrapped results if
requested.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.