facebookexperimental / facebookexperimental/Robyn

Robyn Budget Allocator max_budget scenario should scale x_hist_carryover for accurate response simulation

Open
#1,014 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.5k
Forks
433
PR merge metrics
No merged PRs in 30d

Description

## Project Robyn

## Describe issue
Simulated Adstock effect is wrongly calculated in max_budget scenario. The Adstock effect is not changed to reflect this budget change when simulated with a different budget. If I understand the code correctly.

The function [`objective.channel` in `eval_f`](https://github.com/facebookexperimental/Robyn/blob/main/R/R/allocator.R#L883-L891), which [calls `fx_objective.chanel`](https://github.com/facebookexperimental/Robyn/blob/main/R/R/allocator.R#L937-L953) calculates Adstock with: `xAdstocked <- x + mean(x_hist_carryover)`.
is used to calculate the response:
```R
optmResponseUnit <- -eval_f(optmSpendUnit)[["objective.channel"]]
```
https://github.com/facebookexperimental/Robyn/blob/main/R/R/allocator.R#L516

Due to using the mean, the number of weeks simulated does not matter. However, if the budget gets very small, the mean(x_hist_carryover)` part is much bigger than `x`, meaning the whole simulated response is dominated by historical carryover at a different budget level.

## Possible solution
Get the ratio: "mean historical spend" / "weekly budget" and multiply with the Adstock effect to scale the effect.
However, I'm not sure if this is accurate. It might be that the Adstock effect is different at different spend levels though.

## Environment & Robyn version
- Robyn version: 3.11.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.