View source: R/broom_methods.R
| augment.robmedfit | R Documentation |
Returns the original data augmented with IPW weights, fitted mediator values, and fitted outcome values from the pathway models.
## S3 method for class 'robmedfit'
augment(x, data = NULL, ...)
x |
A |
data |
Optional data frame to augment. Defaults to the data stored
in the outcome model's |
... |
Ignored. |
The original data frame with additional columns:
.ipw_weightStabilised inverse probability weights.
.fitted_mediatorPredicted mediator values.
.fitted_outcomePredicted outcome values.
.resid_mediatorResiduals from the mediator model.
.resid_outcomeResiduals from the outcome model.
fit <- robustmediate(
treatment_formula = X ~ Z1 + Z2 + Z3,
mediator_formula = M ~ X + Z1 + Z2 + Z3,
outcome_formula = Y ~ X + M + Z1 + Z2 + Z3,
data = sim_mediation, R = 50
)
aug <- augment(fit)
hist(aug$.ipw_weight)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.