ZYmediate: Robust mediation test

Description Usage Arguments Value References Examples

View source: R/ZYmediate.R

Description

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

Usage

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

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.

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

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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))

WRS2 documentation built on May 19, 2017, 9:55 a.m.

Search within the WRS2 package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.