Explainer

Correcting the curve

A product whose neighbour has sold out can sell more than its own demand. Two methods try to clean that bulge out of the published trace: a link from the cleanest slice, and exposure extended to zero. WAPE improves both, the symmetric measure takes one back, and the flow itself cannot be measured.

Life-Cycle Curve · 5 / 6

The previous article left a loose end. Today’s method drops the cell’s own empty days, but it cannot drop its neighbour’s: when a product sells out, some of the customers looking for it buy the product next to it (substitutionA customer who cannot find the product they want buying another one instead. The sale stays with the company, so not all unmet demand counts as lost.), and that extra sale is recorded on the receiving product’s in-stock days as an ordinary sale.

The thinking behind the correction is this: every link of the chain carries that extra sale, and because the curve moves forward as the product of the links, the effect can build up week by week. That is an assumption, not a measurement — this case does not measure the build-up as a separate number. What it measures is how far two methods that try to clean out that bulge move the accuracy. This article describes the two methods, their results and the wall both of them hit.

Counting the sibling’s gap

We do not have the substitution flow itself; we have a trace of it. In a cell’s given week, how far were that product’s siblings out of stock?

The product’s own table gives the set of siblings: the other options in the same store, in the same subcategory and the same price segment. The set separates stores too, because substitution happens within a store: a sibling’s gap in another city does not go into this cell’s exposure. The share of stockout days in this set is weighted by each sibling’s in-stock-day rate in the base window — a fast-selling sibling being empty matters more than a slow-selling one. The number that comes out is between 0 and 1, and it is called exposure.

The measured distribution in winter’s record table is this: mean 0.205, median 0.112, tenth percentile 0.000, ninetieth percentile 0.574. In summer the distribution sits lower; its mean is 0.148. So exposure is very unevenly spread: half the rows in winter are below 0.112, while the top tenth are above 0.574.

Rows with no siblings at all come out with zero exposure, because there is no sibling to measure. No unmeasurable row came out at all: in both seasons their share is zero.

Two corrections, two separate ideas

Building the link from the cleanest slice. In this series the first method is called E2a. The record rows are split into four bins by exposure — in winter the upper edge of the lowest bin is 0.000; because equal exposure values stay in the same bin, the bins do not come out with equal row counts, and the report prints the four counts separately — and the link is built only from the matched cell-weeks in the lowest bin. The idea is simple: the chain is cleanest in the slice where the flow is smallest. If the sample falls below the threshold, it drops to today’s method’s fallback levels, so the tiers of the third article are here too.

Extending exposure to zero. The second method is called E2b. This time there is no bin filter: the link is built in each bin separately, then a straight line is fitted through the bin links per group, wave and week and extended to zero exposure. So the question it asks is: “what would the link of a pair with no exposure at all be?” E2a takes the lowest bin and throws away the rest; E2b gathers information from every bin. The limit of the extension lies in its definition: if the flow is not linear in exposure, the extension does not see the bend.

Both build the link as a ratio of totals; no logarithm is taken per cell. That choice has a measured reason, and those numbers are below too.

What was measured

Path 0, winter — WAPE with its symmetric counterpart next to it, because in this series the two are read together: today’s method 0.260 | 0.195, E2a 0.234 | 0.202, E2b 0.234 | 0.182. In summer today’s method 0.169 | 0.148, E2a 0.165 | 0.154, E2b 0.143 | 0.132.

That this is not the luck of a single draw is shown by WAPE’s medians across paths: the report prints the five paths and their median separately, and in that median too both corrections, in both seasons, stay below today’s method.

The bias in the markdown period improves as well, and here the direction does not change with the season. In the median across paths, today’s method’s 1.442 in winter becomes 1.136 under E2a and 1.212 under E2b; in summer its 1.081 becomes 0.940 and 1.042. In all four of the four measurements the arm moves closer to 1. E2a crosses below 1 in summer, that is, it turns from over-forecasting to under-forecasting.

No winner comes out of this, and that is the report’s own rule: the two columns are read together, and no ranking of arms is built on a single measure. The difference table shows it plainly. E2a lowers WAPE in both seasons but gets worse on the symmetric measure in both seasons. E2b lowers both measures together in both seasons.

In the late weeks the order changes once more, and here which path you look at flips the result. In winter the tail column — week twenty after the launch and later — reads like this on path 0: today’s method 1.111, E2a 0.583, E2b 1.663. The median across paths of the same measure is 1.056, 0.583 and 0.873. So E2a is best on both readings, but E2b’s 1.663 on path 0 is the worst of the five draws: in the median E2b comes out better than today’s method. This is exactly where the price of drawing a direction from a single draw shows. Because the tail is light it barely moves the pooled measure, but it shows what the arms do in the late weeks.

Two things we do not hide

The obvious regression forms did not work. The most obvious way to build E2b was to take a logarithm per cell and put exposure into a regression with a coefficient. Two forms were tried and both were run as separate arms: a regression of the weekly difference and a level regression. The result, in winter, is a WAPE of 0.318 and 0.381 — both well above today’s method’s 0.260. In summer both again trail today’s method. So neither became a main arm; the form that remains is the one that keeps the link as a ratio of totals.

E2a’s default setting is not the best one. The number of bins and the minimum number of matched cell-days per bin are each a setting, and the report prints four combinations side by side on path 0. In winter, two bins with a threshold of 200 give a WAPE of 0.233, the default of four bins with a threshold of 200 gives 0.234. In summer the gap is large: two bins 0.144, the default 0.165. So on WAPE two bins beat the default in both seasons. But no ranking is built on a single measure in this grid either: in the same rows, winter’s markdown-period bias picks the default — 1.123 against 1.299 with two bins.

Lowering the threshold to 50 flips the direction in winter: 0.263 and 0.277, both above today’s method’s 0.260. In summer the same thing does not happen; there both values stay below today’s method. A looser threshold means a link built on fewer observations. This is a finding for one season and cannot be generalised to two.

The default was kept all the same. The reason is the measurement’s own rule: picking the setting by looking at the seasons measured would be seeing the answer and fitting the parameter to it. The grid is printed side by side, so the reader sees what each setting gives; the headline runs with the values of the arm’s spec.

The wall the correction hits

Now the most important sentence of this article, and it is a sentence about a limit.

Exposure measures the siblings’ stockouts. Stockouts of the option’s own sizes do not go into exposure at all: that is the cell’s own censoring, and it is the job of today’s method’s in-stock-day filter. More importantly, substitution flow that does not depend on exposure cannot be measured — the limits section of the report says so in exactly that sentence. So a customer may switch from one sibling to another while both are on the rail at the same time; exposure does not see that switch, because exposure measures only the gap.

The loose end the fourth article left ties up here. Today’s method deals with the cell’s own censoring; E2a and E2b clean out the trace left by sibling stockouts. The substitution flow itself — which customer switched from which product to which — is solved in no arm, and cannot be solved in this data.

So the ground the two corrections gain has to be kept narrow: what is measured is how far cleaning the curve of sibling stockouts moves the accuracy. The sentence “the substitution problem is solved” cannot be written.

What is hard in your data

Defining the set of siblings is a decision, not data. Here a sibling is an option in the same store, the same subcategory and the same price segment. In your chain customers may switch by size, by colour, or by the neighbouring rail in the store. Build the set wide and exposure comes out the same for everyone and tells nothing apart; build it narrow and the sample runs out.

There is no stockout history going backwards. Exposure needs to know the sibling’s stockout days in that week. Most data warehouses keep today’s stock, not the stock position of past days. Start building this column today and you will have something usable in a year; it cannot be recovered for the past.

Weighting by rate brings in a second model. The exposure here uses the sibling’s rate in the base window. That rate is a measurement too and carries its own error; because exposure is so unevenly spread (0.112 median, 0.574 ninetieth percentile), the error of the weighting passes straight into the bin edges.

The pressure to pick the setting by looking at the result will be strong. In the grid above, four combinations give four different numbers, and the best one changes with the season. In your own data you will have a single season; pick the setting that comes out best in that season, and what you measure is not the method’s success but the setting being fitted to that season. Fixing the setting in advance and publishing the grid next to it is less satisfying and more honest.

The direction of the correction will depend on the measure and the path. In this case E2a improved on one measure and got worse on the other; the direction of E2b in the winter tail turned between path 0 and the median across paths. If you decide on a single measure and a single draw, the measure and draw you chose will have chosen the arm. The next article measures this problem at its harshest: whether the accuracy measures and the money pick the same arm.

By Sabri Suyunu