Learn R Programming

WRS2 (version 1.1-6)

ZYmediate: Robust mediation test

Description

Performs a robust mediation test according to the method proposed by Zu & Yuan (2010).

Usage

ZYmediate(x, y, med, nboot = 2000, alpha = 0.05, kappa = 0.05, ...)

Value

ZYmediate returns an object of class "robmed" containing:

a.est

effect of predictor on mediator)

b.est

effect of mediator on response (in multiple regression model which includes the predictor as well)

ab.est

indirect effect (mediation effect)

CI.ab

confidence interval mediation effect

p.value

p-value mediation test

call

function call

Arguments

x

vector with predictor values.

y

vector with response values.

med

vector with mediator values.

nboot

number of bootstrap samples.

alpha

alpha level.

kappa

the percent of cases to be controlled when robust method is used.

...

currently ignored.

References

Zu J., Yuan, K.-H. (2010). Local influence and robust procedures for mediation analysis. Multivariate Behavioral Research, 45, 1-44.

Examples

Run this code
## Leerkes data:
## Y: Efficacy
## X: MatCare
## M: Esteem

## fitting robust mediator regressions
require(MASS)
summary(rlm(Efficacy ~ MatCare, data = Leerkes))
summary(rlm(Esteem ~ MatCare, data = Leerkes))
summary(rlm(Efficacy ~ MatCare + Esteem, data = Leerkes))

## robust testing of mediating effect (indirect effect)
with(Leerkes, ZYmediate(MatCare, Efficacy, Esteem))

Run the code above in your browser using DataLab