Learn R Programming

lava (version 1.4.1)

path: Extract pathways in model graph

Description

Extract all possible paths from one variable to another connected component in a latent variable model. In an estimated model the effect size is decomposed into direct, indirect and total effects including approximate standard errors.

Usage

## S3 method for class 'lvm':
path(object, to = NULL, from, ...)
## S3 method for class 'lvmfit':
effects(object, to, from, silent=FALSE, ...)

Arguments

object
Model object (lvm)
to
Outcome variable (string). Alternatively a formula specifying response and predictor in which case the argument from is ignored.
from
Response variable (string), not necessarily directly affected by to.
silent
Logical variable which indicates whether messages are turned on/off.
...
Additional arguments to be passed to the low level functions

Value

  • If object is of class lvmfit a list with the following elements is returned
  • idxA list where each element defines a possible pathway via a integer vector indicating the index of the visited nodes.
  • VA List of covariance matrices for each path.
  • coefA list of parameters estimates for each path
  • pathA list where each element defines a possible pathway via a character vector naming the visited nodes in order.
  • edgesDescription of 'comp2'
  • If object is of class lvm only the path element will be returned.

    The effects method returns an object of class effects.

See Also

children, parents

Examples

Run this code
m <- lvm(c(y1,y2,y3)~eta)
regression(m) <- y2~x1
latent(m) <- ~eta
regression(m) <- eta~x1+x2
d <- sim(m,500)
e <- estimate(m,d)

path(Model(e),y2~x1)
parents(Model(e), ~y2)
children(Model(e), ~x2)
children(Model(e), ~x2+eta)
effects(e,y2~x1)

Run the code above in your browser using DataLab