p_value: p-Values for (robust) mediation analysis

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/p_value.R

Description

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

Usage

1
2
3
4
5
6
7
p_value(object, ...)

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

## S3 method for class '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.

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.

Value

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

Author(s)

Andreas Alfons

See Also

test_mediation, boot.ci

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)

## End(Not run)

robmed documentation built on Nov. 5, 2018, 5:06 p.m.