Learn R Programming

psycho (version 0.4.91)

find_best_model.lavaan: Returns all combinations of lavaan models with their indices of fit.

Description

Returns all combinations of lavaan models with their indices of fit.

Usage

# S3 method for lavaan
find_best_model(fit, latent = "", samples = 1000,
  verbose = FALSE, ...)

Arguments

fit

A lavaan object.

latent

Copy/paste the part related to latent variables loadings.

samples

Number of random draws.

verbose

Show progress.

...

Arguments passed to or from other methods.

Value

list containing all combinations.

Examples

Run this code
# NOT RUN {
library(psycho)
library(lavaan)

model <- " visual  =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed   =~ x7 + x8 + x9
visual ~ textual
textual ~ speed"
fit <- lavaan::sem(model, data = HolzingerSwineford1939)

models <- find_best_model(fit, latent = "visual  =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed   =~ x7 + x8 + x9")
# }

Run the code above in your browser using DataLab