View source: R/coef_to_table.R
coef_to_table | R Documentation |
Returns a table of coefficients, filtered by minimum absolute value and optionally separating into interactions and decomposing dummy variables into parent variable and factor level parts.
coef_to_table(fit, var_names = NULL, ..., min_coef = 1e-10)
fit |
A fitted model with coefficients (e.g. from glmnet). |
var_names |
(optional) A character vector of column names for the data used in |
... |
Parameters passed to |
min_coef |
Coefficients with smaller absolute value than this are excluded from the table. |
Only coefficients with absolute value greater than min_coef
are included. If var_names
is
supplied then extra columns will be added which split the name
into component parts. Where
there are interactions, these are separated, and any dummy variables are split into their
original variable and factor level names. See "Value" below for more details.
This was designed for glmnet models, but it also often works with other glm-type models.
A tibble which will always contain name
and coef
columns. If var_names
is supplied
then there will be extra columns also. If there are no interactions then there will be two
extra columns var
and level
which are extracted from name
. If there are interactions,
there will instead be three columns for each interaction: interact_dd
, var_dd
, and
level_dd
, where each "dd" gives the number of the interaction. The number of interactions
displayed depends on which coefficients are included in the returned table, not the original
model, so min_coef
can change the number of output columns.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.