View source: R/plot_mediation.R
| plot_mediation | R Documentation |
Plots NDE, NIE, and (optionally) total effect as smooth spline curves over the full range of treatment values, with pointwise bootstrap confidence bands. This is the signature visualisation of RobustMediate and is publication-ready out of the box.
plot_mediation(
x,
estimands = c("NDE", "NIE"),
show_total = FALSE,
facet = FALSE,
...
)
x |
A |
estimands |
Character vector of estimands to display.
Any subset of |
show_total |
Shorthand for adding |
facet |
Logical. Split estimands into separate facets? Default |
... |
Ignored. |
A ggplot2 object.
fit <- robustmediate(
treatment_formula = X ~ Z1 + Z2 + Z3,
mediator_formula = M ~ X + Z1 + Z2 + Z3,
outcome_formula = Y ~ X + M + Z1 + Z2 + Z3,
data = sim_mediation, R = 50
)
plot_mediation(fit)
plot_mediation(fit, estimands = c("NDE", "NIE", "TE"), facet = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.