DISCOVER_MODEL is RainbowStats' high-level model-discovery command.
Supply a dependent series followed by candidate predictors. The operator coordinates the existing
Genetic Model, Random Forest, and OLS tools and presents the results as a single D3 slideshow.
Syntax
DISCOVER_MODEL(LIST(Y,X1,X2,...))
Optional Genetic Model settings may be supplied in the same command:
DISCOVER_MODEL(LIST(Y,X1,X2,X3),MAX_LAG:6,MAX_VARIABLES:2,SEED:12345)
The first series in LIST is the dependent variable. The remaining series are candidate predictors.
The Discovery Pipeline
The stages answer different questions. Genetic search asks which variables and lags deserve attention? Random Forest asks does the selected relationship contain useful nonlinear structure? OLS asks can the discovered relationship be represented by a simpler statistical equation? The untouched test then asks whether the discovered relationship survives observations that were not used for selection.
What DISCOVER_MODEL Does
1. Genetic search
The Genetic Model searches predictor subsets and observation lags. Candidate specifications are evaluated using Random Forest validation on a chronological validation block. Selection therefore focuses on predictive performance rather than simply maximizing an in-sample statistic.
The Genetic Model owns the chronological train/validation/test design. The final test block remains untouched during model selection.
2. Random Forest interrogation
After selection, the chosen specification is fitted with a Random Forest using the training and validation observations. RainbowStats then compares the forest with an OLS benchmark and exposes the nonlinear structure learned by the trees.
In particular, the consolidated regime analysis identifies recurring split thresholds across the forest. These thresholds are descriptive features of the fitted model. A right-minus-left prediction contrast is not a causal effect or marginal effect.
3. OLS representation
The selected variables and lags are passed to the regression stage. OLS supplies coefficients, standard errors, t-statistics, fitted values, residual diagnostics, and a familiar parsimonious representation of the relationship discovered by the earlier stages.
DISCOVER_MODEL does not convert predictive variable selection into a causal identification strategy.
4. Untouched test
The final slideshow returns to the chronological test observations held aside by the Genetic Model. This separates model discovery from the final assessment and helps guard against being impressed by a model only because it describes the data used to construct it.
Example: Payroll Growth
The entire discovery exercise can be written as a single RainbowStats equation:
D=DISCOVER_MODEL(SERIES_SINCE(LOGDIFF(SAME_DATE_RANGE(PAYEMS,ADPWNUSNERSA,INDPRO,CPIAUCSL)),20210101),MAX_LAG:6,MAX_VARIABLES:2,SEED:12345)
This composition performs the complete data preparation and model-discovery sequence in one line: align → transform → restrict sample → discover model.
SAME_DATE_RANGE first aligns the four source series. LOGDIFF converts the aligned
series to growth rates, and SERIES_SINCE restricts the analysis to observations beginning in 2021.
Because PAYEMS is the first series, it becomes the dependent variable. ADP private-payroll employment,
industrial production, and CPI are supplied as candidate predictors.
MAX_LAG:6 permits the Genetic Model to search observation lags through six periods,
MAX_VARIABLES:2 limits candidate specifications to at most two predictors, and
SEED:12345 makes the stochastic search reproducible.
A production test of this equation selected ADP private-payroll growth at lag 3. The discovery slideshow then displayed the Genetic Model results, leading candidates, Forest-versus-OLS benchmark, consolidated Random Forest regimes, OLS regression results, residual diagnostics, and the untouched test period.
Slideshow Output
DISCOVER_MODEL is a presentation-oriented operator. Its result is a D3 slideshow, and its
toJson() representation is the result of buildSlideshow().toJson().
| Panel | Question |
|---|---|
| Discovery Summary | What modeling process is being performed? |
| Genetic Selection | Which predictors and lags survived? |
| Leading Candidates | What alternative specifications were competitive? |
| Forest vs OLS Benchmark | Does nonlinear complexity improve validated performance? |
| Forest Regimes | What recurring thresholds did the forest learn? |
| OLS Results | Can the selected relationship be summarized parsimoniously? |
| Actual vs Fitted | How closely does the regression describe the selected sample? |
| Residual Analysis | What structure remains in the regression residuals? |
| Untouched Test | How does the selected model behave on observations excluded from discovery? |
Interpretation
DISCOVER_MODEL is not an automatic claim that the most complicated model is best.
Its purpose is almost the opposite: let complexity earn its keep. Genetic search broadens
the specification search, Random Forest reveals nonlinear structure, and OLS asks how much of the discovered
relationship can be expressed with a simpler equation.
The workflow is therefore:
Candidate Data
|
v
GENETIC MODEL discover variables and lags
|
v
RANDOM FOREST validate and interrogate nonlinear structure
|
v
OLS REGRESSION simplify, estimate, and diagnose
|
v
UNTOUCHED TEST check whether the discovery generalizes
Discovery first. Complexity must validate. Inference remains explicit.
Notes
Observation lag means X at t−lag; lag 0 is contemporaneous and should not automatically be interpreted as a forecast. Random Forest regimes and prediction contrasts describe the fitted model and should not be interpreted as causal effects. Post-selection OLS inference is exploratory unless the research design independently supports stronger identification.