p_value {robmed}R Documentation

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 class 'boot_test_mediation'
p_value(object, parm = NULL, type = c("boot", "data"), digits = 4L, ...)

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

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.

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.

Value

A numeric vector containing the requested p-values.

Author(s)

Andreas Alfons

See Also

test_mediation(), coef(), confint()

Examples

data("BSG2014")


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



[Package robmed version 1.0.2 Index]