Learn R Programming

robmed (version 1.2.1)

p_value: p-Values from (robust) mediation analysis

Description

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

Usage

p_value(object, ...)

# S3 method for boot_test_mediation p_value(object, parm = NULL, type = c("boot", "data"), digits = 4L, ...)

# S3 method for sobel_test_mediation p_value(object, parm = NULL, ...)

Value

A numeric vector containing the requested p-values.

Arguments

object

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

...

for the generic function, additional arguments to be passed down to methods. For the methods, additional arguments are currently ignored.

parm

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

type

a character string specifying how to compute the p-values of the effects other than the indirect effect(s). Possible values are "boot" (the default) to compute bootstrap p-values 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 p-values 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 p-value of the indirect effect is always computed as described in ‘Details’.

digits

an integer determining how many digits to compute for the p-values of the indirect effects (see ‘Details’). The default is to compute 4 digits after the comma.

Author

Andreas Alfons

Details

For bootstrap tests, the p-value of the indirect effect is computed as the smallest significance level \(\alpha\) for which the \((1 - \alpha) * 100\%\) confidence interval obtained from the bootstrapped distribution 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 of the indirect effect is already stored in the object returned by test_mediation() and is simply extracted.

See Also

test_mediation(), coef(), confint()

Examples

Run this code
data("BSG2014")
boot <- test_mediation(BSG2014,
                       x = "ValueDiversity",
                       y = "TeamCommitment",
                       m = "TaskConflict",
                       level = 0.9)
p_value(boot)

Run the code above in your browser using DataLab