Skip to content

Negative Mean CarryOver #706

@MarianaAlvarez1316

Description

@MarianaAlvarez1316

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:

image

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


robyn_object <- "~/Desktop/MyRobyn.RDS"

###################################################################################################################

InputCollect <- robyn_inputs(
  dt_input = base_final,
  dt_holidays = dt_prophet_holidays,
  date_var = "DATE", # date format must be "2020-01-01"
  dep_var = "REVENUE", # there should be only one dependent variable
  dep_var_type = "revenue", # "revenue" (ROI) or "conversion" (CPA)
  #Modulos en los que queremos que Prophet nos descomponga la serie
  prophet_vars = c("trend", "season", "holiday"), # "trend","season", "weekday" & "holiday"
  prophet_country = "MX", # input one country. dt_prophet_holidays includes 59 countries by default
  context_vars = c("CONTEXT_1",'CONTEXT_2','CONTEXT_3','CONTEXT_4','CONTEXT_5','CONTEXT_6'
                   ,'CONTEXT_7'), # e.g. competitors, discount, unemployment etc
  paid_media_spends = c("PAID_1_S","PAID_2_S","PAID_3_S","PAID_4_S"),  # mandatory input
  #OJO, cambiaste el siguiente renglón
  paid_media_vars = c("PAID_1_I","PAID_2_I","PAID_3_I","PAID_4_I"),  # mandatory.
  # paid_media_vars must have same order as paid_media_spends. Use media exposure metrics like
  # impressions, GRP etc. If not applicable, use spend instead.
  #organic_vars = "newsletter", # marketing activity without media spend
  factor_vars = c("CONTEXT_1"), # force variables in context_vars or organic_vars to be categorical
  window_start = "2018-12-31",
  window_end = "2023-01-23",
  adstock = "weibull_pdf" # geometric, weibull_cdf or weibull_pdf.
)
print(InputCollect)


###########################################################################################################

hyperparameters <- list(
  ######### PAID_1 ###########
  PAID_1_S_alphas = c(0.7, 1)
  ,PAID_1_S_gammas = c(0.3, 1)
  # ADSTOCK
  ,PAID_1_S_scales = c(0.00441,0.023)
  ,PAID_1_S_shapes = c(2.0001, 10)
  
  ######### PAID_2 ############
  ,PAID_2_S_alphas = c(1, 1.3)
  ,PAID_2_S_gammas = c(0.3, 1)
  # ADSTOCK
  ,PAID_2_S_scales = c(0.00018,0.001)
  ,PAID_2_S_shapes = c(2.0001, 10)
  
  ######### PAID_3 ###########
  ,PAID_3_S_alphas = c(1, 1.6)
  ,PAID_3_S_gammas = c(0.3, 1)
  # ADSTOCK
  ,PAID_3_S_scales = c(0.00018,0.001)
  ,PAID_3_S_shapes = c(2.0001, 10)
  
  ######### PAID_4 ###########
  ,PAID_4_S_alphas = c(0.6, 1)
  ,PAID_4_S_gammas = c(0.3, 1)
  # ADSTOCK
  ,PAID_4_S_scales = c(0.00441,0.02509)
  ,PAID_4_S_shapes = c(2.0001, 10)
  
  
  #,train_size = c(0.7, 0.8)

)


###################################################################################################################

InputCollect <- robyn_inputs(InputCollect = InputCollect, hyperparameters = hyperparameters)
print(InputCollect)

###################################################################################################################

OutputModels <- robyn_run(
  InputCollect = InputCollect, # feed in all model specification
  cores = NULL, # NULL defaults to max available - 1
  iterations = 7000, # 2000 recommended for the dummy dataset with no calibration
  trials = 10, # 5 recommended for the dummy dataset
  #Nuevo feature
  ts_validation = FALSE, # 3-way-split time series for NRMSE validation.
  add_penalty_factor = FALSE, # Experimental feature. Use with caution.
  #outputs = FALSE # outputs = FALSE disables direct model output - robyn_outputs()
)
print(OutputModels)

####################################################################################################################

## Calculate Pareto optimality, cluster and export results and plots. See ?robyn_outputs
OutputCollect <- robyn_outputs(
  InputCollect, OutputModels,
  pareto_fronts = "auto", # automatically pick how many pareto-fronts to fill min_candidates
  # min_candidates = 100, # top pareto models for clustering. Default to 100
  # calibration_constraint = 0.1, # range c(0.01, 0.1) & default at 0.1
  csv_out = "pareto", # "pareto", "all", or NULL (for none)
  clusters = TRUE, # Set to TRUE to cluster similar models by ROAS. See ?robyn_clusters
  plot_pareto = FALSE, # Set to FALSE to deactivate plotting and saving model one-pagers
  plot_folder = robyn_object, # path for plots export
  export = TRUE # this will create files locally
)
print(OutputCollect)

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() or R.version$version.string)
    image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions