setLink {lavaSearch2} | R Documentation |
Set a Link to a Value
Description
Generic interface to set a value to a link in a lvm
object.
Usage
setLink(object, ...)
## S3 method for class 'lvm'
setLink(object, var1, var2, value, warnings = FALSE, ...)
Arguments
object |
a |
... |
[internal] only used by the generic method. |
var1 |
[character or formula] the exogenous variable of the new link or a formula describing the link to be added to the lvm. |
var2 |
[character] the endogenous variable of the new link. Disregarded if the argument |
value |
[numeric] the value at which the link should be set. |
warnings |
[logical] should a warning be displayed if the link is not found in the |
Examples
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))
[Package lavaSearch2 version 2.0.3 Index]