View source: R/detrend_factor.R
| detrend_factor | R Documentation |
Calculate aggregated variance to provide denominator for trend-adjusting outcomes
detrend_factor(sdid, df)
sdid |
sdid object containing the model to summarize. |
df |
A data frame containing the variables in the model. |
numeric
# 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")
# Retrieve an estimate for the pre-intervention period
raw_pre_intervention_trend <-
ave_coeff(sdid = sdid_hosp,
coefs = select_period(sdid = sdid_hosp, period = "pre"))[["est"]]
# Normalize the pre-intervention estimate by de-trending factor
beta_detrend <-
raw_pre_intervention_trend /
detrend_factor(sdid = sdid_hosp,
df = hosp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.