View source: R/treatment_profile.R
setup_profile | R Documentation |
treatment_profile
objectFor general mediation analysis, we need to provide counterfactuals for both
the outcome and mediator components of each sample. That is, we need to
understand Y(t, M(t')) where t and t' may not be the same.
treatment_profile
classes place some more structural requirements on
treatment profiles, so that later effect estimation can make simplifying
assumptions. This function creates a treatment profile from a collection of
possible mediator and outcome treatments.
setup_profile(x, t_mediator = NULL, t_outcome = NULL)
x |
An object of class |
t_mediator |
A data.frame whose columns store treatment names and whose
values are the treatment assignments to each sample (row). Defaults to
NULL, in which case this type of data.frame is constructed from the
treatment assignments in the |
t_outcome |
A data.frame analogous to |
An object of class treatment_profile
giving treatment assignments
for both mediation and outcome terms.
check_profile
exper <- demo_spline(tau = c(2, 1)) |>
mediation_data(starts_with("outcome"), "treatment", "mediator")
fit <- multimedia(exper) |>
estimate(exper)
t1 <- data.frame(treatment = factor(rep(c(0, 1), each = 5)))
profile <- setup_profile(fit, t_mediator = t1, t_outcome = t1)
profile
t2 <- data.frame(treatment = factor(rep(0, 10)))
profile <- setup_profile(fit, t_mediator = t1, t_outcome = t2)
profile
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.