Statistics · Regime Analysis

SPLIT_POLY_FIT

Divide aligned series into dated regimes, fit a polynomial inside each regime, and compare how both the time path and the relationship between the first two series change across structural breaks.

Time-series fits XY scatter fits Dated regimes Optimal split ±1σ bands Slideshow result

Syntax

Split dates supplied directly

SPLIT_POLY_FIT(dataList, degree, splitDate1, splitDate2, ...)

Split dates supplied as a number array

dates=TO_ARRAY(splitDate1, splitDate2, ...)
SPLIT_POLY_FIT(dataList, degree, dates)
Split dates use YYYYMMDD. A split date is the first observation of the new regime; the preceding regime ends immediately before it.

What the command does

  1. Aligns every series to a common date range.
  2. Sorts valid split dates and divides the data into non-overlapping regimes.
  3. Fits the requested polynomial degree separately within each regime.
  4. Merges the period fits into time and XY comparison charts.
  5. Builds an optimal two-regime XY view when that panel is enabled.

Series order

The time-series panel uses every series in the list. The XY panels use the first two list elements and follow RainbowStats' dependent-first convention:

LIST(Y, X)  →  vertical axis = Y, horizontal axis = X

For a Beveridge curve, place job openings or the vacancy rate first and unemployment second: LIST(Vacancies, Unemployment).

Use SET_NAME before building the list to give the axes and regime legends concise labels.

Parameters

ParameterTypeRequiredDescription
dataList DataList Yes Two or more dated series. All series are aligned before fitting. The first two also define the XY relationship.
degree Number Yes Polynomial degree for each regime. Values below 2 are promoted to 2; XY scatter fits are capped at degree 6.
splitDate Number Yes One or more dates in YYYYMMDD form. Dates may be passed separately or collected with TO_ARRAY.

Example: Beveridge-curve regimes

Vacancies=SET_NAME(SERIES_SINCE(JTSJOR,20010101),"Job Openings: Total Nonfarm")
Unemployment=SET_NAME(SERIES_SINCE(UNRATE,20010101),"Unemployment Rate")
Data=LIST(Vacancies,Unemployment)
Dates=TO_ARRAY(20080101,20200301,20220101,20250101)
Fit=SPLIT_POLY_FIT(Data,3,Dates)
SLIDESHOW(Fit)

This compares the pre-financial-crisis, recovery, pandemic, reopening, and recent relationships without forcing a single polynomial across the entire sample.

Slideshow panels

PanelWhat it showsHow to read it
Split time fits Actual values and a separate polynomial trend for each series in each dated regime. Look for changes in direction, curvature, or level around the supplied dates.
Split XY scatter Period-colored observations, fitted curves, and ±1σ residual bands for the first two series. Compare whether the relationship shifts inward, outward, steepens, or flattens by regime.
Optimal split Two polynomial relationships separated at the breakpoint with the lowest combined fitting error. Use the displayed split date as an exploratory structural-break candidate.

Optimal breakpoint

The optimal-split panel evaluates admissible breakpoints and chooses the index that minimizes the sum of the two regimes' polynomial least-squares errors.

k* = arg mink [SSEleft(k) + SSEright(k)]

Candidate splits must leave enough observations on both sides to estimate the requested degree. The corresponding observation date is shown as the optimal split date.

Residual bands

Each XY fit displays the fitted curve plus and minus one residual standard deviation. These bands show the typical vertical dispersion of observations around the fitted relationship.

band(x) = ŷ(x) ± σresidual
The ±1σ lines are descriptive residual bands—not formal confidence or prediction intervals. They do not widen automatically where data are sparse.

Good practice

  1. Begin with degree 2 or 3 and increase it only when the added curvature is economically meaningful.
  2. Choose manual split dates from defensible events, policy regimes, or hypotheses.
  3. Keep enough observations in every regime; high-degree fits are unstable in short samples.
  4. Compare the manual dates with the optimal split instead of treating either as definitive.

Interpretation limits

A lower-error split identifies a change in the fitted statistical relationship. It does not by itself prove a causal event, a permanent structural break, or an out-of-sample forecasting improvement.

Polynomial curves can extrapolate sharply outside their observed range. Read each fitted curve only over the X values present in its own regime.

Repeatedly searching dates and degrees can overfit history. Confirm an important breakpoint with economic context and, where possible, held-out data.

Related commands

Useful building blocks and companion views:

LIST TO_ARRAY POLY_FIT POLY_SCATTER MERGE_CHARTS SERIES_SINCE SET_NAME SLIDESHOW EXTRACT