The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

RMediation RMediation website

CRAN status Website Status Lifecycle: stable R-hub

RMediation provides rigorous statistical methods for mediation analysis in observational and experimental designs. It addresses the known limitations of normal-theory confidence intervals (e.g., Sobel test) by implementing advanced methods that account for the non-normal distribution of the indirect effect.

Key Capabilities

1. Rigorous Confidence Intervals

Compute accurate Confidence Intervals (CIs) for indirect effects using methods that outperform the standard normal approximation:

2. Advanced Hypothesis Testing

3. Seamless Integration


Installation

You can install the stable version from CRAN:

install.packages("RMediation")

Or the development version from GitHub:

R

# install.packages("remotes")
remotes::install_github("data-wise/RMediation")

Usage

Using Summary Statistics to Calculate CIs

If you already have estimates from a published paper or other software, you can calculate CIs using coefficients (\(\hat{a}, \hat{b}\)) and their standard errors.

library(RMediation)

# Example: Single mediator
# a = 0.5, b = 0.6, se.a = 0.08, se.b = 0.04, rho = 0 (independence)
medci(mu.x = 0.5, mu.y = 0.6, se.x = 0.08, se.y = 0.04, rho = 0, type = "prodclin")

Using ci to Calculate CIs for Indirect Effects of Path with Two Sequential Mediators

library(RMediation)

# Example: Two sequential mediators
ci(mu = c(b1 = 1, b2 = .7, b3 = .6, b4 = .45),
  Sigma = c(.05, 0, 0, 0, .05, 0, 0, .03, 0, .03),
  quant = ~ b1 * b2 * b3 * b4, type = "MC", plot = TRUE, plotCI = TRUE)

Contributing

Contributions are welcome! If you encounter issues or have feature requests:

Citation

If you use RMediation in your research, please cite the following:

Package Reference: > Tofighi, D., & MacKinnon, D. P. (2011). RMediation: An R package for mediation analysis confidence intervals. Behavior Research Methods, 43, 692–700. doi:10.3758/s13428-011-0076-x

MBCO Method: > Tofighi, D., & Kelley, K. (2020). Improved inference in mediation analysis: Introducing the model-based constrained optimization procedure. Psychological Methods, 25(4), 496-515. doi:10.1037/met0000259

Bootstrap MBCO: > Tofighi, D. (2020). Bootstrap Model-Based Constrained Optimization Tests of Indirect Effects. Frontiers in Psychology, 10, 2989. doi:10.3389/fpsyg.2019.02989

License

RMediation is licensed under the GPL-3.0.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.