Skip to contents

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.

Usage

estimate(model, exper)

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.

Value

A version of the input modified in place so that the @estimates slot has been filled.

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().