| .predict_effects | R Documentation |
Implements the g-computation identification formula for the NDE and NIE:
NDE(x, x^*) = E[Y(x, M(x^*))] - E[Y(x^*, M(x^*))]
NIE(x, x^*) = E[Y(x, M(x))] - E[Y(x, M(x^*))]
The mediator is predicted at the individual level (not as a scalar mean), correctly marginalising over each person's covariate values.
.predict_effects(models, data, x, x_ref, treat_var, med_var, out_var)
models |
List with elements |
data |
Original data frame. |
x |
Dose value (the "treated" level). |
x_ref |
Reference dose (counterfactual baseline). |
treat_var |
Character. Name of treatment variable. |
med_var |
Character. Name of mediator variable. |
out_var |
Character. Name of outcome variable. |
Named numeric vector: NDE, NIE, TE.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.