| compare_fits | R Documentation |
Overlays the NDE/NIE/TE curves from two robmedfit objects on the same
panel. Useful for sensitivity comparisons (e.g. different spline degrees,
trimming thresholds, or model specifications).
compare_fits(
fit1,
fit2,
label1 = "Model 1",
label2 = "Model 2",
estimands = c("NDE", "NIE")
)
fit1 |
First |
fit2 |
Second |
label1 |
Label for |
label2 |
Label for |
estimands |
Estimands to display. Default |
A ggplot2 object.
fit_a <- 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, spline_df = 3, R = 50
)
fit_b <- 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, spline_df = 6, R = 50
)
compare_fits(fit_a, fit_b, label1 = "df=3", label2 = "df=6")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.