Learn R Programming

lavaSearch2 (version 2.0.3)

clean: Simplify a lvm object

Description

Remove variables with no link.

Usage

clean(x, ...)

# S3 method for lvm clean(x, rm.exo = TRUE, rm.endo = TRUE, rm.latent = TRUE, ...)

Arguments

x

lvm-object

...

additional arguments to lower level functions

rm.exo

should exogenous variables with no links be removed from the object?

rm.endo

should endogenous variables with no links be removed from the object?

rm.latent

should latent variables with no links be removed from the object?

Examples

Run this code

m <- lvm()
m <- regression(m, x=paste0("x",1:5),y="y1")
m <- regression(m, x=paste0("x",1:5),y="y2")
covariance(m) <- y1~y2

cancel(m) <- y1 ~ x1
cancel(m) <- y2 ~ x1
clean(m)

m <- lvm(y1 ~ eta + x1, y2 ~ eta, y3 ~ eta + x2)
latent(m) <- ~eta
clean(m)
m
cancel(m) <- y1 ~ eta
cancel(m) <- y2 ~ eta
cancel(m) <- y3 ~ eta
clean(m)

Run the code above in your browser using DataLab