estimate
provides a unified interface to estimate all the models that can
be encapsulated within a multimedia
class. It simply calls the
multimedia object. The resulting estimates can be used for downstream direct
effect estimation.
Examples
exper <- demo_joy() |>
mediation_data("PHQ", "treatment", starts_with("ASV"))
multimedia(exper) |>
estimate(exper)
#> [Multimedia Analysis]
#> Treatments: treatment
#> Outcomes: PHQ
#> Mediators: ASV1, ASV2, ...
#>
#> [Models]
#> mediation: A fitted lm_model().
#> outcome: A fitted lm_model().
# example with another dataset
exper <- demo_spline(tau = c(2, 1)) |>
mediation_data(starts_with("outcome"), "treatment", "mediator")
multimedia(exper) |>
estimate(exper)
#> [Multimedia Analysis]
#> Treatments: treatment
#> Outcomes: outcome_1, outcome_2
#> Mediators: mediator
#>
#> [Models]
#> mediation: A fitted lm_model().
#> outcome: A fitted lm_model().
# example with another model
exper <- demo_spline(tau = c(2, 1)) |>
mediation_data(starts_with("outcome"), "treatment", "mediator")
multimedia(exper, glmnet_model()) |>
estimate(exper)
#> [Multimedia Analysis]
#> Treatments: treatment
#> Outcomes: outcome_1, outcome_2
#> Mediators: mediator
#>
#> [Models]
#> mediation: A fitted lm_model().
#> outcome: A fitted glmnet_model().