Skip to contents

Convert lavaan fitted object to fix the psychonetrics model's loadings

Usage

lav_to_pnet_fix(fit, lnm.model = NULL, ...)

Arguments

fit

A lavaan fitted object

lnm.model

Optional. UNfitted psychonetrics model object. Must have the same factor structure as the lavaan fitted object. If not provided, a new psychonetrics model will be created based on the lavaan model's structure.

...

Additional arguments passed to the function `lnm` of `psychonetrics` package.

Value

A psychonetrics model with fixed loadings based on the lavaan fitted object

Examples

HS.model <- ' visual  =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed   =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data=HolzingerSwineford1939, group = "school")
#> Error in cfa(HS.model, data = HolzingerSwineford1939, group = "school"): could not find function "cfa"
lnm_mod_fixed = lav_to_pnet_fix(fit, data = HolzingerSwineford1939, groupvar = "school")
#> Error in lav_to_pnet_fix(fit, data = HolzingerSwineford1939, groupvar = "school"): Package 'psychonetrics' is required for this function. Please install it first.
lnm_mod_fixed %>% runmodel %>% parameters
#> Error in parameters(.): could not find function "parameters"