View source: R/calculate_pvc.R
| stepwise_pcv | R Documentation |
Estimates the proportional change in variance (PCV) sequentially by fitting intermediate (partially-adjusted) models. It adds each predictor variable one-by-one to gauge its unique contribution in explaining between-stratum inequalities.
stepwise_pcv(data, outcome, vars, engine = "lme4", family = "gaussian")
data |
Data frame with observations. Ensure 'make_strata()' was run first so the 'stratum' variable exists. |
outcome |
Character string; the dependent variable. |
vars |
Character vector; predictors (strata groupings & covariates) to add sequentially to the model. |
engine |
Modeling engine ("lme4" or "brms"). Default is "lme4". |
family |
Error distribution and link function. Default is "gaussian". |
A data.frame showing the sequential models, the between-stratum variance at each step, and both the step-specific and total PCV.
strata_result <- make_strata(maihda_sim_data, c("gender", "race"))
stepwise_pcv(strata_result$data, "health_outcome", c("gender", "race", "age"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.