nullify | R Documentation |
For inference, we often want to work with synthetic negative controls. One
way to define them is to specify submodels of the full mediation analysis
model. This function defines submodels by removing estimated edges according
to a prespecified vector of IDs. For example, setting nulls = "T -> Y" will
remove any direct effect when sampling or obtaining predictions for the full
mediation analysis model hat{Y}
.
nullify(multimedia, nulls = NULL)
multimedia |
A fitted object of class multimedia with estimates along all paths in the mediation analysis DAG. |
nulls |
A string specifying the indices of edges to ignore. "T->Y", "T->M", and "M->Y" will match all edges between treatment to outcome, treatment to mediator, etc. Otherwise, the vector of indices specifying which edges to ignore. |
multimedia A version of the input multimedia model with all edges
matching nulls
removed. Enables sampling of synthetic null controls.
# example with null data
exper <- demo_joy() |>
mediation_data("PHQ", "treatment", starts_with("ASV"))
fit <- multimedia(exper) |>
estimate(exper)
nullify(fit, "T->M") |>
estimate(exper) |>
indirect_overall()
nullify(fit, "T->Y") |>
estimate(exper) |>
direct_effect()
# example with another dataset
exper <- demo_spline(tau = c(2, 1)) |>
mediation_data(starts_with("outcome"), "treatment", "mediator")
fit <- multimedia(exper) |>
estimate(exper)
nullify(fit, "T->M") |>
estimate(exper) |>
indirect_overall()
nullify(fit, "T->Y") |>
estimate(exper) |>
direct_effect()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.