Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/fit_mediation.R
(Robustly) estimate the effects in a mediation model.
1 2 3 
data 
a data frame containing the variables. 
x 
a character string, an integer or a logical vector specifying the
column of 
y 
a character string, an integer or a logical vector specifying the
column of 
m 
a character, integer or logical vector specifying the columns of

covariates 
optional; a character, integer or logical vector
specifying the columns of 
method 
a character string specifying the method of
estimation. Possible values are 
robust 
a logical indicating whether to robustly estimate the effects
(defaults to 
median 
a logical indicating if the effects should be estimated via
median regression (defaults to 
control 
a list of tuning parameters for the corresponding robust
method. For robust regression ( 
... 
additional arguments can be used to specify tuning parameters
directly instead of via 
If method
is "regression"
, robust
is TRUE
and
median
is FALSE
(the defaults), the effects are estimated via
robust regressions with lmrob
.
If method
is "regression"
, robust
is TRUE
and
median
is TRUE
, the effects are estimated via median
regressions with rq
. Unlike the robust regressions
above, median regressions are not robust against outliers in the explanatory
variables.
If method
is "covariance"
and robust
is TRUE
,
the effects are estimated based on a Huber Mestimator of location and
scatter. Note that this covariancebased approach is less robust than the
approach based on robust regressions described above.
An object inheriting from class "fit_mediation"
(class
"reg_fit_mediation"
if method
is "regression"
or
"cov_fit_mediation"
if method
is "covariance"
) with
the following components:
a 
a numeric vector containing the point estimates of the effect of the independent variable on the proposed mediator variables. 
b 
a numeric vector containing the point estimates of the direct effect of the proposed mediator variables on the dependent variable. 
c 
numeric; the point estimate of the direct effect of the independent variable on the dependent variable. 
c_prime 
numeric; the point estimate of the total effect of the independent variable on the dependent variable. 
fit_mx 
an object of class 
fit_ymx 
an object of class 
fit_yx 
an object of class 
cov 
an object of class 
x, y, m, covariates 
character vectors specifying the respective variables used. 
data 
a data frame containing the independent, dependent and proposed mediator variables, as well as covariates. 
robust 
a logical indicating whether the effects were estimated robustly. 
median 
a logical indicating whether the effects were estimated
via median regression (only 
control 
a list of tuning parameters used (only if 
Andreas Alfons
Alfons, A., Ates, N.Y. and Groenen, P.J.F. (2018) A robust bootstrap test for mediation analysis. ERIM Report Series in Management, Erasmus Research Institute of Management. URL https://hdl.handle.net/1765/109594.
Yuan, Y. and MacKinnon, D.P. (2014) Robust mediation analysis based on median regression. Psychological Methods, 19(1), 1–20.
Zu, J. and Yuan, K.H. (2010) Local influence and robust procedures for mediation analysis. Multivariate Behavioral Research, 45(1), 1–44.
1 2 3 4 5 6 7  data("BSG2014")
fit < fit_mediation(BSG2014,
x = "ValueDiversity",
y = "TeamCommitment",
m = "TaskConflict")
test < test_mediation(fit)
summary(test)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.