# Marginal Mediation

Provides the ability to perform "Marginal Mediation"--mediation wherein the indirect and direct effects are in terms of the average marginal effects (Bartus, 2005, < https://EconPapers.repec.org/RePEc:tsj:stataj:v:5:y:2005:i:3:p:309-329>). The style of the average marginal effects stems from Thomas Leeper's work on the "margins" package. This framework allows the use of categorical mediators and outcomes with little change in interpretation from the continuous mediators/outcomes. See for more details on the method.

The `MarginalMediation` package provides the ability to perform marginal mediation analysis. It provides a useful statistical framework from which to interpret the coefficients in a mediation analysis, especially when the mediator(s) and/or outcome is binary or a count (other types of outcomes will be added).

You can install it via:

or

The main function is `mma()`:

where `...` consists of 2 or more model objects. The first is the `b` and `c'` path model, while the others are the `a` path models.

The `ind_effects` is a vector of requested mediated paths. These estimates are in terms of the average marginal effects using the `a x b` method of estimating indirect paths. Any number of these can be included, although it is limited to the number of variables available in the models.

### A Quick Example

Below is an example, where the theoretical backing of such a model is not very stable, but it is useful to show how to use the function and the output.

``````#> Loading MarginalMediation
#> ✔ MarginalMediation attached
#> ✔ No potential conflicts found
``````

The print method provides:

1. the individual regression results,
2. the `a` paths,
3. the `b` paths,
4. the indirect effect with the confidence interval, and
5. the direct effect with the confidence interval.

The regressions are in their original (non-AME) units while the indirect and direct effects are in the AME units—the units of the outcome—in this case, risk of using marijuana.

### Conclusions

Let me know if you find any bugs or want to discuss the method ([email protected]).

# Version 0.7.0

• Can now handle `betareg::betareg()` models.

# Version 0.6.7

• Added ability to handle interactions in the models (using AMEs to average out the effect)
• Fixed various errors in the README and Vignette

# Version 0.5.1 (Initial CRAN Release)

This is the initial release. The main function is `mma()`, which performs the marginal mediation analysis. Other functions are mainly helper functions in interpreting and pulling information out of a `mma` object.

This is beta software, so please report any issues!

# Reference manual

install.packages("MarginalMediation")

0.7.0 by Tyson S Barrett, 2 years ago

Browse source code at https://github.com/cran/MarginalMediation

Authors: Tyson S Barrett [aut, cre] , Angelo Canty [ctb] (S original bootstrap method , http://statwww.epfl.ch/davison/BMA/library.html) , Brian D. Ripley [ctb] (R port , bootstrap method) , Thomas Leeper [ctb] (Vectorized marginal effects , https://thomasleeper.com/software.html)

Documentation:   PDF Manual