Explainer

Reading the curve from sales

No table holds the curve; tables hold sales. Today's method divides sales by in-stock days, takes out the week's character and steps forward week by week on matched cells. Against drawing sales as they are, winter's WAPE is 0.260 instead of 0.427. It still over-forecasts in phase 2.

Life-Cycle Curve · 3 / 6

The curve on Pelin’s screen comes from somewhere. But no table has a column called “life-cycle curve”. What the table has is sales: in which store, on which day, how many units. In this article we look at how the curve is built from those sales — which steps are taken one by one, and why — and at the measured size of the gap between that and drawing sales as they are.

The record table

Everything starts with a single table: for every option × store pair (a cell, for short), one row for every week counted from the launch. A row holds two things: how many days that week the product was on the rail, and what it sold on those days.

Which sales the table is built from matters: the curve is learned from past seasons. For the curve of the season measured, closed seasons of the same type are used (winter for winter, summer for summer); the measured season’s own weeks never go into the table. For the winter measured, that is the previous winter; for the summer measured, the two summers before it. The report labels the table with the name of the season measured, but the rows are not from that season.

The first rule is here: only in-stock days go into the table. A day the rail was empty (a stockout dayA day on which a product open for sale in a store or channel was not on the shelf at all. Lost sales happen on these days.) counts neither towards sales nor towards days. Because if you divide a week’s rate by seven days, a cell that was out of stock for three days lowers its own rate by itself, and the curve draws a fade that never happened. Yet on those days demand did not stop; it simply was not recorded (censored demandDemand that arrives while the shelf is empty and is never recorded. Sales data show not demand but the smaller of demand and stock.).

The record table built for winter is 358,957 rows: 24,680 cells, 934 optionsThe combination of a model and a colour; the basic product unit for planning and for transfer decisions., 71 stores, 16 subcategories and week 26 at the latest. These rows hold 2,413,013 in-stock days and 714,722 units of adjusted sales. The raw table of the same cells, which counts the stockout days too, is 522,845 rows, or 1.457 times the record table. The extra rows are cells that were not on the rail at all that week: for every cell-week the curve can use, the raw table holds 1.457 cell-weeks.

The table built for summer draws on two closed seasons and is larger: 877,490 rows, 51,368 cells, 1,964 options, 72 stores, week 27 at the latest, 5,955,968 in-stock days, 1,804,825 units of adjusted sales. Its raw table is 1,130,959 rows, a ratio of 1.289 — in summer this ratio comes out lower than in winter.

Dividing out the character

Sales do not depend only on whether the product is on the rail. A Saturday sells more than a Monday, a promotion week more than a normal week, a marked-down price more than full price. None of these is the product’s life-cycle curve; they are the week’s character.

So the sales that go into the record table are first divided by the character: day of the week, special day and price effect. The “adjusted sales” in the table are the result of that division. That way a week that happened to fall on a promotion does not look like a peak on the curve.

The only multiplier left out of the division is the life multiplier itself. That is deliberate: if you divide sales by the curve while building the curve, you have divided what you are looking for by your own assumption, and it is no longer clear what you have found.

The matched chain

Now the real trick. The curve is not built directly as “week five’s sales ÷ week four’s sales”. If it were, this would happen: the cells that sell well run out of stock early and drop out of the table in week five, the ones left are the slow sellers, and the curve fades although the product has not. What falls is not the product’s rate but the make-up of the set of cells.

The chain handles this as follows. It builds the step from one week to the next — say from week four to week five — only from the cells that have in-stock days in both weeks. Every cell has an adjusted daily rate for each week; the smaller of the two weeks’ in-stock day counts is the weight. The link is the ratio of these cells’ weighted rates: week four in the denominator, week five in the numerator.

The curve then moves forward as the product of these links: the launch week is 1, the next week the previous value times that week’s link. So the curve gives a series of ratios, not of units — and the forecast uses the ratio of two weeks too. The 0.596 Pelin saw on screen was the average of this series over the markdown-period weeks divided by its average over the window weeks.

Three separate tools of today’s method have come up so far, and each was built for a different problem. The in-stock-day filter is for censoring: so that a week that looks short because the rail was empty is put right. Dividing out the character is for the week’s character: so that a week that fell on a promotion does not look like a peak. The matched chain is for the shift in make-up: so that cells dropping out of the table do not drag the curve down. Three separate problems.

Fallback levels

A link cannot always be built. In a wave’s late weeks, in a small subcategory, there may be almost no cells left that were in stock in both weeks. In such a week, insisting on building the link would be mistaking noise for the curve.

The method is therefore tiered. If the subcategory × wave link carries enough matched in-stock days, it is used. If not, it drops to the category × wave link, and if that does not either, to the wave link of the whole line; if there is none, 1 is used for that week, so the curve runs flat that week. Which level each week came from sits in the output as a column; it is worth a look, because part of what you read as “the subcategory’s curve” may in fact be the line’s curve.

The threshold of these tiers and how many weeks each level feeds are not printed as numbers in this series’ report, so I give no number here. Where to look in your own set-up is clear: the column that holds the link’s source.

Drawing sales as they are

All of this has a comparison arm: taking raw weekly sales as the curve, without correcting them at all. In this series we call it E0, and today’s method E1. E0 is not a proposal but a baseline.

E0 and E1 differ in three places, and all three have to be counted together. E0 uses the raw table, stockout days included; it does not divide sales by the character; and it builds the link without matching — it divides the group’s total sales that week by all its days and takes the ratio of two consecutive weeks. The third is not written in the arm’s label; it has no name either, but its mechanism is the one I described above — a link that pours the cells into one pot can shift when a fast-selling cell runs out. That shift was not measured separately in this case.

The measure is this: how far the ratio of the curve in a week, divided by the ratio of the truth in the same week, strays from 1; the deviations are weighted by that group’s true demand that week. We call it WAPE. It has a trap, and in this series it is always read alongside something else: WAPE is asymmetric. An over-forecast is penalised without limit, an under-forecast by at most 1. So every row also prints its symmetric counterpart (the version that counts k times too high and k times too low the same).

Winter, path 0: E0’s WAPE is 0.427, its symmetric measure 0.630. E1’s WAPE is 0.260, its symmetric measure 0.195. In summer E0 0.337 | 0.417, E1 0.169 | 0.148. Note that E0’s symmetric figure is worse than its WAPE, while E1’s is better. The explanation the report gives for this rests on winter’s full-price period: there E0 under-forecasts — its phase 1 bias (forecast ÷ truth) is 0.558 — and the asymmetric measure shelters it; E1 over-forecasts (1.202), and the asymmetric measure penalises it. This explanation cannot be stretched as it is to the other season and phase: in the markdown period E0 over-forecasts too (figures below). But the rule stands: no sentence about E0 is written without reading the two columns together.

The gap is large; but how much of it came from which tool was not measured. Three tools change at once, and the case does not break the gap between E0 and E1 into its parts. What can be said is the total; we cannot say “the in-stock days brought this much”.

E1 does not fix one thing: it carries on over-forecasting in the markdown period. In winter E1’s phase 2 bias is 1.501 — a figure that comes from weighing all the subcategories together, not from a single cell; Pelin’s cardigan was one cell of a subcategory inside that figure. In the same season E0’s phase 2 bias is closer to 1: 1.206. In summer it is the other way round: E0 1.963, E1 1.070; in phase 1 too, E0 0.867, E1 1.037.

That does not mean “E0 was better” — on the pooled measures E1 is well ahead of E0 in both seasons. What it does mean is two things, and the two must not be confused.

E1’s remaining error has a direction. In phase 2 the report prints all five demand paths, and E1’s bias is above 1 in all five of the five paths in both seasons; the median across paths is 1.442 in winter and 1.081 in summer. For phase 1 the report prints no median across paths; what we have is the path 0 measurement: 1.202 and 1.037, both above 1. So in phase 2 the direction changes neither with the path nor with the season; in phase 1 the two measurements of the single path we have point the same way too. What changes is the size.

What changes sign is the gap between E0 and E1. The report prints that gap separately: on path 0 the difference in phase 2 bias is −0.295 in winter and +0.893 in summer. So in winter E0 is less biased than E1 on this one measure, and in summer far more. That is an example of why no ranking of arms is built from a single column. The report’s own reason is more general: the ranking changes with the measure, and because WAPE is asymmetric no ranking is built on a single measure.

What is hard in your data

The in-stock flag. It is the column the whole method rests on, and in real chains it is broken exactly when it is needed: negative stock, phantom stock, stock shown in transit, the box the store never counted. A day thought to be on the rail drags the rate down and fades the curve early.

The error in the character multipliers passes into the curve. You have to estimate the day-of-week, special-day and price effects before the curve. If you underestimate price elasticity, the promotion week’s surplus stays in the curve and that week looks like a peak.

A cell’s identity has to stay the same across the weeks. The matched chain looks for the same cell in two consecutive weeks. For products whose store code changes, that close mid-season, that are merged in the master data or launched a second time, the matching breaks silently: the link does not come out wrong, it gets weaker — and because it gets weaker, it drops to a fallback level. Nobody sees a warning.

If the fallback levels’ source is not recorded, the curve has no clear owner. If a week was filled with the line’s link, that week does not belong to the product. In a set-up that does not keep this, the sentence “the subcategory’s curve” cannot be verified.

Most places have no zero rows at all. The gap between the two tables shows only if you can produce the row “this week it was not on the rail at all”. In most data warehouses, no sales row means no row: a stockout week sits there not as a zero but as an absence. If you cannot count what you drop, you cannot measure how much work the correction does either.

The next article does not look for where E1’s remaining error comes from; this case cannot answer that question honestly, because the arms produce a single curve and there is no way to share the error out among components. The only number tied to the arm is bias. The question that can be answered is this: what is the hidden truth’s fall in the markdown period made of, and how large is the multiplier a pure life-cycle curve would miss?

By Sabri Suyunu