
Last chance! 50% off unlimited learning
Sale ends in
Generic interface to set a value to a link in a lvm
object.
setLink(object, ...)# S3 method for lvm
setLink(object, var1, var2, value, warnings = FALSE, ...)
a lvm
object.
[internal] only used by the generic method.
[character or formula] the exogenous variable of the new link or a formula describing the link to be added to the lvm.
[character] the endogenous variable of the new link. Disregarded if the argument var1
is a formula.
[numeric] the value at which the link should be set.
[logical] should a warning be displayed if the link is not found in the lvm
object.
library(lava)
set.seed(10)
m <- lvm()
regression(m) <- c(y1,y2,y3)~u
regression(m) <- u~x1+x2
latent(m) <- ~u
covariance(m) <- y1 ~ y2
m1 <- setLink(m, y3 ~ u, value = 1)
estimate(m1, lava::sim(m,1e2))
# m1 <- setLink(m, u ~ y3, value = 1)
m2 <- setLink(m, y1 ~ y2, value = 0.5)
estimate(m2, lava::sim(m,1e2))
Run the code above in your browser using DataLab