Description Usage Arguments Details Value Author(s) References See Also Examples

Function to test whether the average causal mediation effects and direct effects are significantly different between two moderator strata.

1 2 3 4 5 | ```
## S3 method for class 'mediate'
test.modmed(object, covariates.1, covariates.2,
sims = object$sims, conf.level = object$conf.level, ...)
## S3 method for class 'test.modmed.mediate'
print(x, ...)
``` |

`object` |
output from |

`covariates.1` |
first set of value(s) of covariates (moderators) included in the mediator and outcome models. See documentation for the |

`covariates.2` |
second set of value(s) of covariates (moderators) included in the mediator and outcome models. |

`sims` |
number of simulation draws the test will be based on. Defaults to the number used in the original mediate fit. |

`conf.level` |
level of the returned two-sided confidence intervals for the effect differences. By default it is set to the value used in the original mediate call. |

`x` |
output from |

`...` |
additional arguments. |

The function takes the original call to `mediate`

and reruns the algorithm twice with the two sets of `covariates`

values. It assumes that the objects in the environment in which the original mediate call was made also exist in the current environment under the same variable names, i.e., it evaluates the updated call in the current environment.

When applied to a `mediate`

object, `test.modmed`

returns an object of class "`test.modmed.mediate`

", a list composed of "`htest`

" objects. See `t.test`

for more explanations of `htest`

objects. When applied to a `mediate.order`

object, the function returns an object of class "`test.modmed.mediate.order`

" which is a list composed of "`htest.order`

" objects.

Teppei Yamamoto, Massachusetts Institute of Technology, [email protected].

Tingley, D., Yamamoto, T., Hirose, K., Imai, K. and Keele, L. (2014). "mediation: R package for Causal Mediation Analysis", Journal of Statistical Software, Vol. 59, No. 5, pp. 1-38.

Imai, K., Keele, L. and Tingley, D. (2010) A General Approach to Causal Mediation Analysis, Psychological Methods, Vol. 15, No. 4 (December), pp. 309-334.

Imai, K., Keele, L. and Yamamoto, T. (2010) Identification, Inference, and Sensitivity Analysis for Causal Mediation Effects, Statistical Science, Vol. 25, No. 1 (February), pp. 51-71.

Imai, K., Keele, L., Tingley, D. and Yamamoto, T. (2009) "Causal Mediation Analysis Using R" in Advances in Social Science Research Using R, ed. H. D. Vinod New York: Springer.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
# Examples with JOBS II Field Experiment
# **For illustration purposes a small number of simulations are used**
data(jobs)
# Fit mediator and outcome models allowing for interaction with moderator
b.int <- lm(job_seek ~ treat*age + econ_hard + sex, data=jobs)
d.int <- lm(depress2 ~ treat*job_seek*age + econ_hard + sex, data=jobs)
# Initial mediate fit
fit <- mediate(b.int, d.int, sims=50, treat="treat", mediator="job_seek")
# Test for significance of moderated mediation
test.modmed(fit, list(age = 20), list(age = 70), sims = 100)
``` |

mediation documentation built on July 12, 2017, 1:02 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.