defineCategoricalLink: Identify Categorical Links in LVM

defineCategoricalLinkR Documentation

Identify Categorical Links in LVM

Description

Identify categorical links in latent variable models.

Usage

defineCategoricalLink(object, link, data)

## S3 method for class 'lvm'
defineCategoricalLink(object, link = NULL, data = NULL)

Arguments

object

a lvm model.

link

[character] the links to be analyzed. If NULL, all the coefficients from the lvm model are used instead.

data

[data.frame] the dataset that will be used to fit the model. If NULL, a simulated data will be generated from the model.

Value

a data.frame with a description of each link in rows.
The column factitious identify the links that will be replaced with other links (e.g. "Y1~X1" becomes "Y1~X1b" and "Y1~X1c").

Examples

## Not run: 
defineCategoricalLink <- lavaSearch2:::defineCategoricalLink
defineCategoricalLink.lvm <- lavaSearch2:::defineCategoricalLink.lvm

## linear model
m <- lvm(Y1~X1+X2,Y2~X1+X3)
categorical(m, K = 3) <- "X1"
try(defineCategoricalLink(m)) # error

categorical(m, K = 3, labels = 1:3) <- "X1"
defineCategoricalLink(m)
defineCategoricalLink(m, "Y~X1")
defineCategoricalLink(m, "X1:0|1")
defineCategoricalLink(m, "X1:1|2")
defineCategoricalLink(m, c("X1:0|1", "X1:1|2"))
defineCategoricalLink(m, c("Y~X1","Y~X2"))
defineCategoricalLink(m, c("Y~X2","Y~X1"))

## latent variable model
m <- lvm()
regression(m) <- c(y1,y2,y3)~u
regression(m) <- u~x1+x2
latent(m) <- ~u
covariance(m) <- y1~y2
categorical(m, labels = as.character(1:3)) <- "X1"

defineCategoricalLink(m)

## End(Not run)


bozenne/lavaSearch2 documentation built on Feb. 13, 2024, 10:18 p.m.