Learn R Programming

robmed (version 0.6.0)

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

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 coefficients to be extracted, or NULL to extract all coefficients.

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 full data set ("data").

Value

A numeric vector containing the requested coefficients.

See Also

test_mediation(), fit_mediation(), confint()

Examples

Run this code
# NOT RUN {
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
test <- test_mediation(fit)
coef(test, type = "data")  # from original sample
coef(test, type = "boot")  # means of bootstrap replicates

# }

Run the code above in your browser using DataLab