terms.lm_from_lavaan: Model Terms of an 'lm_from_lavaan'-Class Object

View source: R/lavaan2lm_list.R

terms.lm_from_lavaanR Documentation

Model Terms of an 'lm_from_lavaan'-Class Object

Description

It extracts the terms object from an lm_from_lavaan-class object.

Usage

## S3 method for class 'lm_from_lavaan'
terms(x, ...)

Arguments

x

An 'lm_from_lavaan'-class object.

...

Additional arguments. Ignored.

Details

A method for lm_from_lavaan-class that converts a regression model for a variable in a lavaan model to a formula object. This function simply calls stats::terms() on the formula object to extract the predictors of a variable.

Value

A terms-class object. See terms.object for details.

See Also

terms.object, lm_from_lavaan_list()

Examples

library(lavaan)
data(data_med)
mod <-
"
m ~ a * x + c1 + c2
y ~ b * m + x + c1 + c2
"
fit <- sem(mod, data_med, fixed.x = FALSE)
fit_list <- lm_from_lavaan_list(fit)
terms(fit_list$m)
terms(fit_list$y)


manymome documentation built on Oct. 4, 2024, 5:10 p.m.