get_one_cond_indirect_effect function

Get The Conditional Indirect Effect for One Row of 'cond_indirect_effects' Output

Get The Conditional Indirect Effect for One Row of 'cond_indirect_effects' Output

Return the conditional indirect effect of one row of the output of cond_indirect_effects().

get_one_cond_indirect_effect(object, row) get_one_cond_effect(object, row) print_all_cond_indirect_effects(object, ...) print_all_cond_effects(object, ...)

Arguments

  • object: The output of cond_indirect_effects().
  • row: The row number of the row to be retrieved.
  • ...: Optional arguments to be passed to teh print method of the output of indirect_effect() and cond_indirect()

Returns

get_one_cond_indirect_effect()

returns an indirect-class object, similar to the output of indirect_effect() and cond_indirect(). See indirect_effect() and cond_indirect() for details on these classes.

print_all_cond_indirect_effects()

returns the object invisibly. Called for its side effect.

Details

get_one_cond_indirect_effect()

extracts the corresponding output of cond_indirect() from the requested row.

get_one_cond_effect() is an alias of get_one_cond_indirect_effect().

print_all_cond_indirect_effects() loops over the conditional effects and print all of them.

print_all_cond_effects() is an alias of print_all_cond_indirect_effects().

Examples

library(lavaan) dat <- modmed_x1m3w4y1 mod <- " m1 ~ x + w1 + x:w1 m2 ~ m1 y ~ m2 + x + w4 + m2:w4 " fit <- sem(mod, dat, meanstructure = TRUE, fixed.x = FALSE, se = "none", baseline = FALSE) est <- parameterEstimates(fit) # Examples for cond_indirect(): # Conditional effects from x to m1 # when w1 is equal to each of the default levels out1 <- cond_indirect_effects(x = "x", y = "m1", wlevels = c("w1", "w4"), fit = fit) get_one_cond_indirect_effect(out1, 3) # Conditional Indirect effect from x1 through m1 to y, # when w1 is equal to each of the levels out2 <- cond_indirect_effects(x = "x", y = "y", m = c("m1", "m2"), wlevels = c("w1", "w4"), fit = fit) get_one_cond_indirect_effect(out2, 4) print_all_cond_indirect_effects(out2, digits = 2)

See Also

cond_indirect_effects

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