exper <- demo_spline(tau = c(2, 1)) |>
mediation_data(starts_with("outcome"), "treatment", "mediator")
fit <- multimedia(exper) |>
estimate(exper)
samples <- sample(fit)
mediators(samples)
outcomes(samples)
# sampling with just different "n" has no effect.
samples <- sample(fit, 100)
# Instead sample at a new treatment configuration
t1 <- data.frame(treatment = factor(rep(c(0, 1), each = 50)))
profile <- setup_profile(fit, t_mediator = t1, t_outcome = t1)
samples <- sample(fit, profile = profile)
mediators(samples)
outcomes(samples)
Run the code above in your browser using DataLab