multimedia: 'multimedia' Constructor

multimediaR Documentation

multimedia Constructor

Description

multimedia objects encapsulate the model and data that underlie a mediation analysis, together with metadata (like graph structure) that contextualize the estimation. This function can be used to construct a new multimedia instances from a mediation_data dataset and pair of estimators.

Usage

multimedia(
  mediation_data,
  outcome_estimator = lm_model(),
  mediation_estimator = lm_model()
)

Arguments

mediation_data

An object of class mediation_data, with separate slots for each of the node types in a mediation analysis diagram.

outcome_estimator

An object of class model that will be used to estimate the outcome model.

mediation_estimator

An object of class model that will be used to estimate the mediation model.

Value

An object of class multimedia encapsulating the full mediation model and data.

See Also

multimedia-class

Examples

exper <- demo_joy() |>
    mediation_data("PHQ", "treatment", starts_with("ASV"))
multimedia(exper)

exper <- demo_spline(tau = c(2, 1)) |>
    mediation_data(starts_with("outcome"), "treatment", "mediator")
multimedia(exper)

# real data example with a pretreatment variable
data(mindfulness)
exper <- mediation_data(
    mindfulness,
    phyloseq::taxa_names(mindfulness),
    "treatment",
    starts_with("mediator"),
    "subject"
)
multimedia(exper)

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