Learn R Programming

robmed (version 1.2.1)

coef.test_mediation: Coefficients in (robust) mediation analysis

Description

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

Usage

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

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

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

Value

A numeric vector containing the requested coefficients.

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").

Author

Andreas Alfons

See Also

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

Examples

Run this code
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, level = 0.9)
coef(boot, type = "data")  # from original sample
coef(boot, type = "boot")  # means of bootstrap replicates

Run the code above in your browser using DataLab