-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Negative Mean CarryOver #706
Comments
After digging into the issue, I can confirm that it's not a bug. This happens only when using weibull_pdf and the shape > 1, meaning the peak is lagged. Look at this plot, we can clearly see the lag effect: there're days where the adstocked spend < raw spend. Because the carryover spend = adstocked spend - raw spend, therefore the carryover might end up negative for these days. I agree that it's very unintuitive. But the math is right. I don't see the necessity to change it now. Or are you running into problems with this? |
Hi Gufeng! Thanks for the reply, we do see the lag. The only thing that we still don´t understand is why the mean carryover is negative. From your graph we can see that at certain points the carryover spend will be negative, and if we run the Robyn Response function
in the |
Hi, I've just pushed a commit to return the partial immediate & carryover effect for lagged adstock (weibull_pdf). Can you please update and check? There should be no negative value any more. |
Yes, that's fine. That updates Robyn to latest dev version. Did you refresh your R session so that you load the latest updated version before retrying? |
- weibull_pdf creates lagged peak and thus negative carryover, because the previous carryover = total - raw, and with lagged peaks, total adstocked spend might be lower than raw spend. The new calculation doesn't take raw spend as immediate anymore, but derives immediate from the actual lagged decay matrix. This restores the relationship of total = carryover + immediate with all positive values. - This is the 3rd code snippets change (robyn_response) that impacts the csv output. Other other two in transformation.R and allocator.R were fixed previously. Will look into funtionalizing the 3 places.
second try to fix the negative value. please update and let us know |
Hi Gufeng! You made it, we don´t see the negative mean carryover anymore :) We just have a couple of questions with this change
Thanks a lot, really!! |
I can't reproduce this issue. I'd need your dataset and your script for debugging. Before, we were doing carryover_spend = adstocked_spend - immediate_spend, while immediate_spend == raw_spend. This is true when there's no lag in adstocking. So geometric & weibull_cdf won't have this issue. But with weibull_pdf shape >2, which introduces lags into adstocking, adstocked_spend could be < raw_spend, which causes this negative carryover issue. The last change was to not doing immediate_spend == raw_spend for weibull_pdf, but actually calculate the immediate part, which actually worked out. So I'm bit surprised that this still happens. Probably edge cases. |
Project Robyn
Describe issue
Hi!
I was checking my resulting models and noticed that the mean_carryover for channel PAID_4 is negative for all the model solutions available in the pareto_aggregated CSV. Below you can see an example I took from one model:
For a specific model I tried to replicate the mean_carryover using the Robyn_Response function, but I failed.
I think it is a bug in the code, could you please help me?
Thanks in advanced :)
Provide reproducible example
Here is an example date set and how I ran the code
DATA_BUG_GITHUB.csv
Environment & Robyn version
Make sure you're using the latest Robyn version before you post an issue.
Check and share Robyn version:
packageVersion("Robyn")
I´m using version ‘3.10.3.9000’
R version (Please, check and share:
sessionInfo()
orR.version$version.string
)The text was updated successfully, but these errors were encountered: