addLink: Add a new link between two variables in a lvm

Description Usage Arguments Details Examples

Description

Generic interface to add links to a lvm.

Usage

1
2
3
4
5
6
7
8
addLink(x, ...)

## S3 method for class 'lvm'
addLink(x, var1, var2, covariance, allVars = vars(x),
  warnings = FALSE)

## S3 method for class 'lvm.reduced'
addLink(x, ...)

Arguments

x

a lvm model

...

arguments to be passed to lower levels functions

var1

the first variable (character) or a formula describing the link to be added to the lvm

var2

the second variable (character). Only used if var1 is a character.

covariance

does the link is bidirectional. Ignored if one of the variable is exogenous.

allVars

all the existing variables.

warnings

should a warning be displayed when no link is added

Details

The argument allVars is useful for lvm.reduce object where the command vars(x) does not return all variables. The command vars(x, xlp = TRUE) must be used instead.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
addLink <- lavaPenalty:::addLink

m <- lvm()
regression(m) <- c(y1,y2,y3)~u
regression(m) <- u~x1+x2
latent(m) <- ~u
m2 <- m

addLink(m, x1 ~ y1)
addLink(m, y1 ~ x1)
coef(addLink(m, y1 ~ y2, covariance = TRUE))

addLink(m2, "x1", "y1")
addLink(m2, "y1", "x1")
coef(addLink(m, "y1", "y2", covariance = TRUE))

## End(Not run)

bozenne/lava.penalty documentation built on May 13, 2019, 1:41 a.m.