confint.test_mediation: Confidence intervals from (robust) mediation analysis

confint.test_mediationR Documentation

Confidence intervals from (robust) mediation analysis

Description

Extract or compute confidence intervals for effects in (robust) mediation analysis.

Usage

## S3 method for class 'boot_test_mediation'
confint(object, parm = NULL, level = NULL, type = c("boot", "data"), ...)

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

Arguments

object

an object inheriting from class "test_mediation" containing results from (robust) mediation analysis.

parm

an integer, character or logical vector specifying the paths for which to extract or compute confidence intervals, or NULL to extract or compute confidence intervals for all coefficients. In case of a character vector, possible values are "a", "b", "d" (only serial multiple mediator models), "total", "direct", and "indirect".

level

for the "boot_test_mediation" method, this is ignored and the confidence level of the bootstrap confidence interval for the indirect effect is used. For the other methods, the confidence level of the confidence intervals to be computed. The default is to compute 95% confidence intervals.

type

a character string specifying how to compute the confidence interval of the effects other than the indirect effect(s). Possible values are "boot" (the default) to compute bootstrap confidence intervals using the normal approximation (i.e., to assume a normal distribution of the corresponding effect with the standard deviation computed from the bootstrap replicates), or "data" to compute confidence intervals via statistical theory based on the original data (e.g., based on a t-distribution if the coefficients are estimated via regression). Note that this is only relevant for mediation analysis via a bootstrap test, where the confidence interval of the indirect effect is always computed via a percentile-based method due to the asymmetry of its distribution.

...

additional arguments are currently ignored.

Value

A numeric matrix containing the requested confidence intervals.

Author(s)

Andreas Alfons

See Also

test_mediation(), coef(), p_value(), boot.ci()

Examples

data("BSG2014")

# run fast-and-robust bootstrap test
robust_boot <- test_mediation(BSG2014,
                              x = "ValueDiversity",
                              y = "TeamCommitment",
                              m = "TaskConflict",
                              robust = TRUE)
confint(robust_boot, type = "boot")

# run OLS bootstrap test
ols_boot <- test_mediation(BSG2014,
                           x = "ValueDiversity",
                           y = "TeamCommitment",
                           m = "TaskConflict",
                           robust = FALSE)
confint(ols_boot, type = "data")


aalfons/robmed documentation built on July 4, 2023, 7:48 a.m.