Skip to contents

Return the confidence intervals of the indirect effects stored in the output of many_indirect_effects().

Usage

# S3 method for class 'indirect_list'
confint(object, parm = NULL, level = 0.95, ...)

Arguments

object

The output of many_indirect_effects().

parm

Ignored for now.

level

The level of confidence, default is .95, returning the 95% confidence interval.

...

Additional arguments. Ignored by the function.

Value

A two-column data frame. The columns are the limits of the confidence intervals.

Details

It extracts and returns the stored confidence interval if available.

The type of confidence intervals depends on the call used to compute the effects. This function merely retrieves the stored estimates, which could be generated by nonparametric bootstrapping, Monte Carlo simulation, or other methods to be supported in the future, and uses them to form the percentile confidence interval.

Examples


library(lavaan)
data(data_serial_parallel)
mod <-
"
m11 ~ x + c1 + c2
m12 ~ m11 + x + c1 + c2
m2 ~ x + c1 + c2
y ~ m12 + m2 + m11 + x + c1 + c2
"
fit <- sem(mod, data_serial_parallel,
           fixed.x = FALSE)
# All indirect paths from x to y
paths <- all_indirect_paths(fit,
                           x = "x",
                           y = "y")
paths
#> Call: 
#> all_indirect_paths(fit = fit, x = "x", y = "y")
#> Path(s): 
#>   path                
#> 1 x -> m11 -> m12 -> y
#> 2 x -> m11 -> y       
#> 3 x -> m12 -> y       
#> 4 x -> m2 -> y        
# Indirect effect estimates
# R should be 2000 or even 5000 in real research
# parallel should be used in real research.
fit_boot <- do_boot(fit, R = 45, seed = 8974,
                    parallel = FALSE,
                    progress = FALSE)
out <- many_indirect_effects(paths,
                             fit = fit,
                             boot_ci = TRUE,
                             boot_out = fit_boot)
out
#> 
#> ==  Indirect Effect(s)   ==
#>                        ind  CI.lo CI.hi Sig
#> x -> m11 -> m12 -> y 0.193  0.029 0.550 Sig
#> x -> m11 -> y        0.163 -0.346 0.570    
#> x -> m12 -> y        0.059 -0.156 0.208    
#> x -> m2 -> y         0.364  0.130 0.889 Sig
#> 
#>  - [CI.lo to CI.hi] are 95.0% percentile confidence intervals by
#>    nonparametric bootstrapping with 45 samples.
#>  - The 'ind' column shows the indirect effects.
#>  
confint(out)
#>                      Percentile: 2.5 % Percentile: 97.5 %
#> x -> m11 -> m12 -> y        0.02866626          0.5501760
#> x -> m11 -> y              -0.34617725          0.5702562
#> x -> m12 -> y              -0.15615492          0.2081817
#> x -> m2 -> y                0.12961514          0.8892807