trace_path {modsem}R Documentation

Estimate formulas for (co-)variance paths using Wright's path tracing rules

Description

This function estimates the path from x to y using the path tracing rules, note that it only works with structural parameters, so "=~" are ignored. unless measurement.model = TRUE. you want to use the measurement model, "~" in the mod column of pt.

Usage

trace_path(
  pt,
  x,
  y,
  parenthesis = TRUE,
  measurement.model = FALSE,
  maxlen = 100,
  ...
)

Arguments

pt

A data frame with columns lhs, op, rhs, and mod, from modsemify(syntax)

x

source variable

y

destination variable

parenthesis

if TRUE, the output will be enclosed in parenthesis

measurement.model

if TRUE, the function will use the measurement model

maxlen

maximum length of a path before aborting

...

additional arguments passed to trace_path

Value

A string with the estimated path (simplified if possible)

Examples

library(modsem)
m1 <- '
  # Outer Model
  X =~ x1 + x2 +x3
  Y =~ y1 + y2 + y3
  Z =~ z1 + z2 + z3

  # Inner model
  Y ~ X + Z + X:Z
'
pt <- modsemify(m1)
trace_path(pt, "Y", "Y") # variance of Y

[Package modsem version 1.0.1 Index]