facebookexperimental / facebookexperimental/Robyn

context_var_ref Parameter Not Functional and Baseline Interpretation Gap

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

Description

**Problem Description:**

I am trying to model binary factor variables (prime_promo, BFCM_promo) and facing a major challenge in interpreting the decomposition results due to the hidden nature of the baseline effect (the "non-promo" state).
I attempted to use the `context_var_ref` parameter, which appears to be designed for this exact purpose, but found it has no impact on the model output.

**Input Code:**
```
InputCollect <- robyn_inputs(
dt_input = data,
dt_holidays = dt_prophet_holidays,
date_var = "date",
dep_var = "Amazon_revenue",
dep_var_type = "revenue",
prophet_vars = c("trend", "season","holiday"),
prophet_country = "US",
context_vars = c("prime_promo","BFCM_promo"),
context_var_ref = list(
prime_promo = 0, # Use 0 as baseline - for non promo
BFCM_promo = 0),
paid_media_spends = c("amazon_daily_spend","amazon_dsp_spend"),
paid_media_vars = c("amazon_daily_spend","amazon_dsp_spend"),
organic_vars = c("Shopify_spends"),
factor_vars = c( "prime_promo","BFCM_promo"),
window_start = min(data$date),
window_end = max(data$date),
adstock = "weibull_pdf"
)
```

**Observation:**

1. **Interpretation Gap**( Reversed contribution) : For the binary variable `BFCM_promo` (0 = No Promo, 1 = Promo), the decomposition is inverted — it shows contribution on non-promo days (0) and zero contribution on promo days (1) but` prime_promo` is giving correct results.

Image

2. **Functional Failure**: Running the model with `context_var_ref = list(prime_promo = 0,BFCM_promo = 0) `yields the exact same pareto_decomp_matrix as running the model without the `context_var_ref` argument entirely.

3. **Missing documentation** : The context_var_ref parameter is not present in the official robyn documentation.

**Requested Action:**

1. I am trying to model binary factors (prime_promo, BFCM_promo) but the decomposition for `BFCM_promo `shows reversed contributions and no effect from` context_var_ref`.

2. Can someone please confirm whether the `context_var_ref` parameter is currently functional or still under development?

3. Guidance or documentation on correctly setting the baseline for binary context variables would be very helpful.

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.