Dynamic Logistic Regression

Time Series Classification

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.

📤

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.

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:

  1. 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.
  2. Set outcome lags back to 1 and run again. Watch that bar shrink, and watch what happens to the delivery effect.
  3. 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.