Purpose: Estimates a binary threshold regression by searching for the value of a selected explanatory variable that best divides the sample into two distinct linear regimes. This is useful when the relationship between variables may change once an economic, financial, or statistical state variable crosses a critical level.
Syntax:
THRESHOLD_REGRESSION(list, splitColumn) THRESHOLD_REGRESSION(list, splitColumn, minSideObservations)
The first series in the list is the dependent variable. The remaining series are explanatory variables.
splitColumn identifies the explanatory variable used to search for the threshold.
The optional minSideObservations parameter specifies the minimum number of observations required on each side of the threshold.
If omitted, RainbowStats selects a reasonable minimum automatically.
Methodology:
For each admissible candidate threshold c, the sample is divided into two regimes:
RainbowStats then estimates separate ordinary least-squares regressions on the two subsamples:
For every candidate threshold, the combined residual sum of squares is calculated:
The estimated threshold is the value that minimizes the combined residual sum of squares:
The selected threshold therefore represents the sample division that produces the best two-regime linear fit subject to the minimum-observation constraint. Candidate thresholds are evaluated only between distinct observed values of the threshold variable.
Output:
The operator returns a multi-panel diagnostic containing:
Interpretation:
A large reduction in SSR and materially different coefficients across the two regimes provide evidence that a single linear regression may be masking a nonlinear or state-dependent relationship. A clearly defined minimum in the SSR profile indicates that the threshold is relatively well identified.
The reported F statistic should be interpreted as a diagnostic rather than a conventional fixed-break hypothesis test because the breakpoint itself is selected by searching across candidate thresholds. Formal threshold inference may require bootstrap or other threshold-specific procedures.
Example:
r=set_units(toWeekly(WRESBAL)/1000,"Billions of Dollars") s=(toWeekly(DFF)-toWeekly(IORB))*100 l=same_Date_Range(list(s,r)) slideshow(THRESHOLD_REGRESSION(l,1))
This example searches for a threshold in Federal Reserve reserve balances that best separates the relationship between reserve abundance and the effective federal funds rate relative to IORB.