| m | R Documentation |
m() and its wrappers parallel_m() and serial_m()
create an object of hypothesized mediators, while covariates()
creates an object of control variables. Usually, these are used in a
formula specifying a mediation model.
m(..., .model = c("parallel", "serial"))
parallel_m(...)
serial_m(...)
covariates(...)
... |
variables are supplied as arguments, as usual separated by a comma. |
.model |
a character string specifying the type of model in case of
multiple mediators. Possible values are |
m() and covariates() are essentially wrappers for
cbind() with a specific class prepended to the
class(es) of the resulting object.
parallel_m() and serial_m() are wrappers for m() with
the respective value for argument .model.
m() returns an object inheriting from class
"mediators" (with subclass "parallel_mediators" or
"serial_mediators" as specified by argument .model),
and covariates() returns an object of class "covariates".
Typically, these inherit from class "matrix".
Andreas Alfons
fit_mediation(), test_mediation()
data("BSG2014")
# inside formula
fit_mediation(TeamCommitment ~ m(TaskConflict) + ValueDiversity,
data = BSG2014)
# outside formula
mediator <- with(BSG2014, m(TaskConflict))
fit_mediation(TeamCommitment ~ mediator + ValueDiversity,
data = BSG2014)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.