Disclosure: I work at Carrefour. The views expressed on this article are my very own. The info and examples offered are printed with my employer’s permission and don’t comprise any confidential data.
A retailer’s assortment is an entire and diverse vary of merchandise offered to prospects. It’s topic to evolve primarily based on varied components resembling: financial situations, shopper tendencies, profitability, high quality or compliance points, renewal of some product ranges, inventory ranges, seasonal adjustments, and so on.
When a product is now not obtainable on the shop cabinets, a few of its gross sales could shift to different merchandise. For a serious meals retailer like Carrefour, it’s essential to estimate this gross sales shift precisely to handle the danger of loss as a result of product unavailability and approximate the loss as a result of it.
This measurement serves as an indicator of the implications of the unavailability of a product. Moreover, it regularly builds a beneficial historical past of gross sales shift affect estimates.
But, estimating gross sales shifts is complicated. Buyer habits — influenced by hard-to-predict emotional components — seasonality of sure merchandise, or introduction of recent merchandise can all have an effect on gross sales shifts. As well as, many merchandise turn out to be unavailable throughout all shops concurrently, making it not possible to ascertain a management inhabitants.
The Causal Impression artificial management strategy, developed by a Google staff, matches the particularities of our evaluation framework. It permits us to isolate the impact of product unavailability on gross sales from influencing components, and is appropriate for each quasi-experimental and observational research. Based mostly on Bayesian structural time-series fashions, Causal Impression performs a counterfactual evaluation, calculating the impact on gross sales because the distinction between the gross sales noticed after a product turns into unavailable and, by an artificial management, the gross sales that might have been noticed had the product remained obtainable.
This text presents our Causal Impression strategy for estimating the gross sales shift impact following product unavailability, in addition to a heuristic for choosing management group time collection.
Because of confidentiality issues, the quantitative values on the graphs have been redacted. Word that every block represents one month alongside the x-axis, and the y-axis represents a variable amount, which may be fairly massive.
I) Specifying the Use Case
Product unavailability happens in two principal kinds:
- Full unavailability: the product is now not obtainable within the nationwide assortment, affecting all shops.
- Partial unavailability: the product is now not obtainable from some — however not all — shops. It stays obtainable in others.
We take into account {that a} dependable gross sales shift affect estimate ought to precisely assess each misplaced gross sales and portion of gross sales transferred to different merchandise. But, understanding the precise worth of those portions is not possible, making this problem complicated.
Our examine analyzes circumstances of full product unavailability as these circumstances are probably the most vital by way of gross sales affect.
Please additionally notice that causal inference is just not a predictive framework for future occasions: it identifies causal hyperlinks up to now somewhat than forecasting future occasions.
II) Why did we select Google’s Causal Impression mannequin?
Causal approaches goal to grasp causal relationships between variables, explaining how one impacts one other by isolating the impact we are attempting to investigate from all different current results.
Amongst these instruments, Causal Impression is a user-friendly library, and it operates inside a completely Bayesian framework, permitting prior data integration whereas offering inherent credibility intervals in its outcomes. Its predictions characterize anticipated outcomes had the intervention not occurred, expressed as distribution capabilities somewhat than single values.
Causal Impression generates predictions by combining endogenous parts, resembling seasonality and native degree, with user-chosen exterior time collection (covariates). These covariates should be unaffected by the intervention and may seize tendencies or components that might affect the primary time collection. We’ll focus on covariate choice later.
Fig. 1: A simplified instance of Causal Impression in motion. The highest graph reveals two time collection: the orange line represents precise noticed knowledge, whereas the blue line is the mannequin’s prediction, created utilizing covariates and endogenous parts. Every block represents a month. This prediction estimates what would have occurred if the occasion of curiosity (marked by the vertical dashed line) had not occurred. The blue shaded space signifies the prediction’s uncertainty. The second graph shows the point-by-point distinction between the prediction and the noticed knowledge, and the underside graph reveals the cumulative affect.
III) Managing Outliers and Anomalies in knowledge
To make sure correct evaluation, we addressed gross sales knowledge anomalies by following two key steps:
- We excluded time collection with destructive gross sales or a lot of zero gross sales from the evaluation.
- For time collection with occasional zero gross sales, we changed these values with the common of the previous and following weeks’ gross sales.
IV) Mannequin Design
The selection of covariates considerably influences counterfactual prediction accuracy. These time collection should seize tendencies or exterior components more likely to affect the goal time collection with out being affected by the intervention.
As well as, it’s essential to contemplate the scale of the estimated gross sales shift impact relative to the time collection being studied: if the intervention is predicted to have an effect on the goal collection by only some p.c, the collection will not be applicable, as small results are troublesome to differentiate from random noise (particularly because the library designers have proven that results lower than 1% are troublesome to show as being linked to the intervention). Due to this fact, we analyzed gross sales shift solely when the theoretical most gross sales shift fee exceeds 5% of gross sales in its sub-family. We calculated this as S/(1-S), the place S represents the proportion of turnover the product generated in its sub-family earlier than changing into unavailable.
Given these preliminary issues, we designed our Causal Impression mannequin as follows:
Goal
Because the goal time collection, we chosen the sum of gross sales for the product’s sub-family, excluding the product that turned unavailable.
Covariates
We first excluded the next varieties of time collection:
- Merchandise from the identical sub-family because the discontinued product, to stop any affect from its unavailability.
- Merchandise from totally different households than the discontinued product, since covariates ought to stay business-relevant.
- Time collection that confirmed correlation however not co-integration with the goal collection, to keep away from spurious relationships.
Utilizing these filters, we chosen 60 covariates:
- 20 covariates had been chosen primarily based on their highest co-integration with the goal collection in the course of the yr earlier than intervention.
- 40 further covariates had been chosen from the highest 200 co-integrated collection, primarily based on their strongest correlation with the goal collection in the course of the yr earlier than intervention.
Word that these numbers (20, 40, and 60) are guidelines of thumb derived from our earlier mannequin matches.
This empirical strategy combines time collection that seize each long-term tendencies (by co-integration) and short-term variations (by correlation). We intentionally selected a lot of covariates as a result of Causal Impression employs a “spike and slab” methodology, which mechanically reduces the affect of much less vital collection by assigning them near-zero regression coefficients, whereas giving better weight to vital ones.
V) Mannequin Validation
To validate our covariate choice technique, we drew closely on the strategy utilized by the Causal Impression designers. We carried out a examine of partial product unavailability as follows:
- We examined circumstances the place merchandise turned partially unavailable and carried out an preliminary typical statistical evaluation utilizing difference-in-differences.
- We utilized Causal Impression utilizing, as covariates, a management inhabitants that consisted of the product’s sub-family gross sales (excluding the unavailable product) in shops the place the product remained obtainable. These covariates supplied one of the best obtainable counterfactual since these shops had been unaffected by the intervention.
- Lastly, we utilized Causal Impression with out a management inhabitants, as a substitute utilizing our choice course of primarily based on co-integration and correlation as outlined within the Mannequin Design part.
Constant estimates throughout a number of stories (spanning totally different merchandise, portions, and classes) would display that we will reliably apply this strategy on a broader scale.
Moreover we developed two metrics to guage the artificial management’s high quality: a health measure and a predictive functionality measure.
- The health measure, scored between 0 and 1, assesses how nicely the artificial management fashions the goal over the pre-intervention interval.
- The predictive functionality measure is a type of backtesting that evaluates the artificial management’s high quality throughout a simulated false intervention up to now.
A Sensible Validation Instance
To validate the method described above with a sensible instance, we analyzed a case the place a yogurt pack turned unavailable in sure shops. We established remedy and management teams by matching every retailer the place the product turned unavailable with the same retailer that also had the product, primarily based on standards resembling gross sales efficiency, buyer traits, and geographic location.
The theoretical most gross sales shift fee for this product was 9.5%, and our earlier analyses confirmed very excessive gross sales shift charges within the dairy product household. Consequently, we anticipated to acquire an estimate near the theoretical most fee.
Following our three-step validation methodology, we obtained these outcomes:
- The difference-in-differences evaluation estimated the causal impact at 8.7% with 98.7% chance.
- As proven in Determine 2 (beneath), the Causal Impression evaluation utilizing a management inhabitants estimated a causal impact of 9.0%, with a confidence interval of [3.7%, 14.4%] and 99.9% chance. We are able to additionally see that whereas the mannequin successfully tracks the time collection fluctuations, it does present some minor deviations.

Fig. 2: Causal impact estimation for the dairy product model after product unavailability, utilizing a management inhabitants to assemble the artificial management.
As well as, when utilizing covariates chosen primarily based on co-integration and correlation as a substitute of a management inhabitants, the Causal Impression evaluation estimated a causal impact of 8.5%, with a confidence interval of [2.4%, 15.1%] and 99.9% chance as proven in Determine 3 (beneath). Once more, the mannequin successfully tracks the time collection fluctuations, but exhibiting some minor deviations.

Fig. 3: Causal impact estimation for the dairy product model after product unavailability, utilizing proxies (solely knowledge from shops within the remedy inhabitants to represent the artificial management).
Here’s a abstract of the estimates obtained throughout the three totally different evaluation strategies:
Evaluation | Impact estimation | Causal impact chance |
Distinction in Variations | 8.7% | 98.7% (vital) |
Causal Impression with a management inhabitants | 9.0% CI: [3.7%, 14.4%] | 99.9% (vital) |
Causal Impression with out a management inhabitants data | 8.5% CI: [2.4, 15.1%] | 99.1% (vital) |
It reveals that the estimates stay constant in magnitude, whether or not utilizing a management inhabitants or not, thus validating our choice course of for covariates when no management inhabitants is accessible.
VI) Full unavailability: A rice pack now not obtainable
We examined a nationwide case the place a pack of rice model turned unavailable. We restrained our evaluation to the following couple of months after the product turned unavailable to keep away from capturing unrelated results which may emerge over an extended interval. The theoretical most gross sales shift fee for the product was 31.2%. We utilized the covariate choice methodology described earlier to estimate the potential gross sales shift impact.

Fig. 4: Causal impact estimation after the pack of rice model turned unavailable, utilizing proxies (solely knowledge from shops within the remedy inhabitants to represent the artificial management).
As proven in Determine 4, the artificial management fashions the goal very nicely over the interval earlier than the intervention. The prediction precisely captures seasonal tendencies after the intervention. The credibility interval could be very slender across the estimate.
We obtained a statistically vital estimate at 22% enhance in turnover brought on by the product unavailability over the next months, with over 99.9% chance. This amount represents roughly 70% of the pack of rice whole gross sales earlier than the product turned unavailable, implying that 30% of the pack of rice gross sales didn’t shift.
VII) Utilization suggestions and expertise report
Causal Impression is a strong and user-friendly device for causal inferences. But after vital time spent specifying the mannequin and bettering its accuracy, we encountered challenges in fine-tuning it to acquire an industrializable resolution.
- The primary level we need to spotlight is the significance of the “rubbish in, rubbish out” precept, which is especially related when utilizing Causal Impression. Whatever the covariates used, Causal Impression will all the time produce a outcome, typically with very excessive chance, even in circumstances the place outcomes are unrealistic, or not possible.
- Time collection chosen solely primarily based on the co-integration criterion typically overshadow others in mannequin characteristic significance, which may drastically scale back the estimation accuracy when adjustment is just not well-controlled.
- The number of 20 collection for co-integration and 40 for correlation is an empirical rule of thumb. Whereas efficient most often we encountered, it may gain advantage from additional refinement.
Conclusion
On this article we proposed a causal strategy to estimate the gross sales shift impact when a product turns into unavailable, utilizing Causal Impression. We outlined a strategy for choosing analyzable merchandise, and covariates.
Though this strategy is useful and strong most often, it has limitations and areas for enchancment. Some are structural, whereas others require spending extra time on mannequin adjustment.
- We examined the methodology on totally different merchandise with promising outcomes, however it isn’t exhaustive. Some very seasonal merchandise or ones with little historic knowledge pose challenges. Moreover, merchandise that turned unavailable in only some shops are uncommon, limiting our skill to validate the strategy on a lot of numerous circumstances.
- One other structural limitation is the mannequin’s requirement for post-hoc evaluation: the device doesn’t permit gross sales shift impact prediction earlier than a product turns into unavailable. Having the ability to take action would significantly profit enterprise groups. Work is underway to strategy gross sales shift prediction utilizing bayesian structural time collection forecasting.
- The gross sales shift impact evaluation ignores margin impacts: the product that turned unavailable could have the next unit margin than the merchandise to which its gross sales shifted. The business conclusions to be drawn may then differ, however evaluation at a sub-family degree precludes this degree of element.
- Lastly we may discover various artificial controls, resembling Augmented SC, Sturdy SC, Penalized SC, and even different causal approaches such because the two-way fastened impact mannequin.