indirect_pathwise: Indirect Effects via Single Mediation Paths

View source: R/contrast.R

indirect_pathwiseR Documentation

Indirect Effects via Single Mediation Paths

Description

Indirect Effects via Single Mediation Paths

Usage

indirect_pathwise(model, exper = NULL, t1 = 1, t2 = 2, progress = TRUE)

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)

# 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)

multimedia documentation built on Sept. 30, 2024, 9:28 a.m.