Skip to contents

Print the content of the output of cond_indirect_effects()

Usage

# S3 method for cond_indirect_effects
print(
  x,
  digits = 3,
  annotation = TRUE,
  pvalue = FALSE,
  pvalue_digits = 3,
  se = FALSE,
  ...
)

Arguments

x

The output of cond_indirect_effects().

digits

Number of digits to display. Default is 3.

annotation

Logical. Whether the annotation after the table of effects is to be printed. Default is TRUE.

pvalue

Logical. If TRUE, asymmetric p-values based on bootstrapping will be printed if available. Default is FALSE.

pvalue_digits

Number of decimal places to display for the p-values. Default is 3.

se

Logical. If TRUE and confidence intervals are available, the standard errors of the estimates are also printed. They are simply the standard deviations of the bootstrap estimates or Monte Carlo simulated values, depending on the method used to form the confidence intervals.

...

Other arguments. Not used.

Value

x is returned invisibly. Called for its side effect.

Details

The print method of the cond_indirect_effects-class object.

If bootstrapping confidence intervals were requested, this method has the option to print p-values computed by the method presented in Asparouhov and Muthén (2021). Note that these p-values are asymmetric bootstrap p-values based on the distribution of the bootstrap estimates. They not computed based on the distribution under the null hypothesis.

For a p-value of a, it means that a 100(1 - a)% bootstrapping confidence interval will have one of its limits equal to 0. A confidence interval with a higher confidence level will include zero, while a confidence interval with a lower confidence level will exclude zero.

References

Asparouhov, A., & Muthén, B. (2021). Bootstrap p-value computation. Retrieved from https://www.statmodel.com/download/FAQ-Bootstrap%20-%20Pvalue.pdf

Examples


library(lavaan)
dat <- modmed_x1m3w4y1
mod <-
"
m1 ~ a1 * x  + d1 * w1 + e1 * x:w1
m2 ~ a2 * x
y  ~ b1 * m1 + b2 * m2 + cp * x
"
fit <- sem(mod, dat,
           meanstructure = TRUE, fixed.x = FALSE, se = "none", baseline = FALSE)

# Conditional effects from x to m1 when w1 is equal to each of the default levels
cond_indirect_effects(x = "x", y = "m1",
                      wlevels = "w1", fit = fit)
#> 
#> == Conditional effects ==
#> 
#>  Path: x -> m1
#>  Conditional on moderator(s): w1
#>  Moderator(s) represented by: w1
#> 
#>      [w1]   (w1)   ind  m1~x
#> 1 M+1.0SD  1.228 0.750 0.750
#> 2 Mean     0.259 0.523 0.523
#> 3 M-1.0SD -0.710 0.297 0.297
#> 
#>  - The 'ind' column shows the  effects.
#>  - ‘m1~x’ is/are the path coefficient(s) along the path conditional on
#>    the moderators.
#> 

# Conditional Indirect effect from x1 through m1 to y,
# when w1 is equal to each of the default levels
out <- cond_indirect_effects(x = "x", y = "y", m = "m1",
                      wlevels = "w1", fit = fit)
out
#> 
#> == Conditional indirect effects ==
#> 
#>  Path: x -> m1 -> y
#>  Conditional on moderator(s): w1
#>  Moderator(s) represented by: w1
#> 
#>      [w1]   (w1)    ind  m1~x   y~m1
#> 1 M+1.0SD  1.228 -0.031 0.750 -0.042
#> 2 Mean     0.259 -0.022 0.523 -0.042
#> 3 M-1.0SD -0.710 -0.012 0.297 -0.042
#> 
#>  - The 'ind' column shows the indirect effects.
#>  - ‘m1~x’,‘y~m1’ is/are the path coefficient(s) along the path
#>    conditional on the moderators.
#> 

print(out, digits = 5)
#> 
#> == Conditional indirect effects ==
#> 
#>  Path: x -> m1 -> y
#>  Conditional on moderator(s): w1
#>  Moderator(s) represented by: w1
#> 
#>      [w1]     (w1)      ind    m1~x     y~m1
#> 1 M+1.0SD  1.22806 -0.03147 0.74988 -0.04197
#> 2 Mean     0.25900 -0.02196 0.52332 -0.04197
#> 3 M-1.0SD -0.71006 -0.01246 0.29676 -0.04197
#> 
#>  - The 'ind' column shows the indirect effects.
#>  - ‘m1~x’,‘y~m1’ is/are the path coefficient(s) along the path
#>    conditional on the moderators.
#> 

print(out, annotation = FALSE)
#> 
#> == Conditional indirect effects ==
#> 
#>  Path: x -> m1 -> y
#>  Conditional on moderator(s): w1
#>  Moderator(s) represented by: w1
#> 
#>      [w1]   (w1)    ind  m1~x   y~m1
#> 1 M+1.0SD  1.228 -0.031 0.750 -0.042
#> 2 Mean     0.259 -0.022 0.523 -0.042
#> 3 M-1.0SD -0.710 -0.012 0.297 -0.042