Learn R Programming

robmed (version 1.2.1)

retest: Retest for mediation

Description

Re-perform a test for the indirect effect(s) based on results from (robust) mediation analysis. This function is purely available for computational convenience if the analysis was accidentally run with the wrong parameter settings, as it avoids having to re-run the bootstrap procedure. It must not be abused for \(p\)-hacking.

Usage

retest(object, ...)

# S3 method for boot_test_mediation retest(object, alternative, level, type, contrast, ...)

# S3 method for sobel_test_mediation retest(object, alternative, order, ...)

Value

An object of the same class as object with updated test results (see test_mediation()).

Arguments

object

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

...

additional arguments to be passed down to methods.

alternative

a character string specifying the alternative hypothesis in the test for the indirect effect. Possible values are "twosided", "less" or "greater".

level

numeric; the confidence level of the confidence interval in the bootstrap test.

type

a character string specifying the type of confidence interval to be computed in the bootstrap test. Possible values are "perc" for the percentile bootstrap, or "bca" for the bias-corrected and accelerated (BCa) bootstrap.

contrast

a logical indicating whether to compute pairwise contrasts of the indirect effects. This can also be a character string, with "estimates" for computing the pairwise differences of the indirect effects (such that it is tested whether two indirect effects are equal), and "absolute" for computing the pairwise differences of the absolute values of the indirect effects (such that it is tested whether two indirect effects are equal in magnitude). This is only relevant for models with multiple indirect effects, which are currently only implemented for bootstrap tests and estimation via regressions.

order

a character string specifying the order of approximation of the standard error in Sobel's test. Possible values are "first" for a first-order approximation, and "second" for a second-order approximation.

Author

Andreas Alfons

See Also

test_mediation()

Examples

Run this code
data("BSG2014")

# run fast-and-robust bootstrap test
boot <- test_mediation(BSG2014,
                       x = "SharedLeadership",
                       y = "TeamPerformance",
                       m = c("ProceduralJustice",
                             "InteractionalJustice"),
                       covariates = c("AgeDiversity",
                                      "GenderDiversity"))
summary(boot)

# now include comparison of indirect effects
retest(boot, contrast = "estimates")

Run the code above in your browser using DataLab