| run_model | R Documentation |
Run a linear regression model
run_model( data = NULL, dv = NULL, ivs = NULL, trans_df = NULL, id_var = NULL, pool_var = NULL, model_table = NULL, verbose = FALSE, normalise_by_pool = FALSE, save_all_raw_data = TRUE, decompose = TRUE, tail_window = NULL, categories = NULL )
data |
|
dv |
string of the dependent variable name |
ivs |
character vector of the independent variables names |
trans_df |
|
id_var |
string of id variable name (e.g. date) |
pool_var |
string specifying the pool variable name (e.g. 'country') |
model_table |
|
verbose |
A boolean to specify whether to print warnings |
normalise_by_pool |
A boolean to specify whether to apply the normalisation |
save_all_raw_data |
A boolean to specify whether to save whole input data to the model object |
decompose |
A boolean to specify whether to generate the model decomposition |
tail_window |
for time series, length of tail in decomposition |
categories |
|
Run a linear regression model that captures the transformations applied in the model_table and the normalisation based on the pool_var.
A model can be run also by only supplying a dependent variable name dv, a vector of independent variable names dependent variable ivs, and the data that contains these.
Model object
trans_df = data.frame(
name = c('diminish', 'decay', 'hill', 'exp'),
func = c(
'linea::diminish(x,a)',
'linea::decay(x,a)',
"linea::hill_function(x,a,b,c)",
'(x^a)'
),
order = 1:4
)
data = read_xcsv("https://raw.githubusercontent.com/paladinic/data/main/ecomm_data.csv")
dv = 'ecommerce'
ivs = c('christmas','black.friday')
run_model(data = data,
dv = dv,
ivs = ivs,
trans_df = trans_df)
run_model(data = mtcars,dv = 'mpg',ivs = c('disp','cyl'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.