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 & WHAT THIS TOOL SOLVES

Imagine a grocery category manager paying $180/week for a third oat-milk delivery because the shelf runs out roughly one day in sixβ€”and once empty, it tends to stay empty until the next truck arrives. A stockout you see coming is a delivery you can move; one you miss is a lost sale. Standard time-series tools like ARX assume continuous numbers, while standard logistic regression ignores time order. Dynamic Logistic Regression forecasts a single yes/no time series by placing yesterday's 0/1 outcome directly alongside external drivers (like promotions, weather, or deliveries) and testing forecasts on a strict walk-forward holdout.

🎯 Questions It Answers

  • How sticky is our yes/no outcome from one period to the next (state-dependence / momentum odds ratio)?
  • Do our operational or marketing drivers genuinely shift the event probability once we control for yesterday's outcome?
  • Does our model beat the tough "Same as Yesterday" baseline, especially on the crucial days when the outcome switches?

πŸ“‚ What Data You Need

  • Single Time-Ordered Series CSV: One row per time period (day, week, month) in chronological order (for multi-customer panels, use Panel Dynamic Logit).
  • 1 Binary Outcome Column (yt): Coded 0/1 or two labels (e.g., stockout, sold out, daily goal hit).
  • External Driver Columns (xj,t): Numeric or 0/1 predictors with selectable lag delays.

πŸ’‘ What You'll Discover

  • Momentum vs. Driver Odds Ratios: Separate odds ratios for lagged outcomes (eΟ†) and external levers (eΞ²).
  • Walk-Forward Holdout Scorecard: Out-of-sample accuracy, log loss, and Switch-Day accuracy against three baselines.
  • Short-Run vs. Long-Run Steady-State Lift: How a one-day intervention differs from sustaining a policy permanently.
πŸ” Key Nuances: Why Yesterday Matters, Walk-Forward Testing & When Not to Use This Tool
  • Not the Same "AR" as ARX: The ARX tool carries past continuous errors forward. Because a 0/1 binary outcome has no continuous error to carry forward, Dynamic Logit enters past outcomes (ytβˆ’1, …, ytβˆ’p) directly as predictors in logistic regression.
  • Leaving Yesterday Out Can Flip a Driver's Sign: If managers react to bad days (e.g., ordering emergency stock or running a promo after a slump) and you omit yesterday's outcome, the model blames the manager's reaction for the bad state that triggered it.
  • Beat "Same as Last Period" on Switch Days: In a sticky series, guessing "same as yesterday" is right on most quiet days but gets 0% of switch days right. Always evaluate the model on walk-forward holdout periods and inspect Switch accuracy.
  • When to Use Another Tool: Don't turn a continuous metric (like dollar sales) into a 0/1 thresholdβ€”forecast the number directly with ARX. And if your file stacks many customers' histories together, use Panel Dynamic Logit.
πŸ“ Under the Hood: Model Equations & Variable Definitions
1. Dynamic Logistic Regression with Outcome Lags (p) & Delayed Exogenous Drivers
\[ \log\!\left(\frac{P_t}{1 - P_t}\right) = \alpha + \sum_{i=1}^{p} \phi_i \, y_{t-i} + \sum_{j} \beta_j \, x_{j,\,t-\ell_j}, \qquad P_t = \Pr(y_t = 1 \mid \mathcal{F}_{t-1}) \]
πŸ’¬ Read it in plain English: The log-odds that the event happens in period t equals a baseline intercept (Ξ±), plus momentum from the last p outcomes (Ο†i ytβˆ’i), plus the effects of external drivers at their chosen lag delays (Ξ²j xj,tβˆ’β„“).
Pt, yt
Predicted Event Probability & Observed 0/1 Outcome OUTPUT β“˜
Chance the focal event happens in period t (Pt) and actual binary outcome (yt ∈ {0, 1}).
ytβˆ’i, Ο†i
Lagged Outcome & Momentum Log-Odds Slope ESTIMATED β“˜
Whether the event happened i periods earlier (ytβˆ’i) and its state-dependence log-odds weight Ο†i (where eΟ†i is the momentum odds ratio).
xj,tβˆ’β„“, Ξ²j
Lagged External Driver & Driver Log-Odds Slope ESTIMATED β“˜
Value of external driver j at delay β„“j and its log-odds slope Ξ²j holding past outcomes fixed.
Ξ±, p, β„“j
Baseline Intercept, Autoregressive Order & Driver Delay YOUR DATA β“˜
Baseline log-odds when all lags and drivers are zero (Ξ±), number of outcome lags included (p), and chosen delay for driver j (β„“j).

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.