ZYmediate: Robust mediation test

View source: R/ZYmediate.R

ZYmediateR Documentation

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

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.

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

## 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 March 19, 2024, 3:08 a.m.

Related to ZYmediate in WRS2...