Description Usage Arguments Value Examples
fit_to_dt() is a function that converts the results of a linear model with one continuous regressor of interest (e.g. first_mo) that is interacted with factor variable (e.g. risk_cut) to a data.table with easily manipulable columns of interaction labels. This is useful for plotting the results of the elasticty by risk models.
1 |
fit |
the linear fit (usually lm, lm_robust, or iv_robust). The fit must be specified to estimate the coefficient on the continuous variable for all levels of interactions (e.g. atc4_C10AA ~ first_mo:factor(pred_cut) + factor(pred_cut)) |
primary |
character, the vaiable name of the continuous regressor of interest (usually first_mo) |
interacts |
character vector, names of the interaction variables (factors) |
data.table with the estiated coefficients of the primary variable for each interction combination (along with SEs and CIs).
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.