D09-F02-A06 / Complete engineering topic

Theta Forecast

A production-minded guide to Theta Forecast.

D09 · STATISTICAL TIME SERIES
D09-F02-A06Canonical / Tested / Open
D09 / D09-F02

The useful outcome

Theta is often described as a mysterious decomposition. The equivalent formula exposes a simple mechanism: a simple-exponential-smoothing level plus a carefully scaled drift. The practical goal is a path that another person can reproduce from a declared cutoff—not a line whose origin, state, or future assumptions are hidden.

The question this tutorial answers is: How does the classical non-seasonal Theta forecast combine a smoothed level with half the fitted linear trend?

What you will build

You will calculate the model by hand, implement it in Python and TypeScript, inspect eight long synthetic scenarios, and learn where correct recursion ends and empirical forecast validation begins.

Simple exponential smoothing and ordinary least-squares slope. Seasonal preprocessing is intentionally excluded.

Freeze the variant before fitting anything

Classical theta-zero/theta-two point forecast in its exact non-seasonal SES-with-drift form, fixed alpha in (0,1], OLS slope over t=0...n-1, and finite-sample correction.

VariantDefinitionBest useMain limitation
Selected non-seasonal classical Thetatheta 0/2 equivalence with fixed alphamechanical understandingno seasonal adjustment
Original competition Thetadeseasonalize, forecast theta lines, reseasonalizeseasonal competition seriespreprocessing choices matter
Optimized Thetaoptimize theta or drift choicesforecast tuningdifferent method and validation burden
SES with optimized driftestimate drift in a state-space modellikelihood forecastingnot constrained to half OLS slope

This matters because forecast libraries often share a model-family name while differing in constants, trend representations, signs, initialization, missing data, or optimizer behavior.

Intuition before notation

The smoothed level carries recent information; half the global OLS slope contributes a deterministic drift with a finite-sample adjustment. The hardest part is the exact finite-sample drift correction and the distinction from an optimized drift model. The forecast origin is therefore a visible data boundary, not just the point where a chart changes color.

Forecast origin and recursive path

Formula and symbols

y^T+hT=y~T+b^02[h1+1α(1α)nα]\hat y_{T+h|T}=\tilde y_T+\frac{\hat b_0}{2}\left[h-1+\frac{1}{\alpha}-\frac{(1-\alpha)^n}{\alpha}\right]

SymbolMeaningUnit or range
tilde y_Tfinal SES levelseries units
b_0OLS slope over time index 0...n-1series units/step
alphaSES smoothing parameter(0,1]
nnumber of observationscount
hforecast horizonpositive integer

The formula is a conditional point forecast. Future random innovations use zero because zero is their conditional expectation—not because the future is known to contain no shocks.

Data that the formula is allowed to see

A finite non-seasonal equally spaced series, fixed SES alpha, and positive horizon. No missing values or automatic seasonality test. Observations must be equally spaced, finite, ordered, and on one consistent scale. The model version and cutoff are frozen before the holdout. Revisions require a new forecast version rather than silent history replacement.

Algorithm

  1. Validate the non-seasonal series, alpha in (0,1], and horizon.
  2. Fit the ordinary least-squares time slope using indexes 0 through n-1.
  3. Run simple exponential smoothing with the first observation as initial level.
  4. Calculate the finite-sample correction from alpha and n.
  5. Add half the OLS slope times the horizon correction to the final SES level.

Recursion anatomy for the selected forecast model

Hand calculation

The following is author-derived arithmetic over synthetic values:

JSON
{
  "values": [
    10,
    12,
    14,
    16
  ],
  "config": {
    "alpha": 0.5,
    "horizon": 2
  }
}
  • OLS slope b0=2; final SES level at alpha=.5 is 14.25.
  • Finite-sample base is 1/.5-(.5^4)/.5=1.875.
  • h=1: 14.25+1(1.875)=16.125; h=2 adds 2.875, giving 17.125.

The expected path is [16.125, 17.125]. Independent tests pin these values before the larger fixtures are generated.

Calculation flow

Rendering system map…

The order matters. Revealed actuals may score the path, but they may not alter the version that was issued at the cutoff.

Guided experiment

The standalone lab contains eight scenarios and 1,440 calendar-month-end observations. It trains on 144 values and forecasts a 36-value holdout. Start at horizon one, predict what state should persist, then Step through twelve model-specific checkpoints. Change the principal parameter and watch the complete path recompute from the frozen training data.

The scenarios isolate persistence, mean reversion, linear trend, seasonal structure, a late level shift, one gross outlier, a variance-regime change, and seasonal phase/amplitude drift. They are not selected trades or provider histories.

The state an expert audits

For this model, keep the final SES level, OLS slope, finite-sample correction, and horizon-specific drift contribution visible.

Use classical nonseasonal Theta as a strong transparent baseline when a smoothed level plus constrained linear drift matches the teaching or operational question. Handle seasonality explicitly before applying this selected variant.

Separate the SES level from the drift contribution. Endpoint or structural-break sensitivity appears mainly through the global OLS slope; long horizons extend that slope mechanically.

When implementations disagree, use this order: Check deseasonalization, alpha estimation versus a supplied alpha, time-index origin, finite-sample correction, OLS slope definition, and whether the implementation uses the classical or generalized Theta method.

Model-specific state and benchmark workbench

The workbench is deliberately quantitative. It connects the model's unique state to the declared benchmark rather than asking the learner to judge whether the purple line “looks right.”

Failure diagnosis

  • Automatic seasonality detection and deseasonalization are outside this selected variant.
  • Alpha equal to zero is invalid because the exact correction divides by alpha.
  • A global OLS slope is sensitive to level shifts and endpoints.
  • Large h extends deterministic drift indefinitely.
  • The method's historical competition results do not guarantee performance on a new financial series.

Boundary and failure comparison

Invoking the M3 result as evidence of universal superiority or omitting the seasonal preprocessing difference. Correct arithmetic answers “did we implement the selected model?” It does not answer “is this a good model for this series?”

Implementation contract

The Python reference favors readable state transitions. TypeScript implements the same contract independently. Shared fixtures and focused tests require matching numeric paths within 1e-9 and exact agreement on lengths, nulls, states, and invalid-input behavior.

Estimation is intentionally outside the public function. In a real workflow, fit or select parameters using only training data, record the method and version, pass the frozen result into this recursion engine, and evaluate using rolling origins against simple benchmarks.

Practical evaluation

Use a loss function that matches the decision, report by horizon, and include baseline forecasts. Preserve the refit schedule and origin timestamps. If prediction intervals are needed, choose and validate an uncertainty model; do not manufacture intervals from point forecasts alone.

The lab's declared baseline is nonseasonal naïve last-value forecast. At active horizon k, it calculates errors only for the first k revealed holdout values:

  • MAE = mean(abs(actual - forecast));
  • RMSE = sqrt(mean((actual - forecast)^2));
  • bias = mean(actual - forecast);
  • MAE skill = 1 - model_MAE / benchmark_MAE.

Positive skill means the model's revealed-prefix MAE is lower than the frozen benchmark's. Negative skill is useful evidence: the sophisticated recursion is losing to a simple rule on this synthetic path. When benchmark MAE is zero, skill is undefined rather than infinite. One origin still cannot establish general performance; repeat the complete procedure over rolling origins before making an empirical claim.

Related methods

Forecast Models family handoff

AutoReg introduces lag memory. ARMA adds innovation memory. ARIMA changes the modeled scale through differencing. SARIMA/SARIMAX adds seasonal polynomials and future driver scenarios. Holt-Winters maintains level, trend, and seasonal states directly. Theta combines a smoothed level with constrained drift.

Next: Vector Autoregression.

Historical and evidence boundary

A historical example is not useful for this mechanism lesson. A defensible case requires licensed point-in-time observations, identity, frequency, adjustment and revision basis, cutoff, parameters frozen before inspection, benchmark, holdout, and publication rights.

This tutorial establishes definition fidelity. It does not establish stationarity, model adequacy, forecast calibration, historical association, causation, profitability, or investment suitability.

Primary references

Theta Forecast Calculation Flow

Purpose: separate validated historical state, fixed model parameters, recursive forecast state, and holdout evaluation.

Rendering system map…

Takeaway: evaluation data follows publication; it never repairs the already issued forecast.

ReferencesPrimary sources and evidence notes

Expand the source trail, evidence role, and limitations behind the engineering choices.

THETA_ORIGINAL — The theta model: a decomposition approach to forecasting

  • Organization or authors: V. Assimakopoulos and K. Nikolopoulos
  • Source type: Original peer-reviewed paper
  • Publication or effective date: 2000
  • Version: International Journal of Forecasting 16(4), 521–530
  • URL or DOI: https://doi.org/10.1016/S0169-2070(00)00066-2
  • Accessed: 2026-07-27
  • Jurisdiction: Technical method; no legal jurisdiction.
  • Supports: Theta lines modify local curvature and the classical method combines theta-zero and theta-two forecasts.
  • Limitations: The paper's competition procedure includes seasonal preprocessing not implemented in this selected non-seasonal package.
  • Evidence role: Definition/variant comparison only; not provider data or an empirical result for the synthetic fixtures.
  • Publication boundary: Link and paraphrase are public; no source dataset or copyrighted table is reproduced.

THETA_UNMASKED — Unmasking the Theta method

  • Organization or authors: Rob J. Hyndman and Md Baki Billah
  • Source type: Peer-reviewed analytical paper
  • Publication or effective date: 2003
  • Version: International Journal of Forecasting 19(2), 287–290
  • URL or DOI: https://doi.org/10.1016/S0169-2070(01)00143-1
  • Accessed: 2026-07-27
  • Jurisdiction: Technical method; no legal jurisdiction.
  • Supports: The classical point forecast is equivalent to simple exponential smoothing with a drift equal to half the fitted OLS slope, including a finite-sample correction.
  • Limitations: The equivalence does not validate any particular series, alpha estimate, or forecast performance.
  • Evidence role: Definition/variant comparison only; not provider data or an empirical result for the synthetic fixtures.
  • Publication boundary: Link and paraphrase are public; no source dataset or copyrighted table is reproduced.

STATSMODELS_THETA — The Theta Model

  • Organization or authors: statsmodels developers
  • Source type: Maintained official example and implementation documentation
  • Publication or effective date: 2025-12-05 documentation build
  • Version: statsmodels 0.14.6
  • URL or DOI: https://www.statsmodels.org/stable/examples/notebooks/generated/theta-model.html
  • Accessed: 2026-07-27
  • Jurisdiction: Technical method; no legal jurisdiction.
  • Supports: Theta forecasting combines OLS drift and simple exponential smoothing, with optional seasonality handling.
  • Limitations: The package selects the non-seasonal classical method and requires alpha rather than estimating it.
  • Evidence role: Definition/variant comparison only; not provider data or an empirical result for the synthetic fixtures.
  • Publication boundary: Link and paraphrase are public; no source dataset or copyrighted table is reproduced.

FPP_ACCURACY — Forecasting: Principles and Practice — Evaluating point forecast accuracy

  • Organization or authors: Rob J. Hyndman and George Athanasopoulos
  • Source type: Authoritative open forecasting textbook
  • Publication or effective date: 2021 third edition; online version updated 2026-03-09
  • Version: 3rd edition
  • URL or DOI: https://otexts.com/fpp3/accuracy.html
  • Accessed: 2026-07-27
  • Jurisdiction: Technical method; no legal jurisdiction.
  • Supports: Forecast accuracy must be measured on genuine forecasts outside the training sample; MAE, RMSE, scaled errors, and benchmarks answer different evaluation questions.
  • Limitations: A single synthetic holdout is a teaching comparison, not an empirical model-selection study.
  • Evidence role: Definition/variant comparison only; not provider data or an empirical result for the synthetic fixtures.
  • Publication boundary: Link and paraphrase are public; no source dataset or copyrighted table is reproduced.

FPP_TSCV — Forecasting: Principles and Practice — Time series cross-validation

  • Organization or authors: Rob J. Hyndman and George Athanasopoulos
  • Source type: Authoritative open forecasting textbook
  • Publication or effective date: 2021 third edition; online version updated 2026-03-09
  • Version: 3rd edition
  • URL or DOI: https://otexts.com/fpp3/tscv.html
  • Accessed: 2026-07-27
  • Jurisdiction: Technical method; no legal jurisdiction.
  • Supports: Rolling forecasting origins preserve temporal order and can evaluate horizon-specific errors without using future observations.
  • Limitations: This family demonstrates one frozen origin; production claims require many origins and a declared refit schedule.
  • Evidence role: Definition/variant comparison only; not provider data or an empirical result for the synthetic fixtures.
  • Publication boundary: Link and paraphrase are public; no source dataset or copyrighted table is reproduced.

FPP_RESIDUALS — Forecasting: Principles and Practice — Evaluating regression and residual behavior

  • Organization or authors: Rob J. Hyndman and George Athanasopoulos
  • Source type: Authoritative open forecasting textbook
  • Publication or effective date: 2021 third edition; online version updated 2026-03-09
  • Version: 3rd edition
  • URL or DOI: https://otexts.com/fpp3/regression-evaluation.html
  • Accessed: 2026-07-27
  • Jurisdiction: Technical method; no legal jurisdiction.
  • Supports: Residual plots and residual autocorrelation diagnose information left in the fitted model, but residual size is not a substitute for genuine forecast error.
  • Limitations: Residual diagnostics do not prove unbiasedness, calibrated intervals, or out-of-sample usefulness for these fixed teaching configurations.
  • Evidence role: Definition/variant comparison only; not provider data or an empirical result for the synthetic fixtures.
  • Publication boundary: Link and paraphrase are public; no source dataset or copyrighted table is reproduced.
theta_forecast.ts

type ForecastResult = {
  forecast:number[];
  fitted:(number|null)[];
  residuals?:number[];
  state:Record<string,unknown>;
  [key:string]:unknown;
};
const finite=(value:number,name:string)=>{
  if(typeof value!=="number"||!Number.isFinite(value))throw new Error(`${name} must be finite`);
  return value;
};
const positiveInt=(value:number,name:string,min=1)=>{
  if(!Number.isInteger(value)||value<min)throw new Error(`${name} must be an integer >= ${min}`);
  return value;
};
const series=(values:number[],minimum=2)=>{
  if(!Array.isArray(values)||values.length<minimum)throw new Error(`values must contain at least ${minimum} observations`);
  return values.map((value,index)=>finite(value,`values[${index}]`));
};
const coefficients=(values:number[],name:string,allowEmpty=true)=>{
  if(!Array.isArray(values)||(!allowEmpty&&values.length===0))throw new Error(`${name} must be a coefficient list`);
  return values.map((value,index)=>finite(value,`${name}[${index}]`));
};

export function forecastTheta(values:number[],alpha:number,horizon:number):ForecastResult{
  const y=series(values,4),a=finite(alpha,"alpha"),H=positiveInt(horizon,"horizon");if(a<=0||a>1)throw new Error("alpha must be in (0, 1]");
  const n=y.length,meanT=(n-1)/2,meanY=y.reduce((s,v)=>s+v,0)/n,den=Array.from({length:n},(_,t)=>(t-meanT)**2).reduce((s,v)=>s+v,0);
  const slope=y.reduce((s,value,t)=>s+(t-meanT)*(value-meanY),0)/den;
  let level=y[0];const fitted:(number|null)[]=[null];
  for(const observation of y.slice(1)){fitted.push(level);level=a*observation+(1-a)*level;}
  const correction=1/a-(1-a)**n/a,forecast=Array.from({length:H},(_,index)=>level+.5*slope*(index+correction));
  return {forecast,fitted,state:{ses_level:level,ols_slope:slope,alpha:a,finite_sample_correction:correction}};
}
Full-height labtheta forecast labOpen full screen