robyn_crossmmm | R Documentation |
Given a list of recreated Robyn models, this function optimizes budget allocation across MMMs with respective constraints by maximizing incremental revenue/conversions. This method assumes each model is independent and can be compared given its spends were cleanly and properly split.
robyn_crossmmm(
models,
initial_budgets = NULL,
start_dates = NULL,
end_dates = NULL,
budget_constr_low = 0.5,
budget_constr_up = 1.5,
channel_constr_low = budget_constr_low,
channel_constr_up = budget_constr_up,
cores = NULL,
quiet = FALSE,
...
)
## S3 method for class 'robyn_crossmmm'
print(x, ...)
models |
Lists. Recreated Robyn models with |
initial_budgets |
Numeric vector. Default will use the total spends
per model for the specified or total date range.
Must be length 1 or same as |
start_dates , end_dates |
Character vector. Start and end dates for each
specific model. You can specify a single date and will be used in all models.
Default empty value will assume you want all available data and date range.
Must be length 1 or same as |
budget_constr_low , budget_constr_up |
Numeric vector. Relative minimum
and maximum budgets to consider based on |
channel_constr_low , channel_constr_up |
Numeric vector. Relative minimum
and maximum budgets to consider per channel.
By default it'll consider 50
Must be length 1 or same as |
cores |
Integer. How many cores to use for parallel computations? Set to 1 to not use this option. Default will the minimum between 10 cores and all available cores - 1. |
quiet |
Boolean. Keep quiet? If not, informative messages will be printed. |
... |
Additional parameters to be passed to internal functions. |
x |
Object to print: robyn_crossmmm() output. |
Invisible vector with results by letter.
# You must have Robyn installed and some models stored as JSON files
## Not run:
# Import and recreate the models
files <- c("BrandA.json", "BrandB.json", "BrandC.json", "BrandN.json")
models <- lapply(files, function(x) Robyn::robyn_recreate(x))
names(models) <- gsub("\\.json", "", files)
# Calculate cross-brand optimal allocation
res <- robyn_crossmmm(
models,
cores = 10,
start_dates = "2023-01-01",
end_dates = "2023-12-01"
)
print(res)
res$summary
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.