Forecast whether something will happen next period (a stockout, a sell-out, a target hit) from what
happened last period and what you plan to do, then test that forecast on days it never saw.
👨🏫 Professor Mode: Guided Learning Experience
New to yes/no forecasting? Professor Mode walks you through momentum, honest testing and the
difference between a one-day effect and a lasting one.
QUICK START: Choose Your Path
OVERVIEW & LEARNING OBJECTIVES
A grocery category manager pays for a third weekly oat milk delivery, about $180 a week. Is it worth it?
The shelf runs out on roughly one day in six, and once it is empty it tends to stay empty until the truck
comes. A stockout you see coming is a delivery you can move. One you don't is a lost sale and a
shopper who tries another brand. This tool forecasts yes/no events like that one, using last
period's outcome as one of the predictors.
🎯 What You'll Learn
Yesterday's outcome is a predictor. In a yes/no series, last period's result is
often the strongest signal there is. Its odds ratio measures the momentum.
Momentum can be fake. A streak can come from a driver that itself comes in streaks,
like a rainy spell. Leave that driver out and the momentum takes its credit.
Leaving yesterday out can flip a driver's sign. If managers react to bad days, the
reaction looks harmful until the model knows what yesterday looked like.
Test on the future, never a random split. Train on the past, forecast the next
period, step forward, repeat.
"Same as last period" is the floor. It is right most days in a sticky series. A
model earns its keep on the days the series changes.
An effect today is not the effect of keeping it up. Because outcomes carry over, a
lasting change moves the long-run rate by a different amount than a one-day change.
The model:
$$ \log\frac{P_t}{1 - P_t} = \alpha + \sum_{i=1}^{p} \phi_i \, y_{t-i} + \sum_{j} \beta_j \, x_{j,t-\ell} $$
where \(P_t\) is the chance the outcome happens in period \(t\), \(y_{t-i}\) is whether it happened
\(i\) periods earlier (1 or 0), and \(x_{j,t-\ell}\) is a driver at its chosen delay \(\ell\).
Each \(e^{\phi}\) is the momentum odds ratio; each \(e^{\beta}\) is a driver's odds ratio with last
period's outcome held fixed.
🔁 Not the same "AR" as the ARX tool
The ARX tool carries past errors forward (regression with
autoregressive errors). This tool puts past outcomes in as predictors. That is the only
sensible form for a yes/no series, because a 0/1 outcome has no smooth error to carry forward. The
textbook name for this model is a dynamic logit; it is ordinary
logistic regression with
last period's outcome added as a column.
📘 Key concepts
State dependence (momentum): how much more likely a "yes" is when the last period
was a "yes". Measured by the outcome-lag odds ratio.
Walk-forward holdout: the last few weeks are hidden. The model is refitted on
everything before each held-back day and asked to forecast that day, one day at a time.
Three baselines: the base rate (always forecast the average), momentum only
(yesterday and nothing else), and "same as last period" (a hard yes/no rule).
Switches: held-back days whose outcome differs from the day before. "Same as last
period" gets every one of them wrong by design.
Long-run rate: the share of periods that would end up "yes" if a plan were kept up
indefinitely, worked out exactly from the fitted model.
🧭 When to use it, and when not to
Use it when one yes/no outcome is recorded period after period and you want to forecast the next
one: out of stock, sold out, hit the target, trending, budget exhausted by noon.
Don't make a yes/no series out of a number. "Did sales beat $10K?" throws
information away. Forecast the number itself with
ARX or Forecast Starter.
Don't stack many customers' histories into one file. That is a panel, and a
momentum estimate from a panel mixes real habit with some customers simply always buying. This
tool takes one series.
Step 1DATA SOURCE
Start with a case: each one was generated from a known model, so at the end you can check your estimates
against the truth. Or bring one series of your own, one row per period, in time order.
📚
Use a Case Study
Four cases, each two years of daily data: a grocery shelf that keeps running out, delivery slots
that sell out in streaks, a candle shop whose flash sales look like failures, and the same grocery
shelf after a supplier switch.
📚Use a Case Studyclick to switch
📤
Upload Your Data
Drag & Drop raw data file (.csv, .tsv, .txt)
One row per period, in time order: a yes/no outcome column, optional
predictor columns, and an optional date column. At least 60 periods.
No file uploaded.
📤Upload Your Dataclick to switch
INPUTS & SETTINGS
Step 2Tell the model what to look at
Pick the yes/no outcome and which of its two values counts as "yes". Then pick the drivers. A driver
used in the same period has to be something you will know in advance when you forecast: a
planned promo, a delivery schedule, a weather forecast.
Dates unlock day-of-week terms and real dates on the forecast.
Drivers, and how long each one takes to act
Tick a driver to include it. "Same period" means today's value forecasts today; "1 period
later" means yesterday's value forecasts today.
Driver
Same period
1 period later
2 periods later
3 periods later
Load data to see its columns.
Step 3Decide how far back the memory reaches
"Outcome lags" is how many past periods the model may look at. One lag means "was it out of stock
yesterday?". Two adds the day before. Start with one and let the lag table under the results tell you
whether more help.
Advanced
🤔 Try this:
Load Kestrel Market, set outcome lags to 0, and run. Open Diagnostics and look at
the bar at lag 1 in the leftover-pattern chart.
Set outcome lags back to 1 and run again. Watch that bar shrink, and watch what
happens to the delivery effect.
Now load Brightwick Candles and do the same thing. Keep an eye on the sign of the flash-sale
coefficient.
Load a case or upload a
series to begin.
Step 4VISUAL OUTPUT
Every number on this page about forecasting comes from the held-back periods: days the model was never
fitted to. That is the only honest way to score a forecast.
The series, and how the model saw it coming
Each tick along the bottom is a period when the outcome happened. The line is the model's forecast
chance for each period; in the shaded stretch at the end, every point is a genuine forecast made
without seeing that day. Diamonds mark the switches, the days the outcome changed.
📊 How to Read This Chart
A tall line just before a tick means the model saw that day coming.
In a sticky series the line hugs whatever happened yesterday. That is momentum, and it is why the
switches matter more than the long quiet stretches.
A diamond with a high line before it (or a low line before a "no") is a switch the model caught.
Did it beat doing the obvious thing?
Lower is better. Each bar is the average penalty for the held-back forecasts: a confident miss costs a
lot, a hedge costs a little. The model has to beat "momentum only" to show its drivers add anything,
and the dashed line (the base rate) to show anything forecasts at all.
📊 How to Read This Chart
Shorter bar, better forecasts. The gap between the model and "momentum only" is what your
drivers bought you.
"Same as last period" has no bar: it only ever says 0% or 100%, and one confident miss makes this
penalty infinite. It appears in the table below instead.
Accuracy rewards saying the same thing as yesterday. Switches caught is the column that shows
whether the model sees change coming.
Forecast
Log loss
Brier
AUC
Accuracy
Switches caught
What each driver does today, and if you keep it up
Bars are changes in the chance of a "yes", in percentage points. The first two bars per driver are its
effect today, split by what happened the period before; the third is how far the long-run share of
"yes" periods would move if the driver were on in every single period, the most extreme lasting change.
📊 How to Read This Chart
When the two "today" bars differ a lot, the driver matters far more on some days than others.
That is what momentum does to an effect.
The long-run bar is an upper bound, not a plan: nobody runs a promotion every day. Price a
realistic lasting change (a delivery every Saturday) in the what-if below. The today bars are for
one-off decisions.
These are associations from past data, not proof that the driver causes the change.
Step 5WHAT THIS MEANS
Start with the plain reading, then the two write-ups. The numbers below are the ones to quote.
Does yesterday change today's chances?
–
Outcome-lag odds ratio
Run the analysis to see what this means here.
Do the drivers add anything beyond momentum?
–
Holdout log loss vs momentum only
Does it see changes coming?
–
Switches caught
If things carried on as they are, how often would it happen?
–
Long-run rate
Start here
Managerial Interpretation
Run the analysis to see the managerial interpretation.
APA-Style Report
Run the analysis to see the APA-style report.
MODEL DETAILS
Coefficient Estimates (Log-odds and Odds Ratios)
Term
Estimate (log-odds)
Standard Error
z
p-value
Odds Ratio
Odds-ratio interval
Periods used (after lags):–
Log-likelihood:–
Model chi-square vs intercept only:–
McFadden R-squared:–
AIC / BIC:–
📊 How to Read This Table
The outcome-lag row is the momentum. Its odds ratio says how many times higher the odds of a
"yes" are after a "yes", with the drivers held fixed.
A driver's odds ratio is its association with last period's outcome held fixed. If the interval
includes 1, this data cannot tell the driver apart from no association.
Odds ratios multiply odds, not probabilities. The effects chart above turns them into percentage
points.
How far back does the memory go?
The same model with 0 to 4 outcome lags, every row fitted on the same periods so the scores compare
fairly. Lower AIC and BIC are better; the highlighted row is BIC's choice. The tool never switches
your setting for you.
Outcome lags
Periods
AIC
BIC
Last lag adds anything? (LR p)
Step 6FORECAST & WHAT-IF
Set what each driver will do over the coming periods, then compare a plan against carrying on as before.
A same-period driver only belongs here if you will know it in advance.
📊 Scenario builder
"As before" replays each driver's last year in order, so promotions keep their usual
rhythm. The what-if column is the plan you want to test.
Driver
Baseline
What-if
The next periods, as probabilities
The solid line is the chance of a "yes" each coming period under the baseline, the dashed line under
your what-if. The faint dots are twenty possible futures drawn from the same model: a 30% day comes up
"yes" about one time in three.
📊 How to Read This Chart
The line starts from what happened last period and drifts toward the long-run rate as the memory
of today fades.
These probabilities treat the fitted coefficients as exact. With a couple of years of history the
real uncertainty is wider.
The long-run rates below are exact consequences of the model, not simulations.
Long-run rate, baseline:–
Long-run rate, what-if:–
REVEAL THE TRUTH
This case was generated from a model with known coefficients. Make your call first, then compare.
DIAGNOSTICS & ASSUMPTIONS
Each check below says what it found and what to do about it. A failed check is a next step, not a
verdict on the data.
Is there time pattern left over?
Bars are how much each period's surprise resembles the surprise k periods earlier. Bars inside the
dashed band are noise; a bar sticking out at lag 1 means the model is missing some of yesterday.
📊 How to Read This Chart
The Ljung-Box test below the bars asks whether all the bars together stick out more than chance
would allow. It was built for numeric residuals, so for yes/no data read it as approximate.
Has the rate held steady?
The share of "yes" periods over the trailing four weeks. A model fitted to two years assumes the
same rules held throughout; a step in this line is a reason to doubt that.
When it says 30%, does it happen 30% of the time?
Held-back forecasts grouped by how confident they were. Points on the diagonal mean the
probabilities can be read as real chances; points below mean the model overstated them.
EXPLORATORY QUESTIONS
On Kestrel, "same as yesterday" is right on most held-back days. Why is that not evidence that the
model is unnecessary? Which number on this page answers the question instead?
On Ferngrove, run momentum only (untick every driver), then add rain. Where did the momentum go,
and what would have happened if the ops manager had added drivers the day after every sell-out?
On Brightwick, compare the flash-sale coefficient with 0 and with 1 outcome lag. Which one would
you show the owner, and how would you explain the difference in one sentence?
A Saturday delivery cuts stockouts by a lot on the day after an empty shelf and by little after a
full one. Why does its long-run effect differ from either number?
Load the supplier-switch case. What does the stability check say, and what would you do with the
first year of data?
LEARNING RESOURCES
📚 Going further
Many customers at once: use Panel
Dynamic Logistic Regression. With a panel, a momentum estimate mixes true habit with
some customers simply always buying (state dependence versus heterogeneity). Separating them
needs random effects and a treatment of each customer's first period.
Counts instead of yes/no: for "how many" per period, a Poisson autoregression
plays the same role.
Robust standard errors: if leftover time pattern remains, HAC (Newey-West)
standard errors are a robustness check. The Python export shows how.