ggmediation | R Documentation |
Plot ACME and ADE from objects produced by mediate function in mediation package
ggmediation(obj)
obj |
An object produced by the mediate function from the mediation package. |
Produces a ggplot version of the mediation plot from the mediation package.
A ggplot
## Not run:
if(interactive()){
library(mediation)
m_med <- lm(hp ~ wt, mtcars)
m_out <- lm(mpg ~ hp + wt, mtcars)
m <- mediate(m_med, m_out, treat='wt', mediator='hp')
ggmediation(m)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.