View source: R/model_next_step.R
what_trans | R Documentation |
run models with additional (transformed) variables from the data
what_trans( model = NULL, trans_df = NULL, variable = NULL, data = NULL, r2_diff = TRUE, verbose = FALSE )
model |
Model object |
trans_df |
|
variable |
string or character vector of variable names contained in raw_data |
data |
|
r2_diff |
A boolean to determine whether to add a column to compare new and original model R2 |
verbose |
A boolean to specify whether to print warnings |
Run a separate model for each combination of transformations specified. Then, for each model run, return that model's fit and the variables' statistics.
data.frame
mapping variables' transformations to the respective model's statistics.
model = run_model(data = mtcars,dv = 'mpg',ivs = c('disp','cyl')) trans_df = data.frame( name = c('diminish', 'decay', 'lag', 'ma', 'log', 'hill', 'sin', 'exp'), ts = c(FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE), func = c('linea::diminish(x,a)', 'linea::decay(x,a)', 'linea::lag(x,a)', 'linea::ma(x,a)', 'log(x,a)', "linea::hill_function(x,a,b,c)", 'sin(x*a)', '(x^a)'),order = 1:8) %>% dplyr::mutate(val = '') %>% dplyr::mutate(val = dplyr::if_else(condition = name == 'hill', '(1,5,50),(1 ,5,50),(1,5,50)', val)) variable = 'cyl' model %>% what_trans(variable = variable,trans_df = trans_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.