Skip to content

Commit

Permalink
fix: revert initial response calculation for lagged adstock in allocator
Browse files Browse the repository at this point in the history
Current allocator initial response calculation tries to account for only immediate response, which causes unmatched initial response on the saturation curve. Revert back to using total initial spend and thus full initial response, which means the allocator simulates the peak response in lagged adstock.
  • Loading branch information
gufengzhou committed Oct 27, 2023
1 parent 353a5b3 commit 331b096
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion R/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: Robyn
Type: Package
Title: Semi-Automated Marketing Mix Modeling (MMM) from Meta Marketing Science
Version: 3.10.5.9001
Version: 3.10.5.9002
Authors@R: c(
person("Gufeng", "Zhou", , "gufeng@meta.com", c("cre","aut")),
person("Leonel", "Sentana", , "leonelsentana@meta.com", c("aut")),
Expand Down
11 changes: 6 additions & 5 deletions R/R/allocator.R
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,12 @@ robyn_allocator <- function(robyn_object = NULL,
names(hist_carryover_temp) <- resp$date[ndates_loc]
hist_carryover[[i]] <- hist_carryover_temp
# get simulated response
if (resp$input_immediate[1] == initSpendUnit[i]) {
x_input <- initSpendUnit[i]
} else {
x_input <- mean(resp$input_immediate)
}
# if (resp$input_immediate[1] == initSpendUnit[i]) {
# x_input <- initSpendUnit[i]
# } else {
# x_input <- mean(resp$input_immediate)
# }
x_input <- initSpendUnit[i]
resp_simulate <- fx_objective(
x = x_input,
coeff = coefs_sorted[[mediaSpendSorted[i]]],
Expand Down

0 comments on commit 331b096

Please sign in to comment.