View source: R/model_next_step.R
what_combo | R Documentation |
run models across combinations of transformations and variables
what_combo( model = NULL, trans_df = NULL, data = NULL, dv = NULL, r2_diff = TRUE, return_model_objects = FALSE, verbose = FALSE )
model |
Model object |
trans_df |
|
data |
|
dv |
string specifying the dependent variable name |
r2_diff |
A boolean to determine whether to add a column to compare new and original model R2 |
return_model_objects |
A boolean to specify whether to return model objects |
verbose |
A boolean to specify whether to print warnings |
Run a separate model for each combination of transformations specified. The combinations are defined by the possible transformation parameters specified in the trans_df. Then, for each model run, return that model's fit and the variables' statistics.
list of two data.frame
mapping variables' transformations to the respective model's statistics.
# using a model object data = read_xcsv("https://raw.githubusercontent.com/paladinic/data/main/ecomm_data.csv") dv = 'ecommerce' ivs = c('christmas','black.friday') trans_df = data.frame( name = c('diminish', 'decay', 'hill', 'exp'), ts = c(FALSE,TRUE,FALSE,FALSE), func = c( 'linea::diminish(x,a)', 'linea::decay(x,a)', "linea::hill_function(x,a,b,c)", '(x^a)' ), order = 1:4 ) %>% dplyr::mutate(offline_media = dplyr::if_else(condition = name == 'hill', '(1,50),(1),(1,100)', '')) %>% dplyr::mutate(offline_media = dplyr::if_else(condition = name == 'decay', '.1,.7 ', offline_media)) %>% dplyr::mutate(promo = '') model = run_model(data = data,dv = dv,ivs = ivs, trans_df = trans_df) combos = what_combo(model = model,trans_df = trans_df) #using the trans_df, data, and dv what_combo(trans_df = trans_df, data = data, dv = dv)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.