| detrend | R Documentation |
Adjust outcomes for differential trends
detrend(sdid, df)
sdid |
sdid object containing the model to summarize. |
df |
A data frame containing the variables in the model. |
data.frame
# First fit a model using the original outcome, with or without covariate adjustments.
sdid_hosp <- sdid(hospitalized ~ cohort + yr + age + sex + comorb,
df = hosp,
intervention_var = "intervention_yr")
# Calculate de-trending adjustments
hosp_det <- detrend(sdid = sdid_hosp,
df = hosp)
# Then refit the same model, substituting the _detrended version of the outcome
sdid_hosp_det <- sdid(hospitalized_detrended ~ cohort + yr + age + sex + comorb,
df = hosp_det,
intervention_var = "intervention_yr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.