ZYmediate function

Robust mediation test

Robust mediation test

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

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.

Returns

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