fix_to_zero {semlrtp}R Documentation

Fix a Free Parameter To Zero And Fit a Model Again

Description

It fixes a designated free parameter in a lavaan object to zero and refit the model.

Usage

fix_to_zero(fit, par_id, store_fit = FALSE, se_keep_bootstrap = FALSE)

Arguments

fit

A lavaan-class object.

par_id

An integer. The row number of the free parameter in the parameter table of fit to be fixed.

store_fit

Logical. If TRUE, fit will be stored in the output. Default is FALSE.

se_keep_bootstrap

Logical. If TRUE and fit used bootstrapping standard error (with se = "bootstrap"), bootstrapping will also be use in fitting the restricted model. If FALSE, the default, then se will be set to "standard" if it is "bootstrap" in fit, to speed up the computation.

Details

It modifies the parameter table of a lavaan-class object and then fits the model again.

Users should usually call lrtp() directly instead of calling this function. It is exported for developers.

Value

A fix_to_zero-class object, which is a list with these elements:

Author(s)

Shu Fai Cheung https://orcid.org/0000-0002-9871-9448

See Also

lrtp()

Examples

library(lavaan)
data(data_sem16)
mod <-
"
f1 =~ x1 + x2 + x3
f2 =~ x4 + x5 + x6
"
fit <- sem(mod, data_sem16)
# Fix the factor covariance to zero
out <- fix_to_zero(fit, par_id = 15)
summary(out$fit0)


[Package semlrtp version 0.1.1 Index]