Skip to contents

This averages direct or indirect effects across settings j, leading to the effect estimates given in equation (10) of the preprint.

Usage

effect_summary(effects)

Arguments

effects

The output from direct_effect or indirect_effect. A data.frame containing effect estimates for each variable and indirect/direct setting along rows.

Value

A version of the input with all indirect/direct settings averaged over.

See also

direct_effect indirect_effect

Examples

# example with null data
exper <- demo_joy() |>
    mediation_data("PHQ", "treatment", starts_with("ASV"))
multimedia(exper) |>
    estimate(exper) |>
    direct_effect() |>
    effect_summary()
#> # A tibble: 1 × 2
#>   outcome direct_effect
#>   <chr>           <dbl>
#> 1 PHQ           -0.0389

# example with another dataset
exper <- demo_spline(tau = c(2, 1)) |>
    mediation_data(starts_with("outcome"), "treatment", "mediator")
multimedia(exper) |>
    estimate(exper) |>
    direct_effect() |>
    effect_summary()
#> # A tibble: 2 × 2
#>   outcome   direct_effect
#>   <chr>             <dbl>
#> 1 outcome_1        -1.97 
#> 2 outcome_2        -0.776