## wpiea2021124-print-pdf — Appendix I–V (Machine Learning, Factor Models, Data Dictionary)

## Source details

**Canonical URL:** [wpiea2021124-print-pdf — Appendix I–V (Machine Learning, Factor Models, Data Dictionary)](https://www.imf.org/-/media/files/publications/wp/2021/english/wpiea2021124-print-pdf.pdf)

## Other formats

- [Markdown version](/-/media/files/publications/wp/2021/english/wpiea2021124-print-pdf.pdf.md)
- [Structured JSON version](/-/media/files/publications/wp/2021/english/wpiea2021124-print-pdf.pdf.json)

---

### I. Purpose and scope
- Objective: assess impacts of the COVID-19 pandemic on economic activity in Sub-Saharan Africa (SSA) by (1) sourcing novel and relevant high-frequency time series data with sufficient historical lookback and (2) implementing Machine Learning (ML) and parametric Factor Model (FM) approaches to build enhanced country-level nowcast and forecast models for quarterly GDP that generalize across SSA.
- Country focus: top 9 economies in SSA that comprise 73% of the region’s GDP in 2019: Angola, Cameroon, Côte d’Ivoire (Ivory Coast), Ethiopia, Ghana, Kenya, Nigeria, South Africa, and Uganda.
- Dataset scope cited in the paper:
  - "350 total variables" referenced earlier (including 110 shipping trade variables).
  - "Of the 322 variables we collected for the nine largest economies in SSA" (breakdown by frequency and category provided).

### II. Data inventory and key statistics
- Total variables and frequency breakdown (Table 1):
  - Total by Frequency: 99 (Daily), 7 (Weekly), 185 (Monthly), 20 (Quarterly), 11 (Annual) — Total: 322.
- Example country totals:
  - South Africa: 12 (Daily), 2 (Weekly), 21 (Monthly), 6 (Quarterly), 1 (Annual) — Total: 42.
  - Kenya: 11 (Daily), 0 (Weekly), 49 (Monthly), 2 (Quarterly), 1 (Annual) — Total: 63.
  - Nigeria: 11 (Daily), 2 (Weekly), 17 (Monthly), 3 (Quarterly), 1 (Annual) — Total: 34.
- Variable category counts (selected):
  - Shipping: 111
  - Trade: 36
  - Google Search Trends: 34
  - Financial Market: 25
  - Mobile payments: 12
  - Payment card transactions: 12
  - Manufacturing: 11
  - Debt: 10
  - Interest Rate: 9
  - GDP: 8
  - Inflation Rate: 8
  - Business Confidence: 5
  - Total: 322
- Google Trends examples:
  - Kenya search terms: "pesa, chapaa, mullah, cheddar, dough, kazi" — Local mobile payments vendor(s): "MPESA, m-pesa, airtime, MTN".
  - South Africa search terms: "money, job, employment, mobile money, airtime" — Local mobile payments vendor(s): "ewallet, money counter".
  - Angola: "None identified" for search terms and mobile payments vendor(s).
- Quarterly GDP handling:
  - GDP transformed to year-over-year percentage change for seasonality adjustment; GDP data availability varies (Ethiopia quarterly GDP data not available). Sample start years vary (e.g., South Africa pre-2000 start; Uganda 2013 start).

### III. Machine Learning (ML) approach — methods and implementation
- ML objectives:
  - Integrate mixed-frequency data (daily, weekly, monthly, quarterly), include alternative high-frequency sources (Google Trends, mobile payments, shipping), and produce nowcast predictions that update as new partial information arrives.
- ML models tested:
  - Elastic net
  - Support Vector Regression (SVR)
  - Random Forest
  - XGBoost
  - Voting Regression (ensemble of the four above)
- Feature engineering and frequency handling:
  - Cross-frequency skip-sampling (MIDAS-inspired): monthly variables skip-sampled into three quarterly series; daily/weekly aggregated to bi-weekly then skip-sampled.
  - All level variables transformed to YoY % change for ML regression models.
  - Parameter tuning via grid search with cross-validation (scikit-learn).
  - Inclusion of autoregressive components and lagged variables where applicable.
- ML training timeframes and predictor counts (Table 3):
  - South Africa: Timeframe 2007/03/31 – 2019/12/31; # Predictors 74; # Observations 51. Notes: "Includes one autoregressive component, lagged variables, and variables for other countries highly correlated with ZAF GDP"
  - Kenya: Timeframe 2011/03/31 – 2019/12/31; # Predictors 142; # Observations 35. Notes: "Includes two autoregressive components"
  - Nigeria: Timeframe 2011/03/31 – 2019/12/31; # Predictors 51; # Observations 35. Notes: "Includes one autoregressive component"
- ML data transformation specifics:
  - South Africa: GDP level, vehicle sales, bankruptcies, exports, imports transformed to YoY % change.
  - Nigeria: GDP level, exports, imports transformed to YoY % change.
  - Kenya: GDP level, cheques EFTs values, foreign trade summary data, transactions data, non-growth variables in mobile payments data, exports, imports transformed to YoY % change.
- Key ML findings:
  - Linear models (Elastic Net, SVR) generally perform better when predicting recessions.
  - Tree-based models (Random Forest, XGBoost) outperform in non-recessionary periods.
  - Cross-validation and rolling window tests show a high level of prediction accuracy for Nigeria and South Africa relative to Kenya.
  - No indication of a systematic bias for the three ML countries (South Africa, Kenya, Nigeria).
  - Alternative data sources, including mobile payments (available monthly only for Kenya) and Google Search Trends, were relevant and key predictors of GDP.
  - Further refinement (feature engineering, RNN/LSTM, etc.) may improve prediction accuracy.

### IV. ML nowcast setup, evaluation metrics, and selected numeric results
- Nowcast setup:
  - ML models applied to South Africa, Kenya, and Nigeria to nowcast quarterly GDP YoY % change.
  - Each nowcast is an end-quarter nowcast using all data available for that quarter.
- Train/test periods (Table 5):
  - South Africa: Train 2007Q2 – 2017Q2; Test 2017Q3 – 2019Q4
  - Kenya: Train 2011Q3 – 2017Q4; Test 2018Q1 – 2019Q3
  - Nigeria: Train 2011Q2 – 2018Q1; Test 2018Q2 – 2019Q4
- Evaluation metrics:
  - Rolling Score: sliding window with S_W = total observations / 4 and averaging RMSEs across 3 iterations.
  - Recession Score: RMSE when testing on recession periods after training on non-recessionary data. Recession periods:
    - South Africa: Q2 2008 through Q2 2010 and Q1 2015 through Q2 2017
    - Kenya: Q4 2016 through Q4 2017
    - Nigeria: Q3 2015 through Q1 2017
  - Cross Validation Score: standard 5 k-fold RMSE average.
- Selected ML prediction comparisons (Table 6 — YoY percent change):
  - South Africa Q4 2019 Actual: -0.57%
    - Elastic net: 0.33% (+90bp)
    - SVR: 0.13% (+70bp)
    - Random Forest: -0.3% (+27bp)
    - XGBoost: -0.18% (+39bp)
    - Voting: -0.07% (+50bp)
  - Nigeria Q4 2019 Actual: 2.37%
    - Elastic net: 1.92% (-45bp)
    - SVR: 1.60% (-77bp)
    - Random Forest: 2.29% (-8bp)
    - XGBoost: 2.37% (-)
    - Voting: 2.04% (-33bp)
- QoQ predictions (Table 7 — selected):
  - South Africa Q4 2019 Actual: -0.36
    - Elastic net: -0.05% (+31bp)
    - SVR: 0.24% (+60bp)
    - Random Forest: -0.09% (+27bp)
    - XGBoost: -0.36% (+0bp)
    - Voting: -0.03% (+33bp)
  - Nigeria Q4 2019 Actual: 1.02
    - Elastic net: 0.50% (-52bp)
    - SVR: 0.50% (-52bp)
    - Random Forest: 0.92% (-10bp)
    - XGBoost: 1.01% (-1bp)
    - Voting: 0.73% (-29bp)
- ML test-period RMSEs (Tables 10–12 — selected):
  - South Africa:
    - ElasticNet: 1.57 / 1.65 / 1.11
    - SVR: 1.39 / 1.54 / 1.19
    - Random Forest: 0.96 / 1.98 / 1.10
    - XGBoost: 1.24 / 1.63 / 1.03
    - Voting Regression: 1.06 / 1.63 / 0.97
    - Baseline OLS: 1.03 / N/A / 2.79
  - Kenya:
    - ElasticNet: 1.13 / 1.04 / 1.44
    - SVR: 1.01 / 0.85 / 1.08
    - Random Forest: 0.67 / 0.89 / 0.82
    - XGBoost: 0.84 / 0.75 / 0.80
    - Voting Regression: 0.75 / 0.86 / 0.97
    - Baseline OLS: 2.66 / 4.37 / 2.97
  - Nigeria:
    - ElasticNet: 1.10 / 1.37 / 0.83
    - SVR: 0.92 / 1.13 / 1.02
    - Random Forest: 0.77 / 1.24 / 0.79
    - XGBoost: 0.87 / 1.06 / 0.96
    - Voting Regression: 0.84 / 1.18 / 0.79
    - Baseline OLS: 2.00 / 1.97 / 2.71
- ML model insights:
  - Tree-based models tended to perform better in non-recessionary periods; linear models performed better in recessions.
  - Best-performing ML models by country:
    - South Africa: SVR, Voting Regression
    - Kenya: Elastic Net, Random Forest
    - Nigeria: Random Forest, XGBoost
  - ML models generally outperformed the OLS baseline on most evaluation metrics.

### V. Parametric Factor Model (FM) approach — methods and implementation
- FM variants:
  - Predictive three-pass regression filter factor models (Uganda, Kenya, Ghana).
  - Kalman filter-based high-frequency economic activity indicator (preliminary) for South Africa (daily).
- Parametric factor model timeframes and counts (Table 4):
  - Predictive Factor Models (Monthly):
    - Uganda: Timeframe 2010/10/01 – 2020/03/31; # Predictors 14; # Time Observations 81 months
    - Kenya: Timeframe 2015/01/01 – 2020/03/31; # Predictors 6; # Time Observations 63 months
    - Ghana: Timeframe 2010/01/01 – 2020/03/31; # Predictors 6; # Time Observations 123 months
  - Kalman Filtration Factor Model (Daily Economic Activity Indicator) – Preliminary:
    - South Africa: Timeframe 2006/06/05 – 2020/04/15; # Predictors 3; # Time Observations 3,618 days
  - Note: "Predictor count does not include the country GDP variable. See Appendix II for full variable list."
- Three-Pass Regression Filter (methodological steps):
  - Pass 1: n simple linear time-series regressions of each predictor on quarterly GDP (XQ matrix) to obtain slope coefficients (initialization of latent factor).
  - Pass 2: τ cross-sectional monthly regressions (XM matrix rows) on Pass 1 coefficients (intercept suppressed) to extract monthly latent factor series F.
  - Pass 3: apply U-MIDAS to predict quarterly GDP as linear combination of monthly latent factors; include AR(1) error term and re-run U-MIDAS with lagged residuals to improve training.
- Data handling:
  - Monthly aggregation of higher-frequency variables where highest frequency is monthly; daily variables aggregated to monthly for these models.
  - All data transformed to YoY percent change with a log-ratio approximation.
  - Autocorrelation diagnostics: Uganda and Kenya models show no evidence of residual autocorrelation; Ghana required Pass 3(b) adjustment to mitigate partial autocorrelation.
- FM findings:
  - Three-pass regression factor models for Uganda, Kenya, and Ghana have a high level of prediction accuracy.
  - For Kenya, FM prediction performance was higher than the ML methods tested.
  - Factor models promising for countries with limited data availability or shorter timeframes.

### VI. Kalman filter daily-factor model (South Africa) — setup and diagnostics
- Data inputs and model formulation:
  - Observed series: daily JSE share price, monthly vehicle sales, quarterly real GDP. Variables entered as level quantities (not growth rates).
  - Low-frequency variables treated as observed at end of their periods. Weekly variables excluded due to too few observations.
  - Latent daily factor x_t linearly related to the three observed series via a Kalman filter. Linear coefficients assumed static; observed-series residuals assumed AR(1); latent factor assumed AR(1) with standard Normal errors.
  - Time indexing assumptions: assume 30 days in each month and 92 days in each fiscal quarter for summing the daily factor.
  - Missingness: days without observations coded as NA so the Kalman filter handles mixed frequencies automatically.
- Kalman filter parameters and estimation:
  - Ten parameters to optimize:
    - Three linear coefficients (factor → observed series)
    - Three AR(1) parameters for residuals
    - Three AR(1) variance parameters for residuals
    - One AR(1) parameter for the factor process
  - Optimization via maximum likelihood using Kalman filter log-likelihoods.
  - Sample period with at least one observed data point: 3,618 days (June 5, 2006 to April 15, 2020).
  - Initialization and tuning:
    - Initialize on JSE-only daily factor model to obtain priors for 훽1, ρ, 훾1, and σ1 2.
    - Obtain 훽2 and 훽3 via linear regressions of vehicle sales and GDP on smoothed factor means.
    - Fit residuals of those regressions to AR(1) to obtain remaining 훾 and σ2 estimates.
    - Final full-model optimization re-runs Kalman filter with all three variables and re-optimizes all ten parameters using 25 iterations of the BFGS algorithm.
  - Reported optimization runtime for RStudio implementation: approximately four hours.
- Diagnostic notes and recommendations:
  - Daily latent factor results for South Africa labeled preliminary due to limited variables and volatility in daily stock market data.
  - Recommended improvements:
    - Transform variables to growth rates to achieve relative stationarity.
    - Aggregate high-frequency data into weekly or monthly intervals to reduce runtime.
    - Include additional high-frequency variables to improve explanatory power.

### VII. Parametric factor model predictions and numeric highlights
- Estimation and test periods (Table 8):
  - Uganda: Estimation 2013Q3 – 2018Q4; Test 2019Q1 – 2019Q4
  - Kenya: Estimation 2015Q1 – 2018Q2; Test 2018Q3 – 2019Q3
  - Ghana: Estimation 2010Q1 – 2017Q4; Test 2018Q1 – 2019Q3
- Selected factor-model predictions vs. ARMA baseline (Tables 13–15):
  - Uganda Q4 2019 Actual: 5.43%
    - ARMA(1,1) Predicted Q4 2019: 4.72% (95% Confidence Interval: –1.48%, 10.93%), Q1 2020: 4.96% (95% CI: –1.48%, 11.41%), Baseline RMSE: 1.14pp
    - Three-Pass Regression Predicted Q4 2019: 3.41% (95% CI: –0.02%, 7.00%), Q1 2020: 5.71% (95% CI: 3.07%, 8.35%), Parametric RMSE: 1.27pp
  - Kenya Q4 2019 Actual: N/A
    - ARMA(1,1) Predicted Q4 2019: 5.46% (95% CI: 4.36%, 6.56%), Q1 2020: 5.48% (95% CI: 4.37%, 6.58%), Baseline RMSE: 0.47pp
    - Three-Pass Regression Predicted Q4 2019: 5.17% (95% CI: 4.97%, 5.37%), Q1 2020: 5.81% (95% CI: 5.61%, 6.01%), Parametric RMSE: 0.21pp
  - Ghana Q4 2019 Actual: N/A
    - ARMA(1,1) Predicted Q4 2019: 6.40% (95% CI: 0.36%, 12.44%), Q1 2020: 6.49% (95% CI: 0.03%, 12.94%), Baseline RMSE: 0.55pp
    - Three-Pass Regression Predicted Q4 2019: 5.57% (95% CI: 3.70%, 7.44%), Q1 2020: 5.95% (95% CI: 4.50%, 7.40%), Parametric RMSE: 0.97pp
- FM evaluation insights:
  - Three-pass regression factor models show promising prediction accuracy given data limitations; improved performance where more recent data availability exists.
  - Baseline ARMA models often have low RMSE due to persistence and decreased volatility of GDP growth over time, but are less useful during crisis periods when persistence is not appropriate.

### VIII. Variable importance and data priorities
- ML variable importance (top variables per country — selected highlights):
  - South Africa (Random Forest / XGBoost): Autoregression 1 (q1); multiple USDZAR Spot Exchange Rate daily series (d1–d6); South Africa exports/imports (m1–m3); Industrial Production (m1–m3); Google Search Trends terms: “money”, “mobile money”, “ewallet”; retail/credit indicators.
  - Nigeria (Random Forest / XGBoost): USDNGN Spot Exchange Rate daily series (d1–d6); Nigeria Business Confidence (m3); Nigeria Inflation (m1, m3); bank-specific daily series (ACCESS BANK PLC, ZENITH BANK PLC); Google Search Trends terms: “cash”, “737”, “ego”.
  - Kenya (Random Forest / XGBoost): mobile payments and payments-system variables (Number of Transactions POS Machines, Payments Volume growth MoM, Accounts in millions, Transactions per account); Inflation (m1); Interbank Rate (m1); trade variables.
- Factor model coefficients (selected highlights):
  - Uganda: Money Supply M3 monthly coefficient: 0.594 (Std. Error 0.133), P-value <0.001; Wholesale index coefficient -1.26 (0.362), P-value 0.002; Private Sector Credit (USh monthly) coefficient 13.348 (7.037), P-value 0.074.
  - Kenya: Inflation monthly coefficient -45.996 (11.502), P-value 0.001; exports and imports ship metrics with large negative coefficients and statistically significant p-values.
  - Ghana: Interest Rate monthly coefficient -2.676 (0.622), P-value <0.001; selected equity and spot rate daily series with varying significance.
- Data sourcing methods (Appendix IV):
  1. API: Google Trends via pytrends; financial and macro variables from Bloomberg Excel API (PX-LAST).
  2. Online databases: Trading Economics cited original sources.
  3. Country-specific websites: e.g., Kenya mobile payments and payment card data via CSV downloads.
  4. IMF Provided: Shipping and trade variables provided by IMF colleagues.
- Data aggregation notes:
  - Daily and weekly variables aggregated into a bi-weekly average frequency first for ML skip-sampling.
  - For Factor Models, aggregation into monthly/quarterly depends on variable being stock (average) or flow (sum).

### IX. Practical implications and methodological recommendations
- Model selection guidance:
  - Use ML ensembles where richer high-frequency datasets and larger observation counts exist (e.g., South Africa, Nigeria); expect linear models to better capture recessions and tree-based models to excel in expansions.
  - Use parametric factor models (three-pass regression filter) for countries with sparser data or shorter time horizons (e.g., Uganda, Ghana); FM may outperform ML in such circumstances.
- Operational features:
  - Skip-sampling (MIDAS-like) enables continuous nowcast updates as partial data arrives.
  - YoY % change transformations help bound level variables and mitigate seasonality; QoQ alternatives could be explored but add operational complexity.
- Data priorities:
  - Expand alternative high-frequency sources (shipping AIS-based measures, mobile payments, Google Trends) where available; mobile payments data were only publicly available monthly for Kenya in this study.
  - Ensure sufficient overlap of predictor lookback horizons with GDP time series to avoid missing rows in Pass 2 of three-pass FM implementation.
- Suggested further work:
  - Refine ML feature engineering and iterate on RNN/LSTM models for time-series prediction.
  - Explore seasonality-adjusted QoQ transformations to compare nowcast efficiency against YoY transformations.
  - Investigate heteroskedasticity-correction methods when omitting volatile historical periods (e.g., Uganda 2008–10 omitted in estimation due to different variance).
  - Compare nowcast methods to benchmarks such as Bayesian vector autoregressions with shrinkage and investigate imputation methods (mean/mode, k nearest neighbor) to improve three-pass regression performance.
  - Produce additional visualizations for policymakers: density nowcasts, predictive distributions, decomposition of data-category contributions.

### X. Appendix V — Full Data Dictionary (selected entries and scope)
- Scope: Table 25 lists variables across countries and regional aggregates. Categories include Shipping, Business Confidence, GDP, Manufacturing, Money Supply, Trade, Debt, Financial Market, Google Search Trends, Air Quality, Inflation Rate, Interest Rate, Mobile payments, Payment card transactions, Oil / Gas, Commodity Prices, Leading Economic Index, Retail / Sales, Unemployment Rate, Bank Deposits, Private Credit, Business Tendency Indicator, and others.
- Frequency types: Daily, Weekly, Monthly, Quarterly, Annual.
- Selected variable metadata examples (exact timeframes and sources preserved):
  - Angola ago_berthvisits_w — Weekly — 2016/4 - 2020/4 — Bloomberg Terminal
  - Angola ago_gdp_q — Quarterly — 2010/3 - 2019/12 — IMF Angola Team
  - Cameroon cmr_ggldo_m — Monthly — 2010/7 - 2019/10 — Google Trends
  - Ghana gha_gdp_q — Quarterly — 2006/3 - 2019/9 — IMF - Haver
  - Kenya ken_gdp_q — Quarterly — 2009/3 - 2019/9 — IMF - Haver
  - Kenya ken_mpaccounts_m — Monthly — 2007/3 - 2020/1 — Kenya Central Bank
  - Nigeria nga_gdp_q — Quarterly — 2010/3 - 2019/12 — IMF - Haver
  - South Africa zaf_gdp_q — Quarterly — 1990/3 - 2019/12 — IMF - Haver
  - Uganda uga_gdp_q — Quarterly — 2008/9 - 2019/9 — IMF - Haver
- Appendix I country ML variable lists (selected variables preserved verbatim):
  - South Africa: zaf_equitysbk_d, zaf_gglmon_m, zaf_indpro_m, zaf_inflat_m, zaf_spotrate_d, zaf_vehic_m, etc.
  - Nigeria: nga_equityaccess_d, nga_equityzen_d, nga_spotrate_d, nga_ggleg_m, nga_inflat_m, etc.
  - Kenya: ken_eftscredval_m, ken_spotrate_d, ken_mpaccounts_m, ken_mptxns_m, ken_inflat_m, ken_nexport_m, etc.
- Appendix I figures referenced for variable-importance and diagnostics (Figure numbers preserved in source).

*Source: wpiea2021124-print-pdf — Appendix I–V (Machine Learning Model Supplemental Materials; Factor Model Supplemental Materials; Supplemental Visualizations; Data sourcing and aggregation notes; Full Data Dictionary Variable List)*

### Appendix I. Machine Learning Model Supplemental Materials 32

### Appendix I. Machine Learning Model Supplemental Materials 32

### Appendix II. Factor Model Supplemental Materials 38
- Appendix II. Factor Model Supplemental Materials 38

### Appendix III. Supplemental Visualizations 43
- Appendix III. Supplemental Visualizations 43

### Appendix IV. Data sourcing and aggregation notes 45
- Appendix IV. Data sourcing and aggregation notes 45

*Source: wpiea2021124-print-pdf - Appendix I. Machine Learning Model Supplemental Materials 32*

### Appendix V. Full Data Dictionary Variable List 46

### Appendix V. Full Data Dictionary Variable List 46

### I. Purpose and scope
- Objective: assess impacts of the COVID-19 pandemic on economic activity in Sub-Saharan Africa (SSA) by (1) sourcing novel and relevant high-frequency time series data with sufficient historical lookback and (2) implementing Machine Learning (ML) and parametric Factor Model (FM) approaches to build enhanced country-level nowcast and forecast models for quarterly GDP that generalize across SSA.
- Country focus: top 9 economies in SSA that comprise 73% of the region’s GDP in 2019: Angola, Cameroon, Côte d’Ivoire (Ivory Coast), Ethiopia, Ghana, Kenya, Nigeria, South Africa, and Uganda.
- Dataset scope cited in the paper:
  - "350 total variables" referenced earlier (including 110 shipping trade variables).
  - "Of the 322 variables we collected for the nine largest economies in SSA" (breakdown by frequency and category provided).

### II. Data inventory and key statistics
- Total variables and frequency breakdown (as reported in Table 1):
  - Total by Frequency: 99 (Daily), 7 (Weekly), 185 (Monthly), 20 (Quarterly), 11 (Annual) — Total: 322.
  - Example country totals:
    - South Africa: 12 (Daily), 2 (Weekly), 21 (Monthly), 6 (Quarterly), 1 (Annual) — Total: 42.
    - Kenya: 11 (Daily), 0 (Weekly), 49 (Monthly), 2 (Quarterly), 1 (Annual) — Total: 63.
    - Nigeria: 11 (Daily), 2 (Weekly), 17 (Monthly), 3 (Quarterly), 1 (Annual) — Total: 34.
- Variable category counts (selected from data dictionary):
  - Shipping: 111
  - Trade: 36
  - Google Search Trends: 34
  - Financial Market: 25
  - Mobile payments: 12
  - Payment card transactions: 12
  - Manufacturing: 11
  - Debt: 10
  - Interest Rate: 9
  - GDP: 8
  - Inflation Rate: 8
  - Business Confidence: 5
  - Total: 322
- Google Trends search terms were collected by country (Table 2); examples:
  - Kenya search terms: "pesa, chapaa, mullah, cheddar, dough, kazi" — Local mobile payments vendor(s): "MPESA, m-pesa, airtime, MTN".
  - South Africa search terms: "money, job, employment, mobile money, airtime" — Local mobile payments vendor(s): "ewallet, money counter".
  - Angola: "None identified" for search terms and mobile payments vendor(s).
- Quarterly GDP data: transformed to year-over-year percentage change for seasonality adjustment; GDP data availability varies (Ethiopia quarterly GDP data not available). Timeframes vary across countries (e.g., pre-2000 start for South Africa; 2013 start for Uganda).

### III. Machine Learning (ML) approach — methods and implementation
- ML objectives: integrate mixed-frequency data (daily, weekly, monthly, quarterly), include alternative high-frequency sources (Google Trends, mobile payments, shipping), and produce nowcast predictions that update as new partial information arrives.
- ML models tested:
  - Elastic net
  - Support Vector Regression (SVR)
  - Random Forest
  - XGBoost
  - Voting Regression (ensemble of the four above)
- Model features and implementation points:
  - Cross-frequency skip-sampling (MIDAS-inspired) used to handle mixed-frequency variables: monthly variables skip-sampled into three quarterly series; daily/weekly aggregated to bi-weekly then skip-sampled.
  - All level variables transformed to YoY % change for ML regression models.
  - Parameter tuning via grid search with cross-validation (scikit-learn cross-validation).
  - Inclusion of autoregressive components and lagged variables where applicable.
- ML training timeframes and predictor counts (Table 3 — preserved exactly):
  - South Africa: Timeframe 2007/03/31 – 2019/12/31; # Predictors 74; # Observations 51. Notes: "Includes one autoregressive component, lagged variables, and variables for other countries highly correlated with ZAF GDP"
  - Kenya: Timeframe 2011/03/31 – 2019/12/31; # Predictors 142; # Observations 35. Notes: "Includes two autoregressive components"
  - Nigeria: Timeframe 2011/03/31 – 2019/12/31; # Predictors 51; # Observations 35. Notes: "Includes one autoregressive component"
- ML data transformation specifics (A.3):
  - South Africa: GDP level, vehicle sales, bankruptcies, exports, imports transformed to YoY % change.
  - Nigeria: GDP level, exports, imports transformed to YoY % change.
  - Kenya: GDP level, cheques EFTs values, foreign trade summary data, transactions data, non-growth variables in mobile payments data, exports, imports transformed to YoY % change.
- Key ML findings:
  - Linear models (Elastic Net, SVR) generally perform better when predicting recessions.
  - Tree-based models (Random Forest, XGBoost) outperform in non-recessionary periods.
  - Cross-validation and rolling window tests show a high level of prediction accuracy for Nigeria and South Africa relative to Kenya.
  - No indication of a systematic bias for the three ML countries (South Africa, Kenya, Nigeria).
  - Alternative data sources, including mobile payments (available monthly only for Kenya) and Google Search Trends, were relevant and key predictors of GDP.
  - Further refinement (feature engineering, RNN/LSTM, etc.) may improve prediction accuracy.

### IV. Parametric Factor Model (FM) approach — methods and implementation
- Two FM variants implemented:
  - Predictive three-pass regression filter factor models (for Uganda, Kenya, Ghana).
  - Kalman filter-based high-frequency economic activity indicator (preliminary) for South Africa (daily).
- Parametric factor model timeframes and counts (Table 4 — preserved exactly):
  - Predictive Factor Models (Monthly):
    - Uganda: Timeframe 2010/10/01 – 2020/03/31; # Predictors 14; # Time Observations 81 months
    - Kenya: Timeframe 2015/01/01 – 2020/03/31; # Predictors 6; # Time Observations 63 months
    - Ghana: Timeframe 2010/01/01 – 2020/03/31; # Predictors 6; # Time Observations 123 months
  - Kalman Filtration Factor Model (Daily Economic Activity Indicator) – Preliminary:
    - South Africa: Timeframe 2006/06/05 – 2020/04/15; # Predictors 3; # Time Observations 3,618 days
  - Note: "Predictor count does not include the country GDP variable. See Appendix II for full variable list."
- Three-Pass Regression Filter (B.1) — methodological highlights:
  - Pass 1: run n simple linear time-series regressions of each predictor on quarterly GDP (XQ matrix) to obtain slope coefficients (initialization of latent factor).
  - Pass 2: run τ cross-sectional monthly regressions (XM matrix rows) on Pass 1 coefficients (intercept suppressed) to extract monthly latent factor series F.
  - Pass 3: apply U-MIDAS to predict quarterly GDP as linear combination of monthly latent factors; include AR(1) error term and re-run U-MIDAS with lagged residuals to improve training.
  - Data used: monthly aggregation of higher-frequency variables where highest frequency is monthly; daily variables aggregated to monthly for these models.
- Data transformations and diagnostics:
  - All data transformed to YoY percent change with a log-ratio approximation.
  - Autocorrelation and partial autocorrelation checks performed; Uganda and Kenya models show no evidence of residual autocorrelation; Ghana required Pass 3(b) adjustment to mitigate partial autocorrelation.
- FM findings:
  - Three-pass regression factor models for Uganda, Kenya, and Ghana have a high level of prediction accuracy.
  - For Kenya, FM prediction performance was higher than the ML methods tested.
  - Factor models promising for countries with limited data availability or shorter timeframes.

### V. Practical implications and methodological recommendations
- Model selection guidance:
  - Use ML models (with mixed-model ensembles) where richer high-frequency datasets and larger observation counts exist (e.g., South Africa, Nigeria); expect linear models to better capture recessions and tree-based models to excel in expansions.
  - Use parametric factor models (three-pass regression filter) for countries with sparser data or shorter time horizons (e.g., Uganda, Ghana); FM may outperform ML in such circumstances.
- Operational features:
  - The skip-sampling (MIDAS-like) approach enables continuous nowcast updates as partial data arrives, removing the need to wait until month or quarter end.
  - YoY % change transformations help bound level variables and mitigate seasonality; QoQ alternatives could be explored but add operational complexity.
- Data priorities:
  - Expand alternative high-frequency sources (shipping AIS-based measures, mobile payments, Google Trends) where available; mobile payments data were only publicly available monthly for Kenya in this study.
  - Ensure sufficient overlap of predictor lookback horizons with GDP time series to avoid missing rows in Pass 2 of three-pass FM implementation.
- Suggested further work:
  - Refine ML feature engineering and iterate on additional models better suited for time-series predictions (e.g., RNN, LSTM).
  - Explore seasonality-adjusted QoQ transformations to compare nowcast efficiency against YoY transformations.
  - Investigate heteroskedasticity-correction methods when omitting volatile historical periods (e.g., Uganda 2008–10 omitted in estimation due to different variance).

*Source: Appendix V. Full Data Dictionary Variable List 46 — wpiea2021124-print-pdf*

### 1. Daily share price of the Johannesburg Stock Exchange (JSE: JSE) in local currency (ZAR),

### Daily share price of the Johannesburg Stock Exchange (JSE: JSE) in local currency (ZAR)

### Dataset 1 — JSE daily share price
- Variable: Daily share price of the Johannesburg Stock Exchange (JSE: JSE) in local currency (ZAR)
- Start date: beginning on June 5, 2006

### Dataset 2 — Monthly vehicle sales
- Variable: Monthly number of total vehicle sales
- Start date: beginning in January 1994

*Source: wpiea2021124-print-pdf - 1. Daily share price of the Johannesburg Stock Exchange (JSE: JSE) in local currency (ZAR), canonical source URL: https://www.imf.org/-/media/files/publications/wp/2021/english/wpiea2021124-print-pdf.pdf*

### 3. Quarterly real GDP (in ZAR millions), beginning in Q1 1990

### 3. Quarterly real GDP (in ZAR millions), beginning in Q1 1990

### Data inputs and model formulation
- Three observed series for South Africa: daily JSE share price, monthly vehicle sales, quarterly real GDP. Variables entered model as level quantities (not growth rates).
- Low-frequency variables treated as observed at end of their periods (vehicle sales on last business day of month; quarterly GDP on last business day of fiscal quarter).
- Weekly variables excluded due to too few observations.
- Latent daily factor x_t proxies real economic activity and is linearly related to the three observed series via a Kalman filter. Linear coefficients assumed static; observed-series residuals assumed AR(1); latent factor assumed AR(1) with standard Normal errors.
- Time indexing and aggregation assumptions: t indexes days; assume 30 days in each month and 92 days in each fiscal quarter for summing the daily factor.
- Missingness handling: days without observations coded as NA so the Kalman filter handles mixed frequencies automatically.

### Kalman filter parameters and estimation
- Ten parameters to optimize:
  - Three linear coefficients (factor → observed series)
  - Three AR(1) parameters for residuals
  - Three AR(1) variance parameters for residuals
  - One AR(1) parameter for the factor process
- Optimization via maximum likelihood using Kalman filter log-likelihoods.
- Sample period with at least one observed data point: 3,618 days (June 5, 2006 to April 15, 2020).
- Initialization and tuning procedure (following Aruoba et al. (2009)):
  - Initialize on JSE-only daily factor model to obtain priors for 훽1, ρ, 훾1, and σ1 2.
  - Obtain 훽2 and 훽3 via linear regressions of vehicle sales and GDP on smoothed factor means.
  - Fit residuals of those regressions to AR(1) to obtain remaining 훾 and σ2 estimates.
  - Final full-model optimization re-runs Kalman filter with all three variables and re-optimizes all ten parameters using 25 iterations of the BFGS algorithm.
- Reported optimization runtime for RStudio implementation: approximately four hours.

### Kalman filter diagnostic notes and recommended improvements
- Daily latent factor results for South Africa labeled preliminary due to limited variables and volatility in daily stock market data.
- Specific observations:
  - Daily stock market data for South Africa begins in 2006, much shorter than series used in Aruoba et al. (2009), making initialization more difficult.
  - High volatility of daily series may have hindered initialization and detection of relationships.
- Recommended changes for next iteration to improve fit and runtime:
  - Transform variables to growth rates to achieve relative stationarity.
  - Aggregate high-frequency data into weekly or monthly intervals to reduce runtime of a single filtration.
  - Include additional variables (particularly high-frequency variables) to improve explanatory power of the factor.

### Machine Learning (ML) model nowcasts — setup and evaluation
- ML models applied to South Africa, Kenya, and Nigeria to nowcast quarterly GDP YoY % change.
- Each nowcast is an end-quarter nowcast using all data available for that quarter.
- Train/test periods (Table 5):
  - South Africa: Train 2007Q2 – 2017Q2; Test 2017Q3 – 2019Q4
  - Kenya: Train 2011Q3 – 2017Q4; Test 2018Q1 – 2019Q3
  - Nigeria: Train 2011Q2 – 2018Q1; Test 2018Q2 – 2019Q4
- Evaluation metrics used:
  - Rolling Score: sliding window approach with S_W = total observations / 4 and averaging RMSEs across 3 iterations.
  - Recession Score: RMSE when testing on recession periods after training on non-recessionary data. Recession periods:
    - South Africa: Q2 2008 through Q2 2010 and Q1 2015 through Q2 2017
    - Kenya: Q4 2016 through Q4 2017
    - Nigeria: Q3 2015 through Q1 2017
  - Cross Validation Score: standard 5 k-fold RMSE average.
- ML models evaluated: Elastic Net, SVR, Random Forest, XGBoost, Voting Regression. Baseline OLS also reported.

### ML model prediction highlights and selected numeric results
- Comparison of ML predictions with actuals for YoY GDP percent change (selected entries from Table 6):
  - South Africa Q4 2019 Actual: -0.57%
    - Elastic net: 0.33% (+90bp)
    - SVR: 0.13% (+70bp)
    - Random Forest: -0.3% (+27bp)
    - XGBoost: -0.18% (+39bp)
    - Voting: -0.07% (+50bp)
  - Nigeria Q4 2019 Actual: 2.37%
    - Elastic net: 1.92% (-45bp)
    - SVR: 1.60% (-77bp)
    - Random Forest: 2.29% (-8bp)
    - XGBoost: 2.37% (-)
    - Voting: 2.04% (-33bp)
  - Kenya Q4 2019 Actual: N/A
    - Elastic net: 5.15%; SVR: 5.30%; Random Forest: 5.55%; XGBoost: 5.36%; Voting: 5.35%
- QoQ predictions comparison (selected entries from Table 7):
  - South Africa Q4 2019 Actual: -0.36
    - Elastic net: -0.05% (+31bp)
    - SVR: 0.24% (+60bp)
    - Random Forest: -0.09% (+27bp)
    - XGBoost: -0.36% (+0bp)
    - Voting: -0.03% (+33bp)
  - Nigeria Q4 2019 Actual: 1.02
    - Elastic net: 0.50% (-52bp)
    - SVR: 0.50% (-52bp)
    - Random Forest: 0.92% (-10bp)
    - XGBoost: 1.01% (-1bp)
    - Voting: 0.73% (-29bp)
- ML model performance (selected RMSE results from Tables 10–12):
  - South Africa test-period RMSEs (Rolling / Recessions / Cross Validation):
    - ElasticNet: 1.57 / 1.65 / 1.11
    - SVR: 1.39 / 1.54 / 1.19
    - Random Forest: 0.96 / 1.98 / 1.10
    - XGBoost: 1.24 / 1.63 / 1.03
    - Voting Regression: 1.06 / 1.63 / 0.97
    - Baseline OLS: 1.03 / N/A / 2.79
  - Kenya test-period RMSEs:
    - ElasticNet: 1.13 / 1.04 / 1.44
    - SVR: 1.01 / 0.85 / 1.08
    - Random Forest: 0.67 / 0.89 / 0.82
    - XGBoost: 0.84 / 0.75 / 0.80
    - Voting Regression: 0.75 / 0.86 / 0.97
    - Baseline OLS: 2.66 / 4.37 / 2.97
  - Nigeria test-period RMSEs:
    - ElasticNet: 1.10 / 1.37 / 0.83
    - SVR: 0.92 / 1.13 / 1.02
    - Random Forest: 0.77 / 1.24 / 0.79
    - XGBoost: 0.87 / 1.06 / 0.96
    - Voting Regression: 0.84 / 1.18 / 0.79
    - Baseline OLS: 2.00 / 1.97 / 2.71
- ML model insights:
  - Tree-based models (Random Forest, XGBoost) tended to perform better in non-recessionary periods; linear models (Elastic Net, SVR) performed better in recessions.
  - Best-performing ML models by country:
    - South Africa: SVR, Voting Regression
    - Kenya: Elastic Net, Random Forest
    - Nigeria: Random Forest, XGBoost
  - ML models generally outperformed the OLS baseline on most evaluation metrics.

### Parametric factor model predictions and evaluation
- Factor models (three-pass regression) applied to Uganda, Kenya, Ghana; nowcasting quarterly GDP YoY % change.
- Estimation and test periods (Table 8):
  - Uganda: Estimation 2013Q3 – 2018Q4; Test 2019Q1 – 2019Q4
  - Kenya: Estimation 2015Q1 – 2018Q2; Test 2018Q3 – 2019Q3
  - Ghana: Estimation 2010Q1 – 2017Q4; Test 2018Q1 – 2019Q3
- Selected factor-model predictions vs. baseline ARMA (Table 13–15):
  - Uganda Q4 2019 Actual: 5.43%
    - ARMA(1,1) Predicted Q4 2019: 4.72% (95% Confidence Interval: –1.48%, 10.93%), Q1 2020: 4.96% (95% CI: –1.48%, 11.41%), Baseline RMSE: 1.14pp
    - Three-Pass Regression Predicted Q4 2019: 3.41% (95% CI: –0.02%, 7.00%), Q1 2020: 5.71% (95% CI: 3.07%, 8.35%), Parametric RMSE: 1.27pp
  - Kenya Q4 2019 Actual: N/A
    - ARMA(1,1) Predicted Q4 2019: 5.46% (95% CI: 4.36%, 6.56%), Q1 2020: 5.48% (95% CI: 4.37%, 6.58%), Baseline RMSE: 0.47pp
    - Three-Pass Regression Predicted Q4 2019: 5.17% (95% CI: 4.97%, 5.37%), Q1 2020: 5.81% (95% CI: 5.61%, 6.01%), Parametric RMSE: 0.21pp
  - Ghana Q4 2019 Actual: N/A
    - ARMA(1,1) Predicted Q4 2019: 6.40% (95% CI: 0.36%, 12.44%), Q1 2020: 6.49% (95% CI: 0.03%, 12.94%), Baseline RMSE: 0.55pp
    - Three-Pass Regression Predicted Q4 2019: 5.57% (95% CI: 3.70%, 7.44%), Q1 2020: 5.95% (95% CI: 4.50%, 7.40%), Parametric RMSE: 0.97pp
- Factor model evaluation insights:
  - Three-pass regression factor models show promising prediction accuracy given data limitations; predictions improved in more recent periods with higher data availability.
  - Baseline ARMA models often have low RMSE due to persistence and decreased volatility of GDP growth over time, but are less useful during crisis periods when persistence is not an appropriate guide.
  - Three-pass regression method shows potential for countries with higher GDP volatility and/or limited data (e.g., Kenya), and can be more generalizable for SSA countries with shorter time horizons.

### Latent factor series and interpretation
- Monthly three-pass regression latent factors examined for Uganda, Kenya, and Ghana as higher-frequency directional indicators of economic activity between quarter-ends. Observed that 2020M1–2020M3 latent factors indicated tempered activity but not worse than recent historical lows (e.g., 2016M11 for Uganda, 2017M9 for Kenya, 2012M3 for Ghana).
- Daily Kalman-filter latent factor for South Africa plotted against recession periods (red bars): Q2 2008 through Q2 2010 and Q1 2015 through Q2 2017 (as declared by the South African Reserve Bank). Decreases in the latent variable expected to trend with downturns; increases with expansion.
- Daily latent factor results preliminary; daily-series volatility and short sample length limited robustness.

### Variable importance and data priorities
- ML variable importance (top two ML models per country) highlights:
  - South Africa (Random Forest / XGBoost): prominent variables include Autoregression 1 (q1), multiple USDZAR Spot Exchange Rate daily series (d1–d6), South Africa export/import to/from world (m1–m3), Industrial Production (m1–m3), Google Search Trends terms such as “money”, “mobile money”, “ewallet”, and retail/credit indicators.
  - Nigeria (Random Forest / XGBoost): USDNGN Spot Exchange Rate daily series dominate (d1–d6), Nigeria Business Confidence (m3), Nigeria Inflation (m1, m3), bank-specific daily series (ACCESS BANK PLC, ZENITH BANK PLC), Google Search Trends terms (“cash”, “737”, “ego”).
  - Kenya (Random Forest / XGBoost): mobile payments and payments-system variables (Number of Transactions POS Machines, Payments Volume growth MoM, Accounts in millions, Transactions per account), Inflation (m1), Interbank Rate (m1), trade variables.
- Factor model variable coefficients and significance (selected highlights):
  - Uganda selected trade variables and monetary aggregates; Money Supply M3 monthly coefficient: 0.594 (Std. Error 0.133), P-value <0.001; Wholesale index coefficient -1.26 (0.362), P-value 0.002; Private Sector Credit (USh monthly) coefficient 13.348 (7.037), P-value 0.074.
  - Kenya: Inflation monthly coefficient -45.996 (11.502), P-value 0.001; exports and imports ship metrics with large negative coefficients and statistically significant p-values.
  - Ghana: Interest Rate monthly coefficient -2.676 (0.622), P-value <0.001; selected equity and spot rate daily series with varying significance.

### Key policy-relevant findings and recommendations
- High-frequency alternative data (shipping data, mobile payments, Google Search Trends) can be useful predictors of GDP and often ranked high in feature importance, suggesting value in expanding collection of such data.
- Three-pass regression factor models are parsimonious and particularly suitable for SSA countries with limited data and shorter time horizons; recommended for broader application across SSA.
- For Kalman-filter daily-factor approaches, priorities to improve operational usability:
  - Transform inputs to growth rates for stationarity.
  - Aggregate high-frequency inputs to weekly or monthly to reduce runtime.
  - Incorporate additional high-frequency variables to improve explanatory power.
- For ML models, recommended future work:
  - Further feature engineering including cross-country predictors and interaction terms.
  - Explore recurrent neural networks (RNN) and Long Short-Term Memory (LSTM) models for time-series prediction.
  - Use variable importance results to guide parsimonious factor-model construction.
- General methodological recommendations:
  - Compare the nowcast methods to benchmarks such as Bayesian vector autoregressions with shrinkage to assess complementarities.
  - Investigate methods to impute missing variables (mean/mode, k nearest neighbor) to potentially improve three-pass regression performance.
  - Produce additional visualizations for policymakers, including density nowcasts, predictive distributions, and decomposition of data-category contributions.

*Italic: Source — wpiea2021124-print-pdf, “3. Quarterly real GDP (in ZAR millions), beginning in Q1 1990”*

### Appendix I. Machine Learning Model Supplemental Materials

### Appendix I. Machine Learning Model Supplemental Materials

### South Africa — Machine Learning Model Variable List
- 1. nga_concon_q — Consumer Confidence — Points (net percentage share of respondents answering positively vs. negatively) — Quarterly
- 2. zaf_bnkrp_m — Bankruptcies — # of Companies — Monthly
- 3. zaf_buscon_q — Business Confidence — Points — Quarterly
- 4. zaf_chainv_q — Inventory — ZAR Million — Quarterly
- 5. zaf_concon_q — Consumer Confidence — Points — Quarterly
- 6. zaf_equitysbk_d — Financial - Equity price zaf — Daily
- 7. zaf_gglai_m — Google Search Trends - airtime — Relative to highest level — Monthly
- 8. zaf_gglem_m — Google Search Trends - employment — Relative to highest level — Monthly
- 9. zaf_gglew_m — Google Search Trends - ewallet — Relative to highest level — Monthly
- 10. zaf_ggljo_m — Google Search Trends - job — Relative to highest level — Monthly
- 11. zaf_gglmob_m — Google Search Trends - mobile money — Relative to highest level — Monthly
- 12. zaf_gglmon_m — Google Search Trends - money — Relative to highest level — Monthly
- 13. zaf_indpro_m — Industrial Production — % (YoY) — Monthly
- 14. zaf_inflat_m — Inflation Rate — % (YoY) — Monthly
- 15. zaf_lei_m — Leading Economic Index — % (month over month) — Monthly
- 16. zaf_nexport_m — Trade - Exports — Nominal exports (USD) — Monthly
- 17. zaf_nimport_m — Trade - Imports — Nominal imports (USD) — Monthly
- 18. zaf_psc_m — Private Sector Credit — ZAR Million — Monthly
- 19. zaf_retail_m — Retail — % (month over month) — Monthly
- 20. zaf_spotrate_d — Exchange Rate (Spot) — 1 USD/ZAR — Daily
- 21. zaf_unemp_q — Unemployment Rate — % (People looking for a job/ tot labor force) — Quarterly
- 22. zaf_vehic_m — Vehicle Sales — Total number of vehicles sold — Monthly

- Figures referenced for South Africa:
  - Figure 16. Top 20 most important variables for South Africa random forest regression
  - Figure 17. Top 20 coefficients with highest absolute value for South Africa XGBoost regression

### Nigeria — Machine Learning Model Variable List
- 1. nga_buscon_m — Business Confidence — Points — Monthly
- 2. nga_concon_q — Consumer Confidence — Points (net percentage share of respondents answering positively vs. negatively) — Quarterly
- 3. nga_equityaccess_d — Financial - Equity price ngn — Daily
- 4. nga_equityzen_d — Financial - Equity price ngn — Daily
- 5. nga_spotrate_d — Exchange Rate (Spot) — 1 USD/NGN — Daily
- 6. nga_gdp_q — GDP — Local currency unit — Quarterly
- 7. nga_ggleg_m — Google Search Trends - ego — Relative to highest level — Monthly
- 8. nga_gglca_m — Google Search Trends - cash — Relative to highest level — Monthly
- 9. nga_gglmo_m — Google Search Trends - money — Relative to highest level — Monthly
- 10. nga_gglwo_m — Google Search Trends - work — Relative to highest level — Monthly
- 11. nga_ggl73_m — Google Search Trends - 737 — Relative to highest level — Monthly
- 12. nga_inflat_m — Inflation Rate — % (YoY) — Monthly
- 13. nga_unemp_q — Unemployment Rate — % (People looking for a job/ tot labor force, QoQ) — Quarterly
- 14. nga_nexport_m — Trade - Exports — Nominal exports (USD) — Monthly
- 15. nga_nimport_m — Trade - Imports — Nominal imports (USD) — Monthly

- Figures referenced for Nigeria:
  - Figure 18. Top 20 most important variables for Nigeria random forest regression
  - Figure 19. Top 20 most important variables for Nigeria XGBoost regression

### Kenya — Machine Learning Model Variable List
- 1. ken_eftscredval_m — Check EFTs — Kshs Billions — Monthly
- 2. ken_eftscredvol_m — Check EFTs — Number of Credit Volumes — Monthly
- 3. ken_eftsdebval_m — Check EFTs — Kshs Billions — Monthly
- 4. ken_eftsdebvol_m — Check EFTs — Number of Debit Volumes — Monthly
- 5. ken_spotrate_d — Exchange Rate (Spot) — 1 USD/KES — Daily
- 6. ken_gdp_q — GDP — Local currency unit — Quarterly
- 7. ken_gglch_m — Google Search Trends - cheddar — Relative to highest level — Monthly
- 8. ken_ggldo_m — Google Search Trends - dough — Relative to highest level — Monthly
- 9. ken_gglmt_m — Google Search Trends - MTN — Relative to highest level — Monthly
- 10. ken_inflat_m — Inflation Rate — % (YoY) — Monthly
- 11. ken_intrbk_m — Interbank - Rate — % (Month over previous Month) — Monthly
- 12. ken_intrst_m — Interest Rate — % (percentage of interest rate) — Monthly
- 13. ken_mpagents_m — Mobile payments Level - Number of agents — Monthly
- 14. ken_mpaccounts_m — Mobile payments Level - Number of accounts — Monthly
- 15. ken_mptxns_m — Mobile payments Level - Number of transactions — Monthly
- 16. ken_mpvalue_m — Mobile payments Level - Ksh — Monthly
- 17. ken_mpavgtxnsz_m — Mobile payments Ratio - Ksh per transaction — Monthly
- 18. ken_mpvolacct_m — Mobile payments Ratio - Ksh per account — Monthly
- 19. ken_mpvolagent_m — Mobile payments Ratio - Ksh per agent — Monthly
- 20. ken_mptxnperacct_m — Mobile payments Ratio - Transactions per account — Monthly
- 21. ken_mptxnMOM_m — Mobile payments Percent Change - MoM % Change in Transactions — Monthly
- 22. ken_mpvolMOM_m — Mobile payments Percent Change - MoM % Change in Payments Volume — Monthly
- 23. ken_mpagentsMOM_m — Mobile payments Percent Change - MoM % Change in Agents — Monthly
- 24. ken_mpvolacctMOM_m — Mobile payments Percent Change - MoM % Change in Payments Volume per Agent — Monthly
- 25. ken_gaspr_m — Oil / Gas — USD/Liter — Monthly
- 26. ken_numtranschange_m — Payment card transactions - Change Card Txn — # of transactions by change cards — Monthly
- 27. ken_valtranschange_m — Payment card transactions - Change Card Value — Kshs Millions — Monthly
- 28. ken_numtranscredit_m — Payment card transactions - Credit Card Txn — # of transactions by credit cards — Monthly
- 29. ken_valtranscredit_m — Payment card transactions - Credit Card Value — Kshs Millions — Monthly
- 30. ken_numtransdebit_m — Payment card transactions - Debit Card Txn — # of transactions by debit cards — Monthly
- 31. ken_valtransdebit_m — Payment card transactions - Debit Card Value — Kshs Millions — Monthly
- 32. ken_numtranspos_m — Payment card transactions - POS Machine Txn — # of transactions by pos machines — Monthly
- 33. ken_valtranspos_m — Payment card transactions - POS Machine Value — Kshs Millions — Monthly
- 34. ken_numtransprepaid_m — Payment card transactions - Prepaid Card Txn — # of transactions by prepaid cards — Monthly
- 35. ken_valtransprepaid_m — Payment card transactions - Prepaid Card Value — Kshs Millions — Monthly
- 36. ken_numtranstot_m — Payment card transactions - Total Txn — # of transactions total — Monthly
- 37. ken_valtranstot_m — Payment card transactions - Total Value — Kshs Millions — Monthly
- 38. ken_pmi_m — PMI Index — Monthly
- 39. ken_ftscomimp_m — Trade - Commercial Imports — Ksh Million — Monthly
- 40. ken_ftsdomfob_m — Trade - Domestic FOB — Ksh Million — Monthly
- 41. ken_nexport_m — Trade - Exports — Nominal exports (USD) — Monthly
- 42. ken_ftstot_m — Trade - Foreign Trade Total — Ksh Million — Monthly
- 43. ken_ftsgvtimp_m — Trade - Government Imports — Ksh Million — Monthly
- 44. ken_nimport_m — Trade - Imports — Nominal imports (USD) — Monthly
- 45. ken_ftsexp_m — Trade - Re-exports — Ksh Million — Monthly
- 46. ken_ftstotfob_m — Trade - Total FOB — Ksh Million — Monthly
- 47. ken_ftstb_m — Trade - Trade Balance — Ksh Million — Monthly

- Figures referenced for Kenya:
  - Figure 20. All non-zero coefficients for Kenya XGBoost regression
  - Figure 21. Top 20 most important variables for Kenya random forest regression

### Figures and Visual Diagnostics (selected references)
- Appendix I Figures (by country) include variable-importance and coefficient visualizations for random forest and XGBoost regressions:
  - South Africa: Figure 16, Figure 17
  - Nigeria: Figure 18, Figure 19
  - Kenya: Figure 20, Figure 21
- Appendix II and III reference additional diagnostic plots and visualizations:
  - Figure 22. Uganda GDP: Autocorrelation, Partial Autocorrelation, & Normal Quantile–Quantile Plots of Year-over-Year Quarterly GDP
  - Figure 23. Kenya GDP: Autocorrelation, Partial Autocorrelation, & Normal Quantile–Quantile Plots of Year-over-Year Quarterly GDP
  - Figure 24. Ghana GDP: Autocorrelation, Partial Autocorrelation, & Normal Quantile–Quantile Plots of Year-over-Year Quarterly GDP
  - Figure 25. Uganda Residuals: Autocorrelation and Partial Autocorrelation Comparison for Factor Model Pass 3(a) vs. Pass 3(b) Residuals
  - Figure 26. Kenya Residuals: Autocorrelation and Partial Autocorrelation Comparison for Factor Model Pass 3(a) vs. Pass 3(b) Residuals
  - Figure 27. Ghana Residuals: Autocorrelation and Partial Autocorrelation Comparison for Factor Model Pass 3(a) vs. Pass 3(b) Residuals
  - Figure 28. Correlation Matrix of Quarterly GDP YoY Percent Change by Country
  - Figure 29. Google Trend Search Terms Time Series for Ivory Coast, Cameroon, Ghana, and Uganda

### Data sourcing and aggregation notes (Appendix IV)
- Note on data sourcing for nowcast models: All variables used in Machine Learning and parametric Factor Models are detailed in Appendix V. Data Dictionary. The data was sourced through four different methods:
  1. API: All Google Trends search term data was obtained using the pytrends unofficial API for Google Trends. User can adjust keywords and timeframes used for each country to modify or expand the Google Trends dataset. Financial and macroeconomic variables from Bloomberg were also sourced from the Bloomberg Excel API add-in (all values used are PX-LAST). Note that the variables sourced through method (2) that are also available through API (e.g., Trading Economics platform).
  2. Online databases: The macroeconomic data included in the Data dictionary were sourced from the Trading Economics database. The Trading Economics database cites the original sources for each of the data variables which are included for completeness.
  3. Country-specific websites: A select subset of variables sourced directly through CSV file downloads from websites (i.e., Kenya mobile payments and payment card data).
  4. IMF Provided: Shipping and trade variables were provided by IMF colleagues
- Note on data aggregation:
  - Given the large quantity of source data variables with mixed frequencies and update intervals, we first formatted and aggregated all variables together to ensure data files had consistent structure prior to applying the skip-sampling methodology described in Section III.A..
  - Standardization included date formatting and chronological order of observations.
  - Daily and weekly variables were aggregated into a bi-weekly average frequency first.
  - Data aggregation across mixed frequencies involved sorting variables by country/region and frequency (e.g., all monthly variables for South Africa) and by frequency only (e.g., all daily / weekly / monthly / quarterly variables).
  - For the Factor Models, the method of aggregating lower-frequency data into monthly and quarterly variables is based on categorization of variables as either stock or flow variables (i.e., if a stock variable, the observations are averaged and if a flow variable, the observations are summed).

*Source: Appendix I–IV, "Machine Learning Model Supplemental Materials" (excerpt).*

### Appendix V. Full Data Dictionary Variable List

### Appendix V. Full Data Dictionary Variable List

### Scope and coverage
- Table 25 presents a full variable list covering multiple countries and regional aggregates.
- Variable categories include: Shipping, Business Confidence, GDP, Manufacturing, Money Supply, Trade, Debt, Financial Market, Google Search Trends, Air Quality, Inflation Rate, Interest Rate, Mobile payments, Payment card transactions, Oil / Gas, Commodity Prices, Leading Economic Index, Retail / Sales, Unemployment Rate, Bank Deposits, Private Credit, Business Tendency Indicator, and others.
- Frequency types present: Daily, Weekly, Monthly, Quarterly, Annual.
- Timeframes vary by variable and country (examples given below preserve exact timeframe expressions from the source).

### Variable categories and metadata (selected entries from the list)
- 1 Angola ago_berthvisits_w — Shipping — Shipping Cargo — Metric Tons of Cargo — Weekly — 2016/4 - 2020/4 — Bloomberg Terminal
- 2 Angola ago_buscon_q — Business Confidence — Business Confidence — Points (net difference between positive and negative responses) — Quarterly — 2008/9 - 2019/9 — Instituto National De Estatica Angola
- 3 Angola ago_expdwt_d — Shipping — Exports - Ship Design Capacity — Daily — Metric Tons of Cargo Daily — 2015/4 - 2020/4 — IMF (Diego Cerdeiro)
- 6 Angola ago_gdp_q — GDP — GDP — Local currency unit — Quarterly — 2010/3 - 2019/12 — IMF Angola Team
- 13 Angola ago_intrst_d — Interest Rate — Interest Rate (Policy Rate) % — percentage — Daily — 2002/1 - 2020/3 — National Bank of Angola
- 15 Angola ago_monsup_m — Money Supply — M3 Money Supply M3 — AOA Million — Monthly — 2009/12 - 2020/2 — National Bank of Angola
- 22 Angola ago_spotrate_d — Financial Market — Exchange Rate (Spot) — 1 USD/AOA — Daily — 1993/6 - 2020/4 — Bloomberg Terminal
- 23 Cameroon cmr_chainv_q — Manufacturing — Inventory — XAF Billion — Quarterly — 2016/9 - 2019/6 — Institut National De La Statistique du Cameroun
- 28 Cameroon cmr_ggldo_m — Google Search Trends — Google Search Trends - Do Relative to highest level — Monthly — 2010/7 - 2019/10 — Google Trends
- 35 Cameroon cmr_indpro_q — Manufacturing — Industrial Production % (change from previous quarter) — Quarterly — 2000/3 - 2019/6 — Institut National De La Statistique du Cameroun
- 39 Cameroon cmr_intrst_m — Interest Rate — Interest Rate (Policy Rate) % — percentage — Monthly — 2009/6 - 2020/3 — Bank of Central African States
- 46 Ethiopia eth_aqi_d — Air Quality — Air Quality Index — Daily — 2016/8 - 2020/4 — AirNow Department of State
- 47 Ethiopia eth_inflat_m — Inflation Rate — Inflation Rate % (YoY) — Monthly — 2006/7 - 2020/3 — Central Statistical Agency of Ethiopia
- 52 Ghana gha_equitygcb_d — Financial Market — Financial - Equity price — ghs — Daily — 2006/1 - 2020/4 — Bloomberg Terminal
- 56 Ghana gha_gdp_q — GDP — GDP — Local currency unit — Quarterly — 2006/3 - 2019/9 — IMF - Haver
- 66 Ghana gha_inflat_m — Inflation Rate — Inflation Rate % (YoY) — Monthly — 1998/9 - 2020/2 — Ghana Statistical Service
- 76 Ghana gha_pmi_m — Manufacturing — PMI Index — Monthly — 2017/4 - 2020/3 — Bloomberg Terminal
- 79 Ghana gha_spotrate_d — Financial Market — Exchange Rate (Spot) — 1 USD/GHC — Daily — 1993/6 - 2020/4 — Bloomberg Terminal
- 80 Ivory_Coast civ_equitysgbc_d — Financial Market — Financial - Equity price — xaf — Daily — 2006/1 - 2020/4 — Bloomberg Terminal
- 84 Ivory_Coast civ_gdp_q — GDP — GDP — Local currency unit — Quarterly — 1996/3 - 2018/9 — IMF - Haver
- 95 Ivory_Coast civ_indpro_m — Manufacturing — Industrial Production % (YoY) — Monthly — 2007/6 - 2019/6 — Institut National De La Statistique
- 99 Ivory_Coast civ_intrst_m — Interest Rate — Interest Rate (Policy Rate) % — percentage — Monthly — 2010/12 - 2020/2 — Trading Economics
- 102 Ivory_Coast civ_npltot_a — Debt — Non Performing Loans to Tot Loans — $ (NPl/TotLoans) — Annual — 1996/1 - 2017/1 — African Open Data
- 107 Kenya ken_10yrbd_d — Financial Market — 10 Yr Bond Yield % — Daily — 2016/7 - 2020/4 — Bloomberg Markets
- 115 Kenya ken_ftscomimp_m — Trade — Trade - Commercial Imports — Ksh Million — Monthly — 1998/2 - 2020/2 — Kenya Central Bank
- 123 Kenya ken_gdp_q — GDP — GDP — Local currency unit — Quarterly — 2009/3 - 2019/9 — IMF - Haver
- 129 Kenya ken_impnum_d — Shipping — Imports - Number of Ships — Daily — Number of ships Daily — 2015/4 - 2020/4 — IMF (Diego Cerdeiro)
- 137 Kenya ken_mpaccounts_m — Mobile payments — Mobile payments — Level - Number of accounts — Monthly — 2007/3 - 2020/1 — Kenya Central Bank
- 151 Kenya ken_npltot_a — Debt — Non Performing Loans to Tot Loans — % (NPL/TotLoans) — Annual — 1998/1 - 2017/1 — FRED
- 158 Kenya ken_outmtc_m — Shipping — Exports - Ship Load — Monthly — Metric Tons of Cargo Monthly — 2015/3 - 2020/2 — IMF (Diego Cerdeiro)
- 161 Kenya ken_spotrate_d — Financial Market — Exchange Rate (Spot) — 1 USD/KES — Daily — 1993/6 - 2020/4 — Bloomberg Terminal
- 170 Mozambique moz_expdwt_d — Shipping — Exports - Ship Design Capacity — Daily — Metric Tons of Cargo Daily — 2015/4 - 2020/4 — IMF (Diego Cerdeiro)
- 176 Mozambique moz_inmtc_m — Shipping — Imports - Ship Load — Monthly — Metric Tons of Cargo Monthly — 2015/3 - 2020/2 — IMF (Diego Cerdeiro)
- 180 Namibia nam_expdwt_d — Shipping — Exports - Ship Design Capacity — Daily — Metric Tons of Cargo Daily — 2015/4 - 2020/4 — IMF (Diego Cerdeiro)
- 190 Nigeria nga_10yrbd_d — Financial Market — 10 Yr Bond Yield % — Daily — 2016/4 - 2020/4 — Trading Economics
- 191 Nigeria nga_berthvisits_w — Shipping — Shipping Cargo — Metric Tons of Cargo — Weekly — 2015/1 - 2020/4 — Bloomberg Terminal
- 193 Nigeria nga_concon_q — Consumer Confidence — Consumer Confidence — Points (net difference between positive and negative responses) — Quarterly — 2008/6 - 2020/3 — National Bureau of Statistics, Nigeria
- 199 Nigeria nga_gdp_q — GDP — GDP — Local currency unit — Quarterly — 2010/3 - 2019/12 — IMF - Haver
- 212 Nigeria nga_lngexport_w — Shipping — Shipping Cargo — Metric Tons of Cargo — Weekly — 2014/1 - 2020/4 — Bloomberg Terminal
- 222 Nigeria nga_spotrate_d — Financial Market — Exchange Rate (Spot) — 1 USD/NGN — Daily — 1994/3 - 2020/4 — Bloomberg Terminal
- 224 regional reg_balticdry_d — Shipping — Shipping index — Index — Daily — 1993/6 - 2020/4 — Bloomberg Terminal
- 225 regional reg_brentoil_d — Oil / Gas — Oil / Gas — Index — Daily — 1993/6 - 2020/4 — Bloomberg Terminal
- 228 regional reg_crudeoil_w — Shipping — Shipping Cargo — Barrels (thousands) — Weekly — 2016/1 - 2020/3 — Bloomberg Terminal
- 229 regional reg_gold_d — Commodity Prices — Commodity Prices — USD/t. oz — Daily — 2017/7 - 2020/4 — Bloomberg Terminal
- 242 South Africa zaf_10yrbd_d — Financial Market — 10 Yr Bond Yield % — Daily — 2016/5 - 2020/4 — Trading Economics
- 244 South Africa zaf_bnkrp_m — Bankruptcies — Bankruptcies — # of Companies — Monthly — 1980/1 - 2020/2 — Statistics South Africa
- 254 South Africa zaf_gdp_q — GDP — GDP — Local currency unit — Quarterly — 1990/3 - 2019/12 — IMF - Haver
- 266 South Africa zaf_inflat_m — Inflation Rate — Inflation Rate % (YoY) — Monthly — 1968/7 - 2020/2 — South African Reserve Bank
- 270 South Africa zaf_intrst_d — Interest Rate — Interest Rate (Policy Rate) % — percentage — Daily — 1998/3 - 2020/3 — Trading Economics (South African Reserve Bank)
- 281 South Africa zaf_stockindex_d — Financial Market — Financial - Stock Market — Local currency — Daily — 2006/6 - 2020/4 — Bloomberg Terminal
- 284 Uganda uga_agindex_m — Business Tendency Indicator — Business Tendency Indicator - Agriculture — Index — Monthly — 2012/7 - 2020/4 — IMF
- 285 Uganda uga_aqi_d — Air Quality — Air Quality Index — Daily — 2017/2 - 2020/4 — AirNow Department of State
- 292 Uganda uga_currgdp_a — Trade — Current Account to GDP — % (of GDP, Current Acc measured in USD million) — Annual — 1980/12 - 2018/12 — Bank of Uganda
- 299 Uganda uga_gdp_q — GDP — GDP — Local currency unit — Quarterly — 2008/9 - 2019/9 — IMF - Haver
- 305 Uganda uga_inflat_m — Inflation Rate — Inflation Rate % (YoY) — Monthly — 1998/7 - 2020/3 — Bank of Uganda
- 316 Uganda uga_pmi_m — Purchasing Managers Index — Purchasing Managers Index — Index — Monthly — 2017/3 - 2020/3 — IMF
- 317 Uganda uga_smi_d — Financial Market — Financial - Stock Market — Points — Daily — 2016/4 - 2020/4 — Trading Economics
- 321 Uganda uga_ushloans_m — Private Credit — Private Sector Credit - USH — USH — Monthly — 2012/7 - 2020/3 — IMF

### Notes and special data types
- Google Search Trends variables are included; for more details about the Google Search Trend variables, see Section II “alternative data” and Table 2 (as noted in the source).
- Shipping variables often include multiple related measures (e.g., expdwt_d, expmtc_d, expnum_d) with units and frequencies preserved exactly as listed.
- Several variables include seasonally adjusted (SA) versions; units and adjustment labels are preserved verbatim in the list.

*Appendix V. Full Data Dictionary Variable List — wpiea2021124-print-pdf*

---


_Source: https://www.imf.org/-/media/files/publications/wp/2021/english/wpiea2021124-print-pdf.pdf_
