defineCategoricalLink | R Documentation |
Identify categorical links in latent variable models.
defineCategoricalLink(object, link, data)
## S3 method for class 'lvm'
defineCategoricalLink(object, link = NULL, data = NULL)
object |
a |
link |
[character] the links to be analyzed. If |
data |
[data.frame] the dataset that will be used to fit the model. If |
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").
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.