Data-Driven Models
Data-Driven Models
Empirical forecasting models · Model guide
Sequential tree ensemble that fits residual structure stage by stage and uses validation loss to control overfitting.
How do you sequentially correct prediction errors across hundreds of macro predictors without overfitting the residual structure?
Jerome Friedman introduced the gradient boosting machine (GBM) in a 2001 paper that recast the problem of combining weak learners as numerical optimization in function space. Earlier boosting methods like AdaBoost (Freund and Schapire, 1997) operated through iterative reweighting of misclassified observations. Friedman showed that AdaBoost could be understood as steepest descent on an exponential loss, and generalized the idea to arbitrary differentiable loss functions. The core insight: at each iteration, compute the negative gradient of the loss with respect to the current ensemble prediction, fit a new base learner (typically a shallow regression tree) to those gradient values (pseudo-residuals), and add a shrunken version of the fitted tree to the ensemble. This sequential error-correction mechanism produces ensembles that are far more accurate than any individual tree, and the use of shallow trees (depth 3 to 8) means each base learner is a weak learner with high bias but low variance.
The mechanism operates by additive expansion in function space. At iteration , the ensemble prediction is , where is a regression tree fit to the pseudo-residuals and is the learning rate (shrinkage). Each tree corrects the errors of the current ensemble rather than fitting the raw response. Shrinkage is critical: Friedman showed that reducing below 1.0 (typically 0.01 to 0.3) substantially improves generalization at the cost of requiring more trees. The combination of shallow trees and small learning rates means the ensemble builds up complexity gradually, capturing increasingly subtle patterns in the residual structure.
Chen and Guestrin (2016) introduced XGBoost, which extended Friedman's GBM with a second-order Taylor expansion of the loss function, explicit L2 regularization on leaf weights, and a penalty on tree complexity (number of leaves). The second-order expansion uses both the gradient and the Hessian of the loss, producing Newton-step updates that converge faster than the first-order gradient descent of classic GBM. XGBoost also introduced column subsampling (borrowed from random forests), histogram-based approximate splits, and system-level optimizations (cache-aware block structure, out-of-core computation) that made gradient boosting practical for datasets with millions of rows. LightGBM (Ke et al., 2017) and CatBoost (Prokhorenkova et al., 2018) followed with further algorithmic and engineering innovations, including leaf-wise growth and native categorical feature handling.
In macroeconomics, gradient boosting has become a primary tool for high-dimensional forecasting. Medeiros, Vasconcelos, Veiga, and Zilberman (2021) found that boosted trees outperformed random forests and penalized linear models for Brazilian inflation forecasting with over 100 predictors. The Bank of England uses gradient boosting ensembles in its forecasting toolkit alongside neural networks and Bayesian VARs. Gu, Kelly, and Xiu (2020) showed gradient-boosted trees competitive with deep learning for cross-sectional asset pricing. The IMF uses XGBoost-based models in fiscal surveillance for revenue forecasting across heterogeneous country panels. Central banks in emerging economies have adopted gradient boosting for credit risk scoring and financial stability monitoring, where the sequential error-correction mechanism captures the nonlinear interaction between financial conditions and macroeconomic stress.
Inputs follow the standard supervised learning setup: observations of a target (GDP growth, inflation, recession indicator) and predictor variables (financial indices, labor market indicators, commodity prices, survey expectations, and their lags). Unlike random forests, gradient boosting is sensitive to the scale of the loss function, so practitioners typically difference nonstationary series and may standardize predictors when using custom loss functions. The algorithm handles mixed types natively through tree splits. Missing values are handled by default direction assignments at each split node: during training, the algorithm learns whether observations with missing values for a given feature should go left or right, based on which direction minimizes the loss.
The model is an additive ensemble of regression trees: , where is an initial constant (typically the mean of for squared error loss), is a shallow tree with terminal nodes, and is the learning rate. Each tree is fit not to the response but to the pseudo-residuals . For squared error loss, the pseudo-residuals are simply the ordinary residuals . For other losses (absolute error, quantile, Huber), the pseudo-residuals take different forms, allowing gradient boosting to optimize any differentiable objective. Tree depth controls the interaction order: a tree with leaves can capture at most -way interactions. Typical values are to for macro applications, allowing 3- to 7-way interactions.
Four hyperparameters dominate the bias-variance tradeoff. The learning rate controls how much each tree contributes: smaller values require more trees but produce smoother generalization curves. The number of boosting rounds determines total model complexity; too many rounds lead to overfitting. Tree depth sets the interaction order. The subsampling fraction (row subsampling per round, typically 0.5 to 0.8) introduces stochastic gradient boosting (Friedman, 2002), which acts as additional regularization and speeds up training. XGBoost adds further controls: L2 regularization on leaf weights , L1 regularization , minimum child weight (sum of Hessians in a leaf), and column subsampling per tree or per split. Early stopping on a validation set is the standard method for selecting : training continues until the validation loss has not improved for a specified patience window.
Medeiros, Vasconcelos, Veiga, and Zilberman (2021) conducted a comprehensive forecasting comparison for Brazilian macroeconomic variables using 117 predictors. Gradient-boosted trees with early stopping consistently outperformed random forests, LASSO, and ridge regression for inflation and industrial production at horizons of 1 to 12 months. The key advantage was the sequential error correction: after the first 50 to 100 rounds captured the dominant linear signals (comparable to what ridge or LASSO extracts), additional rounds picked up nonlinear interaction patterns in the residuals that flat ensemble methods like random forests spread across all trees simultaneously. The Bank of England's forecasting toolkit includes XGBoost models for GDP nowcasting, where the algorithm's ability to optimize asymmetric loss functions (quantile loss for downside risk) provides density forecasts that penalized linear models cannot match without distributional assumptions.
In financial economics, Gu, Kelly, and Xiu (2020) tested gradient-boosted trees against neural networks, random forests, and penalized linear models for monthly stock return prediction using 94 firm-level characteristics. Boosted trees ranked among the top methods, with the largest gains over linear models coming from their ability to capture conditional interactions between valuation ratios and momentum signals. The Federal Reserve Bank of Chicago uses gradient boosting in its National Financial Conditions Index construction, where the sequential fitting process naturally downweights redundant financial indicators. Credit risk applications at the ECB and BIS use XGBoost for probability-of-default modeling, where the built-in handling of missing data (common in credit bureau records) and the Hessian-weighted splits (which account for the curvature of the log-likelihood in logistic regression) produce well-calibrated probability estimates.
Gradient boosting should not be used when the analyst lacks a proper validation framework for hyperparameter tuning. Unlike random forests, which perform reasonably with default settings, gradient boosting is sensitive to the joint configuration of learning rate, tree depth, subsampling fraction, and regularization strength. A poorly tuned boosted model can badly overfit or underfit. The method also shares the extrapolation limitation of all tree-based approaches: predictions for feature values outside the training range revert to boundary leaf values. For macro stress testing or scenario analysis involving unprecedented conditions, penalized linear models or Bayesian VARs that can extrapolate trends are preferable. When structural coefficients with standard errors are needed (the slope of the Phillips curve, the fiscal multiplier), gradient boosting provides importance rankings and partial dependence plots but not regression coefficients. See the random forest reference at /models/empirical/random-forest for the parallel ensemble alternative that trades peak accuracy for tuning robustness.
Causal inference extensions of gradient boosting have emerged through the work on causal forests (Athey and Imbens, 2016) and the Bayesian causal forest framework (Hahn, Murray, Carvalho, 2020). While these are more commonly implemented via random forest variants, the gradient boosting sequential-correction principle has been adapted for heterogeneous treatment effect estimation in policy evaluation. Fiscal multiplier heterogeneity across business cycle states, monetary policy transmission differences across credit conditions, and targeted intervention effects in development economics all benefit from the boosting framework's ability to concentrate model capacity on the hardest-to-predict subpopulations.
. The cumulative prediction after boosting rounds, built by additive expansion.
. The negative gradient of the loss with respect to the current prediction. For squared error: .
Scalar in that shrinks each tree's contribution. Smaller values require more trees but improve generalization. Typical range: 0.01 to 0.3.
A shallow regression tree with terminal nodes, fit to the pseudo-residuals at round . Each leaf predicts a constant value (first-order GBM) or an optimized weight using second-order information (XGBoost).
and . XGBoost uses both to compute Newton-step leaf weights and gain-based split criteria.
, where is the number of leaves and is the weight in leaf . Penalizes tree complexity and leaf magnitude.
The loss function must be differentiable with respect to the prediction at each iteration. XGBoost additionally requires second-order differentiability for the Hessian-based split criterion.
If violated: Non-differentiable losses (0/1 loss, rank-based metrics) cannot be optimized directly. Surrogate differentiable losses (logistic, pairwise) are substituted, which may not perfectly align with the target metric.
Each terminal node must contain enough observations for stable mean or weighted-mean estimation. With leaves per tree and observations, the effective per-node sample is approximately .
If violated: Small samples with deep trees produce noisy leaf estimates. The ensemble may overfit rapidly even with low learning rates. Reduce tree depth or increase regularization.
Like all tree-based methods, gradient boosting predictions are bounded by the range of training responses within each terminal node. The ensemble cannot extrapolate beyond the convex hull of the training feature space.
If violated: Forecasts for unprecedented predictor configurations revert to the nearest historical partition. During novel economic regimes (pandemic, hyperinflation), predictions plateau at historical extremes rather than projecting new dynamics.
The conditional distribution must be stable across training and prediction windows. Gradient boosting has no built-in mechanism for structural breaks or time-varying coefficients.
If violated: Post-break predictions reflect pre-break conditional distributions. The model cannot adapt to regime changes unless the regime is encoded as a feature or the training window is restricted to the current regime.
The learning rate and the number of rounds are coupled: smaller requires larger to reach the same effective complexity. The product roughly controls the total shrinkage budget.
If violated: If is too large, the ensemble overfits quickly and early stopping selects too few rounds. If is too small and is capped prematurely, the model underfits. Cross-validated early stopping is essential.
Standard gradient boosting treats observations as exchangeable. Stochastic subsampling at each round draws rows uniformly, ignoring temporal or spatial ordering.
If violated: For time-series data, validation via random holdout leaks future information. Temporal train/validation splits are required for honest early stopping and performance estimation.
The interaction order of the true DGP should be capturable by trees of depth . If the signal involves higher-order interactions than , the ensemble needs disproportionately many rounds to approximate them via additive shallow-tree composition.
If violated: Too-shallow trees (stumps, ) reduce gradient boosting to an additive model that cannot capture interactions. Too-deep trees increase per-tree variance and reduce the benefit of the sequential correction mechanism.
Continue reading
Open the concept, data series, policy setting, or neighboring model that anchors this page.