print.indirect_proportion function

Print an 'indirect_proportion'-Class Object

Print an 'indirect_proportion'-Class Object

Print the content of an 'indirect_proportion'-class object, the output of indirect_proportion().

## S3 method for class 'indirect_proportion' print(x, digits = 3, annotation = TRUE, ...)

Arguments

  • x: An 'indirect_proportion'-class object.
  • digits: Number of digits to display. Default is 3.
  • annotation: Logical. Whether additional information should be printed. Default is TRUE.
  • ...: Optional arguments. Not used.

Returns

x is returned invisibly. Called for its side effect.

Details

The print method of the indirect_proportion-class object, which is produced by indirect_proportion(). In addition to the proportion of effect mediated, it also prints additional information such as the path for which the proportion is computed, and all indirect path(s) from the x-variable to the y-variable.

To get the proportion as a scalar, use the coef method of indirect_proportion objects.

Examples

library(lavaan) dat <- data_med head(dat) mod <- " m ~ x + c1 + c2 y ~ m + x + c1 + c2 " fit <- sem(mod, dat, fixed.x = FALSE) out <- indirect_proportion(x = "x", y = "y", m = "m", fit = fit) out print(out, digits = 5)

See Also

indirect_proportion()

  • Maintainer: Shu Fai Cheung
  • License: GPL (>= 3)
  • Last published: 2025-01-25