Learn R Programming

robmed (version 0.5.0)

p_value: p-Values for (robust) mediation analysis

Description

Estimate or extract the p-values for indirect effects in (robust) mediation analysis.

Usage

p_value(object, ...)

# S3 method for boot_test_mediation p_value(object, digits = 4L, ...)

# S3 method for sobel_test_mediation p_value(object, ...)

Arguments

object

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

additional arguments are currently ignored.

digits

an integer determining the number of digits of the p-values to be computed. The default is to compute 4 digits after the comma.

Value

A numeric vector containing the p-values for the indirect effect(s).

Details

For bootstrap tests, the p-value is estimated as the smallest significance level \(\alpha\) for which the \((1 - \alpha) * 100\%\) confidence interval obtained from the bootstrapped distribution of the indirect effect does not contain 0.

This is a simple implementation, where each digit after the comma is determined via a grid search. Hence computation time can be long if confidence intervals are computed via the bias-corrected and accelerated method ("bca").

For Sobel tests, the p-value is already stored in the object returned by test_mediation and simply extracted.

See Also

test_mediation, boot.ci

Examples

Run this code
# NOT RUN {
data("BSG2014")

# }
# NOT RUN {
# BCa intervals are recommended, but take a while to run
test_bca <- test_mediation(BSG2014,
                           x = "ValueDiversity",
                           y = "TeamCommitment",
                           m = "TaskConflict",
                           type = "bca")
p_value(test_bca)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab