retest: Retest for mediation

View source: R/retest.R

retestR Documentation

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 class 'boot_test_mediation'
retest(object, alternative, level, type, contrast, ...)

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

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 "bca" for the bias-corrected and accelerated (BCa) bootstrap, or "perc" for the percentile 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.

Value

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

Note

From version 0.9.0 onwards, the behavior of this function changed. For arguments that are not supplied, the corresponding values of object are now used as defaults.

Author(s)

Andreas Alfons

See Also

test_mediation()

Examples

data("BSG2014")

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

# now compute 97.5% confidence interval
retest(boot, level = 0.975)


robmed documentation built on July 9, 2023, 6:29 p.m.