## _wp1656

## Source details

**Canonical URL:** [_wp1656](https://www.imf.org/-/media/websites/imf/imported-full-text-pdf/external/pubs/ft/wp/2016/_wp1656.pdf)

## Other formats

- [Markdown version](/-/media/websites/imf/imported-full-text-pdf/external/pubs/ft/wp/2016/_wp1656.pdf.md)
- [Structured JSON version](/-/media/websites/imf/imported-full-text-pdf/external/pubs/ft/wp/2016/_wp1656.pdf.json)

---

### I. Introduction
- Macroeconomic analysis in Lebanon is constrained by:
  - Annual national-accounts compilation with publication lag that can sometimes exceed two years.
  - Absence of key macroeconomic data prior to the 1990s, producing relatively short series with numerous structural breaks.
- Common practice and motivation:
  - Use of high-frequency proxy measures and coincident indicators (BdL, IIF, World Bank) to infer real-time activity.
    - BdL coincident indicator: composed of eight variables.
    - IIF coincident indicator: BdL approach plus an additional five variables.
  - Fund staff have estimated real GDP using components of the BdL coincident indicator, sometimes augmented with construction permits, tourist arrivals, car registrations, and property transactions.
  - The paper frames the issue as a nowcasting problem and applies machine-learning techniques (elastic-net regression and Random Forests) to estimate real-time GDP growth for Lebanon.

### II. The Nowcasting Problem: Predicting the Present
- Objective:
  - Extract current GDP signals from a broad set of higher-frequency indicators to provide an “early estimate” before official releases.
- Comparative publication lags:
  - United States/United Kingdom: quarterly GDP published ~one month after quarter end.
  - Euro area: publication lag ~2-3 weeks longer than US/UK.
  - Lebanon: GDP compiled only annually with publication lag of 1-2 years.
- Implication:
  - High-frequency indicators are used to bridge the long lag between economic events and official GDP publication.

### III. Methods: From Causal Inference to Machine Learning
- Methodological considerations:
  - Traditional factor-based models: useful for dimension reduction, may include variables unrelated to GDP and may not optimize predictive power.
  - Need for variable selection in addition to dimension reduction.
  - Machine-learning alternatives highlighted:
    - Penalized regressions (elastic net): combines dimension reduction and variable selection; robust to correlated predictors.
    - Decision-tree approaches (Random Forests): handle nonlinearities and interactions; can sort through many predictors.
  - Distinction:
    - Econometrics: emphasis on explanation and causality.
    - Machine learning: emphasis on prediction and out-of-sample accuracy.
  - Relevance: nowcasting prioritizes predictive accuracy over causal interpretation.

### IV. Elastic Net Regression (regularization approach)
- Motivation:
  - Address instability in coefficient estimates with many correlated regressors (“bouncing beta” problem) via regularization and the bias-variance tradeoff.
- Methods described:
  - Ridge regression: minimizes RSS plus a shrinkage penalty; λ controls penalty; when λ = 0 yields least-squares estimates.
  - LASSO regression: different penalty that can set some coefficients exactly to zero when λ is large, enabling variable selection.
  - Elastic net: hybrid of ridge and LASSO; uses tuning parameter α to weight penalties and λ to control overall shrinkage; combines variable selection with grouping of correlated predictors.
- Cross validation procedure:
  - Choose α and λ, divide data into K folds (example K = 5), train on K−1 folds, test on held-out fold, repeat across folds to produce validation errors and a cross-validation error curve.
  - Select λ to minimize cross-validation error (or the most parsimonious model within one standard deviation of minimum); repeat over α to find best combination.
  - Implementation reference: glmnet package in R (automatic estimation and cross-validation).
- Data and predictors (Elastic Net application to Lebanon):
  - Preferred specification uses quarterly data available from 1996 to 2010.
  - Sample covers mid 2000s boom, Hariri assassination aftermath, and 2006 war; excludes sharp GDP contraction after Arab Spring and Syrian crisis to serve as an out-of-sample test.
  - Candidate predictor variables (monthly data from 1996; total = 19 variables):
    - Tobacco Excises (real)
    - Total Cleared Checks (real)
    - Tourist Arrivals (number)
    - Total Airport Passenger Flows (number)
    - Lending to the Private Sector (real)
    - Cement Deliveries (volumes)
    - Property Taxes (real)
    - Trade flows (imports plus exports, in real terms)
    - Administrative Fees (real)
    - Construction Permits (sq. m)
    - Primary Fiscal Spending (real)
    - M3 (real)
    - Total Non-Resident Deposits (real)
    - Port of Beirut Freight, Incoming (volumes)
    - Electricity Production (volumes)
    - Port of Beirut Freight, Outgoing (volumes)
    - Imports of Petroleum Derivatives (volumes)
    - Imports of Machinery (volumes)
    - Customs Revenue (real)
  - Data handling: nominal volume series deflated by CPI where necessary; regression specified in growth rates.
- Elastic Net model performance:
  - In-sample performance: relatively solid.
  - Out-of-sample performance (2011–13): model tracks GDP contractions relatively well; overestimates growth in 2011 relative to revised official figure but captures broad contraction; predicted growth for 2014 appears plausible.

### V. Random Forests (decision-tree approach)
- Regression tree mechanics:
  - Decision trees partition predictor space via binary splits to reduce prediction error; regression trees approximate continuous outcomes by partitioning into regions R1, R2, ..., RM and modeling y as the average in each region.
  - Trees are grown by recursively choosing splits that minimize deviation from the mean in each partition until a minimum node size is reached.
  - Overfitting and pruning:
    - Fully developed trees often over-fit; pruning and cross-validation are used to improve out-of-sample performance.
- Random Forest modifications:
  - Bootstrap aggregation (“bagging”): each tree built on a random sample (~two thirds of observations); remaining one-third are out-of-bag (OOB) for accuracy assessment; repeat hundreds/thousands of times and average results; trees are unpruned.
  - Random subset of predictors at each split: algorithm considers only a random subset of predictors (usually total number of predictors divided by three) to prevent dominance of highly correlated predictors.
  - Ensemble averaging of many weak, uncorrelated trees reduces variance without increasing bias.
- Random Forest results for Lebanon:
  - Using the same training data as for the elastic net regression, in-sample and out-of-sample performance of the Random Forest are described as solid.
  - Model behavior:
    - RF tracks GDP relatively well over the training sample and follows GDP closely over 2011-13 when output contracted sharply, though it predicts a higher growth rate in 2011 compared to the official figure.
    - Estimated growth for 2014 (no official figure available) is described as plausible.

### VI. Ensemble approach and comparative results
- Ensemble definition and approach:
  - An ensemble is a collection of models whose predictions are combined by weighted averaging or voting.
  - RF is itself an ensemble (combining individual trees).
  - A simple weighted average of the elastic net and Random Forest predictions can be formed; optimal weights can be chosen by cross validation.
- Reported performance metrics and weights:
  - Root MSE: Elastic Net 0.6902, Random Forests 1.1671, Ensemble 0.6892
  - Weight on Elastic Net 0.96
  - Weight on Random Forest 0.04
- Interpretation:
  - Although the elastic net approach is more accurate alone, combining predictions with a small weight on the Random Forest marginally reduces likely prediction error.

### VII. Policy-relevant Conclusions and Takeaways
- Long delays in official GDP publication motivate use of proxy variables and nowcasting techniques.
- Procedures drawn from nowcasting literature and machine learning can produce GDP estimates suited to the challenges of Lebanon’s data.
- Ensemble techniques (combining models) can yield marginal improvements in prediction accuracy even when one model dominates.

### VIII. Annex summaries — Key numerical results
- Elastic Net (Annex 1):
  - Data: 53 observations, 19 predictors
  - Coefficients constrained to be >= 0.
  - Resampling: Cross-Validated (5 fold, repeated 3 times)
    - Summary of sample sizes: 44, 43, 41, 42, 42, 43, ...
  - Resampling results:
    - RMSE 0.681585
    - Rsquared 0.9650695
    - RMSE SD 0.1169505
    - Rsquared SD 0.01393376
  - Tuning parameters:
    - 'alpha' finalized at a value of 0.45
    - 'lambda' finalized at a value of 0.2043761
  - Elastic Net Regression: Final Model Coefficients (as listed):
    - 2.4040.0010.0270.1490.0380.0460.0650.0390.0420.004
  - Note: Standard errors for penalized regression coefficients are not meaningful in the usual way; bootstrap assesses variance but ignores bias.
- Random Forest (Annex 2):
  - Data: 53 observations, 19 predictors
  - Resampling: Cross-Validated (5 fold, repeated 3 times)
    - Summary of sample sizes: 44, 43, 41, 42, 42, 43, ...
  - Resampling results:
    - RMSE 1.145547
    - Rsquared 0.9384356
    - RMSE SD 0.1886561
    - Rsquared SD 0.03571127
  - Tuning parameter:
    - 'mtry' was held constant at default value of 6
  - Increase in Node Purity measures the improvement in RSS attributable to splitting on a particular variable, cumulated over all trees.

*Source: _wp1656 - References (extracted content).*

### References .............................................................................................................

### _wp1656 - References .............................................................................................................

### I. Introduction
- Macroeconomic analysis in Lebanon is constrained by:
  - Annual national-accounts compilation with publication lag that can sometimes exceed two years.
  - Absence of key macroeconomic data prior to the 1990s, producing relatively short series with numerous structural breaks.
- Common practice: use of high-frequency proxy measures and coincident indicators (BdL, IIF, World Bank) to infer real-time activity.
  - BdL coincident indicator: composed of eight variables.
  - IIF coincident indicator: BdL approach plus an additional five variables.
- Fund staff have typically estimated real GDP using components of the BdL coincident indicator, sometimes augmented with construction permits, tourist arrivals, car registrations, and property transactions.
- Paper frames the issue as a nowcasting problem and applies machine-learning techniques (elastic-net regression and Random Forests) to estimate real-time GDP growth for Lebanon.

### II. The Nowcasting Problem: Predicting the Present
- Nowcasting objective: extract current GDP signals from a broad set of higher-frequency indicators to provide an “early estimate” before official releases.
- Comparative publication lags:
  - United States/United Kingdom: quarterly GDP published ~one month after quarter end.
  - Euro area: publication lag ~2-3 weeks longer than US/UK.
  - Lebanon: GDP compiled only annually with publication lag of 1-2 years.
- Visual emphasis: high-frequency indicators versus annual GDP with long lag.

### III. The Culture of Nowcasting: From Causal Inference to Machine Learning
- Traditional approach: factor-based models (extract a small set of unobserved common factors) — good for dimension reduction but may include variables unrelated to GDP and may not optimize predictive power.
- Need for variable selection in addition to dimension reduction.
- Machine-learning alternatives highlighted:
  - Penalized regressions (elastic net): combines dimension reduction and variable selection; robust to correlated predictors.
  - Decision-tree approaches (Random Forests): handle nonlinearities and interactions; can sort through many predictors.
- Methodological distinction:
  - Econometrics: emphasis on explanation and causality; in-sample fit and interpretability.
  - Machine learning: emphasis on prediction and out-of-sample accuracy.
- Relevance: nowcasting prioritizes predictive accuracy over causal interpretation, making machine-learning methods suitable.

### IV. A Regularization Approach: Elastic Net Regression
- Motivation: address instability in coefficient estimates with many correlated regressors (“bouncing beta” problem) via regularization and the bias-variance tradeoff.
- Methods described:
  - Ridge regression: minimizes RSS plus a shrinkage penalty; λ controls penalty; when λ = 0 yields least-squares estimates.
  - LASSO regression: different penalty that can set some coefficients exactly to zero when λ is large, enabling variable selection.
  - Elastic net: hybrid of ridge and LASSO; uses tuning parameter α to weight penalties and λ to control overall shrinkage; combines variable selection with grouping of correlated predictors.
- Cross validation:
  - Procedure: choose α and λ, divide data into K folds (example K = 5), train on K−1 folds, test on held-out fold, repeat across folds to produce validation errors and a cross-validation error curve.
  - Select λ to minimize cross-validation error (or the most parsimonious model within one standard deviation of minimum); repeat over α to find best combination.
  - Implementation reference: glmnet package in R (automatic estimation and cross-validation).

- Elastic Net application to Lebanon:
  - Preferred specification uses quarterly data available from 1996 to 2010.
  - Sample covers mid 2000s boom, Hariri assassination aftermath, and 2006 war; excludes sharp GDP contraction after Arab Spring and Syrian crisis to serve as out-of-sample test.
  - Candidate predictor variables (monthly data from 1996; total = 19 variables):
    - Tobacco Excises (real)
    - Total Cleared Checks (real)
    - Tourist Arrivals (number)
    - Total Airport Passenger Flows (number)
    - Lending to the Private Sector (real)
    - Cement Deliveries (volumes)
    - Property Taxes (real)
    - Trade flows (imports plus exports, in real terms)
    - Administrative Fees (real)
    - Construction Permits (sq. m)
    - Primary Fiscal Spending (real)
    - M3 (real)
    - Total Non-Resident Deposits (real)
    - Port of Beirut Freight, Incoming (volumes)
    - Electricity Production (volumes)
    - Port of Beirut Freight, Outgoing (volumes)
    - Imports of Petroleum Derivatives (volumes)
    - Imports of Machinery (volumes)
    - Customs Revenue (real)
  - Data handling: nominal volume series deflated by CPI where necessary; regression specified in growth rates.
  - Model performance:
    - Coefficient values and cross-validation error curve provided in Annex 1 (not repeated here).
    - In-sample performance: relatively solid.
    - Out-of-sample performance (2011–13): model tracks GDP contractions relatively well; overestimates growth in 2011 relative to revised official figure but captures broad contraction; predicted growth for 2014 appears plausible.

### V. A Decision-Tree Approach: Random Forests
- Decision trees:
  - Intuitive partitioning of predictor space via binary splits (yes/no questions) to reduce prediction error repeatedly.
  - Regression trees provide step-wise nonparametric estimators for continuous outcomes (e.g., GDP).
  - Strengths: computational efficiency, handle nonlinearities, interactions, and missing data; may reveal patterns not evident in linear models.
  - Weakness: single trees can overfit and perform poorly out-of-sample when relationships are linear.
- Random Forests (RF):
  - RF grows numerous unpruned decision trees and aggregates results to reduce overfitting and improve out-of-sample predictive performance.
  - RF thus addresses the instability/overfitting problem of individual trees by ensemble averaging.

*Source: _wp1656 - References (extracted content).*

### Box 1. Regression Trees (continued)

### Box 1. Regression Trees (continued)

### Regression tree definition and growth
- A regression tree is a decision tree designed to approximate a continuous real-valued function (not a yes/no classifier).
- Construction process:
  - Initially, all observations are placed in the same group.
  - The data is allocated into two partitions using every possible split on every available predictor; the chosen predictor/split minimizes the overall deviation from the mean in each partition.
  - The splitting rule is reapplied to each new branch.
  - The process continues until each group reaches a pre-specified minimum size (minimum node size).
  - After splitting, the regression tree calculates the mean value of the outcome variable (y) for each bin.
- The regression tree partitions the predictor set into M regions R1, R2, ..., RM. The response variable (y) is modeled as the average for the region:
  - (Mathematical formulation preserved in source.)

### Overfitting and pruning
- A fully developed tree often suffers from over-fitting: the deeper the tree, the better the in-sample fit, potentially down to a terminal branch for each data point, yielding a “perfect” in-sample fit.
- Over-fitting generally results in poor out-of-sample performance.
- Regression trees are often “pruned” (shortened) to sacrifice in-sample fit in order to improve out-of-sample success.
- Optimal pruning methods draw on cross-validation techniques outlined in the main text.

### Random Forest (RF) modifications and mechanics
- First modification: bootstrap aggregation (“bagging”).
  - An individual tree is built on a random sample of the dataset, roughly two thirds of the total observations—the remaining one-third are referred to as out-of-bag (OOB) observations and can be used to gauge the accuracy of the tree.
  - This is repeated hundreds or thousands of times and the results are averaged.
  - None of the trees is pruned; each individual tree has high variance, but averaging reduces variance without increasing bias.
- Second modification: random subset of predictors at each split.
  - At each split, the algorithm considers only a random subset of the available predictors (usually the total number of predictors divided by three).
  - This randomization prevents bagging from producing many similar trees when predictors are highly correlated or a single predictor is dominant.
  - Each tree is a weak model grown on a deliberately limited dataset; combining many (uncorrelated) weak models yields a stronger aggregate prediction.

### Random Forest results for Lebanon
- Using the same training data as for the elastic net regression, the in-sample and out-of-sample performance of the Random Forest are described as solid.
- Model behavior:
  - The RF model tracks GDP relatively well over the training sample.
  - It follows GDP closely over 2011-13 when output contracted sharply, though it predicts a higher growth rate in 2011 compared to the official figure.
  - Estimated growth for 2014 (no official figure available) is described as plausible.
- Performance comparison (as reported):
  - Root MSE: Elastic Net 0.6902, Random Forests 1.1671, Ensemble 0.6892
  - Weight on Elastic Net 0.96
  - Weight on Random Forest 0.04

### Ensemble approach and results
- An ensemble is a collection of models whose predictions are combined by weighted averaging or voting.
- RF is itself an ensemble (combining individual trees).
- A simple weighted average of the elastic net and Random Forest predictions can be formed; optimal weights can be chosen by cross validation.
- From results reported:
  - Although the elastic net approach is more accurate alone, combining predictions with a small weight on the Random Forest marginally reduces likely prediction error.

### Conclusions (policy-relevant takeaways)
- Long delays in official GDP publication motivate use of proxy variables and nowcasting techniques.
- Procedures drawn from nowcasting literature and machine learning can produce GDP estimates suited to the challenges of Lebanon’s data.
- Ensemble techniques (combining models) can yield marginal improvements in prediction accuracy even when one model dominates.

### Annex summaries — Elastic Net results (Annex 1)
- Data: 53 observations, 19 predictors
- Coefficients constrained to be >= 0.
- Resampling: Cross-Validated (5 fold, repeated 3 times)
  - Summary of sample sizes: 44, 43, 41, 42, 42, 43, ...
- Resampling results:
  - RMSE 0.681585
  - Rsquared 0.9650695
  - RMSE SD 0.1169505
  - Rsquared SD 0.01393376
- Tuning parameters:
  - 'alpha' finalized at a value of 0.45
  - 'lambda' finalized at a value of 0.2043761
- Elastic Net Regression: Final Model Coefficients (as listed):
  - 2.4040.0010.0270.1490.0380.0460.0650.0390.0420.004
- Note: Standard errors for penalized regression coefficients are not meaningful in the usual way; bootstrap assesses variance but ignores bias.

### Annex summaries — Random Forest results (Annex 2)
- Data: 53 observations, 19 predictors
- Resampling: Cross-Validated (5 fold, repeated 3 times)
  - Summary of sample sizes: 44, 43, 41, 42, 42, 43, ...
- Resampling results:
  - RMSE 1.145547
  - Rsquared 0.9384356
  - RMSE SD 0.1886561
  - Rsquared SD 0.03571127
- Tuning parameter:
  - 'mtry' was held constant at default value of 6
- Increase in Node Purity measures the improvement in RSS attributable to splitting on a particular variable, cumulated over all trees.

*Source: _wp1656 - Box 1. Regression Trees (continued)*

---


_Source: https://www.imf.org/-/media/websites/imf/imported-full-text-pdf/external/pubs/ft/wp/2016/_wp1656.pdf_
