Indirect Effects via Single Mediation Paths
Arguments
- model
An object of class multimedia containing the estimated mediation and outcome models whose mediation and outcome predictions we want to compare.
- exper
An object of class multimedia_data containing the mediation and outcome data from which the direct effects are to be estimated.
- t1
The reference level of the treatment to be used when computing the (pathwise) indirect effect.
- t2
The alternative level of the treatment to be used when computing the (pathwise) indirect effect.
- progress
A logical indicating whether to show a progress bar.
Value
A data.frame summarizing the pathwise (per-mediator) indirect effects associated with different settings of the direct effect.
Examples
# example with null data
exper <- demo_joy() |>
mediation_data("PHQ", "treatment", starts_with("ASV"))
fit <- multimedia(exper) |>
estimate(exper)
indirect_pathwise(fit)
#> Indirect effects for direct setting 1
#> Indirect effects for direct setting 2
#> outcome mediator direct_setting contrast indirect_effect
#> 1 PHQ ASV1 Control Control - Treatment -4.833402e-03
#> 2 PHQ ASV2 Control Control - Treatment 4.686034e-02
#> 3 PHQ ASV3 Control Control - Treatment 4.236937e-03
#> 4 PHQ ASV4 Control Control - Treatment -9.571373e-05
#> 5 PHQ ASV5 Control Control - Treatment 1.221456e-03
#> 6 PHQ ASV1 Treatment Control - Treatment -4.833402e-03
#> 7 PHQ ASV2 Treatment Control - Treatment 4.686034e-02
#> 8 PHQ ASV3 Treatment Control - Treatment 4.236937e-03
#> 9 PHQ ASV4 Treatment Control - Treatment -9.571373e-05
#> 10 PHQ ASV5 Treatment Control - Treatment 1.221456e-03
# example with another dataset
exper <- demo_spline(tau = c(2, 1)) |>
mediation_data(starts_with("outcome"), "treatment", "mediator")
fit <- multimedia(exper) |>
estimate(exper)
indirect_pathwise(fit)
#> Indirect effects for direct setting 1
#> Indirect effects for direct setting 2
#> outcome mediator direct_setting contrast indirect_effect
#> 1 outcome_1 mediator 0 0 - 1 -0.02314333
#> 2 outcome_2 mediator 0 0 - 1 0.20036985
#> 3 outcome_1 mediator 1 0 - 1 -0.02314333
#> 4 outcome_2 mediator 1 0 - 1 0.20036985