coef.test_mediation: Coefficients in (robust) mediation analysis

View source: R/coef.R

coef.test_mediationR Documentation

Coefficients in (robust) mediation analysis

Description

Extract coefficients from models computed in (robust) mediation analysis.

Usage

## S3 method for class 'test_mediation'
coef(object, parm = NULL, ...)

## S3 method for class 'boot_test_mediation'
coef(object, parm = NULL, type = c("boot", "data"), ...)

## S3 method for class 'fit_mediation'
coef(object, parm = NULL, ...)

Arguments

object

an object inheriting from class "test_mediation" containing results from (robust) mediation analysis, or an object inheriting from class "fit_mediation" containing a (robust) mediation model fit.

parm

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

...

additional arguments are currently ignored.

type

a character string specifying whether to extract the means of the bootstrap distribution ("boot"; the default), or the coefficient estimates based on the original data set ("data").

Value

A numeric vector containing the requested coefficients.

Author(s)

Andreas Alfons

See Also

test_mediation(), fit_mediation(), confint(), p_value()

Examples

data("BSG2014")

# fit robust mediation model and extract coefficients
fit <- fit_mediation(BSG2014,
                     x = "ValueDiversity",
                     y = "TeamCommitment",
                     m = "TaskConflict")
coef(fit)

# run fast-and-robust bootstrap test and extract coefficients
boot <- test_mediation(fit)
coef(boot, type = "data")  # from original sample
coef(boot, type = "boot")  # means of bootstrap replicates


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