## 13. Latvia Exports: RMSEs for Different Forecasts

## Source details

**Canonical URL:** [13. Latvia Exports: RMSEs for Different Forecasts](https://www.imf.org/-/media/files/publications/wp/2020/english/wpiea2020247-print-pdf.pdf)

## Other formats

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

---

### SWIFT trade messages as leading indicators of trade
- SWIFT MT 700 messages represent documentary credits (letters of credit) sent before exporters ship merchandise goods; the dollar amount provides an early indicator of the nominal value of the trade that will take place.
- The average maturity of a letter of credit is 60 days.
- MT 700 messages go in the opposite direction of the trade flow (financial flow precedes merchandise movement).
- SWIFT data for MT 700 messages include message type code, message name, originating country, counterparty country, currency used, total number of SWIFT transactions sent and received during the month, and total net amount sent and received in the original currency and US dollar equivalent.

### Coverage and cross-country variation
- SWIFT MT 700 messages financed about 15 percent of world trade in 2019.
- Among the top 10 importers in the world in 2019, India, Hong Kong SAR, and China had a share over 20 percent of their total merchandise trade financed via SWIFT MT 700 messages.
- Among the largest 10 exporters in 2019, Hong Kong SAR and United Kingdom had shares over 25 percent, followed by Korea, Japan, and China.
- Use of letters of credit is mostly prevalent in bilateral trade with emerging markets, most notably in Asia; open contracts are more prevalent in bilateral trade between advanced economies; cash-in-advance is more prevalent amongst low-income and developing countries.
- Lead time between MT 700 issuance and customs-recorded goods varies by production time, proximity of trading partners, and transportation method (example: United States–Mexico lead time may be a week or two; China–Germany lead time may be one to two months).

### Empirical relationships with world trade
- SWIFT trade messages generally move broadly in line with CPB world trade, while being more volatile and subject to spikes unrelated to underlying trade flows.
- A simple scatter regression of SWIFT trade messages against CPB world trade yields an R2 of 47 percent.
- Adding Brent crude oil prices and the new export orders subcomponent of the global manufacturing PMI to SWIFT raises the R2 to 76 percent in the multivariate scatter analysis.
- In reduced-form regressions of world trade (WT) on lags of WT, SWIFT, Brent, and PMI:
  - All three explanatory variables (SWIFT, Brent, PMI) are significant determinants of world trade in various specifications.
  - Contemporaneous coefficients on SWIFT are positive and highly significant in all specifications.
  - Brent and PMI coefficients are positive and highly significant, including in their first lags.
  - When SWIFT is omitted, OIL and PMI (and some of their lags) remain significant and the R2 remains high (0.673–0.768), indicating OIL explains much of the variation in nominal world trade and that OIL and SWIFT are non-orthogonal.
  - The specification with all explanatory variables attains an R2 of close to 80 percent and an adjusted R2 of 75 percent.

### Forecasting performance and methodology notes
- SWIFT data are available monthly a few business days after month-end, aggregated by country and anonymized, enabling timely short-term forecasting.
- Both linear regressions and machine-learning algorithms were applied to extract lead information from SWIFT messages; linear regression forecasts often outperform machine-learning forecasts, consistent with a largely linear relationship between trade data and its financing through SWIFT.
- The reduced-form forecasting equation used log differences for WT, SWIFT, and Brent (with up to four lags) and the PMI in its diffusion-index form re-centered around zero; lag index i goes from 1 to 4 and lag index j goes from 0 to 4.
- Example timeline and performance:
  - Initial forecast on January 15, 2019 used CPB world trade up to October 2018 and SWIFT up to December.
  - Simple autoregressive process (AR(2)) as of January 15, 2019 predicted world trade to continue growing at a constant rate.
  - SWIFT-only forecast up to December 2018 predicted a gradual decline in late 2018/early 2019.
  - Adding Brent crude oil prices produced a more negative forecast; actual world merchandise trade declined rapidly in November and December 2018 and stabilized in early 2019, broadly in line with the forecast that included oil prices.
  - During the COVID pandemic:
    - The April 16, 2020 forecast correctly indicated a significant decline in world trade, though not as sharp as ultimately occurred.
    - CPB data available only up to January 2020 indicated only stabilization in world trade.
    - The latest SWIFT forecast as of August 17, 2020 predicted a moderate rebound in world trade in Q3 and Q4 2020.
    - CPB data for June 2020 (released in late August) confirmed a rebound stronger than predicted by the August 17, 2020 forecast.

### Key regression specifications and diagnostics (selected reported values)
- Dependent Variable: World Trade. Sample: April 2011-May 2020 (110 observations).
- Selected coefficient patterns reported:
  - World Trade (-1): 0.0717 (0.150); -0.2124 (0.134); -0.3342 (0.093)***; -0.4271 (0.087)***; -0.3943 (0.082)***; -0.3036 (0.084)***.
  - SWIFT example: 0.1329 (0.048)*** (contemporaneous in one specification).
  - Brent examples: 0.1124 (0.021)***; Brent (-1) 0.1100 (0.032)***.
  - PMI example: 0.0046 (0.001)*** (contemporaneous in one specification).
- Diagnostics (reported as sequences for alternative specifications):
  - R2: 0.0680.3200.7010.7930.7680.673
  - Adjusted R2: 0.0330.2580.6570.7490.7330.644
  - F-Statistic: 2.8464.52911.1532.6940.29.234
  - Prob. (F-Statistic): 0.02765.19e -05    1.34e -14    2.85e -321.18e -33    4.45e -10
  - Log-likelihood: 266.61283.91329.13349.34342.96324.26
  - Durbin-Watson: 1.9622.0381.9832.0191.9941.978
- Note: Standard errors are heteroscedasticity and autocorrelation robust (HAC) using 1 lags and without small sample correction. Significance indicated at 10 percent (*), 5 percent (**), and 1 percent (***).

### Comparison with Baltic Dry Index (BDI) forecasts
- BDI regression (Sample: May 2006-January 2020, 165 observations):
  - Constant 0.0030 (0.0016)*
  - BDI 0.0240 (0.0070)***
  - BDI(-1) 0.0180 (0.0074)**
  - BDI(-2) 0.0228 (0.0075)***
  - BDI(-3) 0.0077 (0.0075)
  - BDI(-4) 0.0240 (0.0073)***
  - Diagnostics: R2 0.2424; Adjusted R2 0.2186; F-Statistic 10.1751; Prob. (F-Statistic) 0.0001; Durbin-Watson 1.3500.
- Forecast comparison as of April 16, 2020:
  - BDI forecast predicted a significant decline until May 2020 followed by a rapid rebound in June and July.
  - SWIFT forecast predicted a slower decline until March 2020 followed by a more rapid decline until July 2020.
  - Actual data through May 2020 showed a rapid decline in February/March matching the BDI, followed by a much sharper decline in April than either forecast predicted.
  - Overall: BDI forecasts performed better one- to two-months ahead; SWIFT performed better over the longer forecast horizon.
  - Short-term advantage of BDI may reflect availability of BDI data up to mid-April 2020 versus SWIFT data only up to March 2020.

### Comparison with autoregressive statistical model (AR(2))
- AR(2) model is purely backward-looking, based on past lags of world trade only; excludes explanatory variables such as Brent, SWIFT, PMI.
- AR(2) excludes about 9 percent ($1.5 trillion annually on the import side) of world trade compared with the CPB measure.
- Forecast behavior during COVID:
  - January–February 2020: both SWIFT and AR(2) showed relatively flat projections.
  - March–May 2020: SWIFT predicted a significant decline; AR(2) signaled a relatively flat forecast or only an initial decline.
  - June 2020: AR(2) became significantly more pessimistic than SWIFT and correctly predicted a steep decline that occurred in April 2020.
  - July–August 2020: SWIFT signaled a moderate rebound; AR(2) predicted continued decline despite a June correction.
  - CPB data for June showed a larger rebound than SWIFT predicted.
- Overall assessment:
  - AR(2) forecasts well during normal times and captures trend growth in world trade.
  - Being purely backward-looking, AR(2) is unable to pick up turning points as early as BDI or SWIFT.

### SWIFT and national customs trade: correlation and country-level regressions
- Contemporary correlations (40 countries) show highest correlations driven by Turkey and Asian countries: Korea, China, Vietnam, Bangladesh, Indonesia, Malaysia, Thailand.
- Lowest contemporaneous correlations for several advanced economies: Ireland, Sweden, Belgium, Norway, Japan, United States; and emerging markets: Colombia, Philippines, South Africa, Poland.
- Country-level regressions (exports and imports for 40 countries; 80 regressions) in log differences use lagged customs data, Brent, and national manufacturing PMI where available; OLS with HAC standard errors.
- Regional and country highlights (selected reported coefficients, observations, R2, adjusted R2):
  - Bangladesh (Exports): SWIFT 0.4586 (0.115)***; Observations 111; R2 0.686; Adjusted R2 0.64.
  - Korea (Imports): SWIFT 0.2637 (0.053)***; Observations 112; R2 0.663; Adjusted R2 0.594.
  - Mexico (Exports): SWIFT 0.0338 (0.006)***; Observations 107; R2 0.876; Adjusted R2 0.849.
  - Vietnam (Imports): SWIFT 0.3278 (0.069)***; Observations 109; R2 0.683; Adjusted R2 0.616.
  - Italy (Exports): SWIFT -0.0075 (0.027); Observations 111; R2 0.784; Adjusted R2 0.739.
  - Israel (Exports): SWIFT 0.04 (0.029); Observations 111; R2 0.62; Adjusted R2 0.541.
- Financial-center effects: Hong Kong SAR, Japan, United Kingdom, and the United States show blurred national-level relationships because banks domiciled there may intermediate SWIFT messages for other countries.

### Machine-learning vs. linear regression: methodology and performance
- MLA categories used: linear (Lasso, Ridge), single nonparametric (Decision Tree Regression, Support Vector Regression), and ensemble nonparametric (Bagging, Gradient Boost, Random Forest).
- Each MLA trained over full sample then used to produce one- to six-month ahead forecasts via one-step ahead recursive forecasting.
- Evaluation metric: root mean squared error (RMSE). Training set: up to May 2019. Test set: June 2019 to May 2020 with monthly rolling forecasts and RMSEs for one- through six-month ahead forecasts.
- Latvia imports example:
  - RMSEs range between 5 and 14 percent.
  - Shorter horizons: linear regression, ridge, support vector regression, and lasso have much smaller RMSEs than other forecasts.
  - Over longer horizons (five to six months) this advantage disappears.
- Aggregate performance:
  - Linear regression forecasts perform best over a 1-month ahead forecast in nearly half the sample.
  - Including Lasso and Ridge increases the share to two thirds of the sample.
  - Implication: the relationship between SWIFT trade messages and merchandise trade is largely linear for most countries.
- Diebold-Mariano (DM) one-step ahead examples (selected from Table 3):
  - World (Best Forecast: Linear Regression): DM Statistic -1.2926; P-Value 0.1961; RMSE 0.0235; Naïve RMSE 0.0539.
  - Chile (Exports, Best Forecast: Random Forest): DM Statistic 3.7222; P-Value 0.0002; RMSE 0.0801; Naïve RMSE 0.0709.
  - Ghana (Imports, Best Forecast: Linear Regression): DM Statistic -4.0206; P-Value 0.0001; RMSE 0.1095; Naïve RMSE 0.1443.
  - Korea (Imports, Best Forecast: Lasso): DM Statistic -2.3016; P-Value 0.0214; RMSE 0.0420; Naïve RMSE 0.0611.
  - Latvia (Imports, Best Forecast: Linear Regression): DM Statistic -2.3876; P-Value 0.0170; RMSE 0.0501; Naïve RMSE 0.1097.
- Formal testing: DM tests against a naïve forecast (simple average growth rate of exports/imports); a few countries have statistically significant forecasts different from the naïve forecast.

### Conclusions, limitations, and implications
- SWIFT trade messages, Brent crude oil prices, and the PMI new export orders subcomponent are useful predictors for short-term merchandise trade.
- Although SWIFT messages finance 15 percent of world trade, they have predictive power for world trade and help detect turning points, especially for forecasting trade in Asia.
- Linear regression and its Lasso and Ridge variants outperform many non-linear MLAs in about two thirds of the sample, supporting a predominantly linear relationship between SWIFT messages and merchandise trade.
- Limitations:
  - National-level relationships are blurred in economies hosting financial centers (Hong Kong SAR, Japan, United Kingdom, United States), making SWIFT less reliable for those national forecasts.
  - SWIFT and BDI have different data availability timings that affect short-run forecast performance.
- Suggested future research:
  - Assess whether SWIFT-based forecasts statistically outperform forecasts based on the Baltic Dry Index or on a simple autoregressive process.

*Source: wpiea2020247-print-pdf (selected sections on SWIFT trade messages, world trade regressions, forecasting methodology, and country regression results).*

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

### References

### Tables
- 1. World Trade: Comparison of Different Regression Specifications .....................................13
- 2. World Trade: Regression Results, Baltic Dry Index (BDI) .................................................16
- 3. Diebold-Mariano Tests of One-Step Ahead Forecast ..........................................................27
- I.1. Tradeoffs in Trade Financing ............................................................................................31
- II.1. Regression Results for Bangladesh Exports.....................................................................34
- II.2. Regression Results for Brazil Imports .............................................................................35
- II.3. Regression for Results Chile Imports...............................................................................36
- II.4. Regression Results for China Imports ..............................................................................37
- II.5. Regression Results for France Exports ............................................................................38
- II.6. Regression Results for Ghana Imports .............................................................................39
- II.7. Regression Results for India Exports ...............................................................................40
- II.8. Regression Results for Indonesia Imports ........................................................................41
- II.9. Regression Results for Israel Exports ..............................................................................42
- II.10. Regression Results for Israel Imports ............................................................................43
- II.11. Regression Results for Italy Exports ..............................................................................44
- II.12. Regression Results for Korea Exports ...........................................................................45
- II.13. Regression Results for Korea Imports ...........................................................................46
- II.14. Regression Results for Latvia Exports ...........................................................................47
- II.15. Regression Results for Lithuania Exports ......................................................................48
- II.16. Regression Results for Malaysia Imports.......................................................................49
- II.17. Regression Results for Mexico Exports .........................................................................50
- II.18. Regression Results for Nigeria Exports .........................................................................51
- II.19. Regression Results for Norway Exports ........................................................................52
- II.20. Regression Results for Russia Imports...........................................................................53
- II.21. Regression Results for Thailand Exports .......................................................................54
- II.22. Regression Results for Turkey Exports ..........................................................................55
- II.23. Regression Results for Turkey Imports ..........................................................................56
- II.24. Regression Results for Vietnam Imports .......................................................................57

### Figures
- 1. Financial Flow and Merchandise Trade .................................................................................7
- 2. Share of Merchandise Trade Financed by SWIFT Trade Messages......................................8
- 3. World Trade and. SWIFT Trade Messages ...........................................................................9
- 4. World Trade and SWIFT Trade Messages ..........................................................................10
- 5. World Trade and SWIFT Trade Messages, Manufacturing PMI: .......................................11
- 6. Forecast of World Trade, January 15, 2019 .........................................................................14
- 7. Rolling Forecasts of World Trade........................................................................................14
- 8. BDI and SWIFT Forecasts of World Trade .........................................................................16
- 9. Comparison of SWIFT and AR(2) Forecasts of World Trade .............................................18
- 10. Correlation Between SWIFT Messages and National Customs Data ................................20
- 11. World Trade: Forecasts Based on Linear Regression and MLAs......................................23
- 12. Korea Imports: Forecasts Based on Linear Regression and MLAs ...................................24

*wpiea2020247-print-pdf - References ................................................................................................................................29*

### 13. Latvia Exports: RMSEs for Different Forecasts ................................................................25

### 13. Latvia Exports: RMSEs for Different Forecasts

### SWIFT trade messages as leading indicators of trade
- SWIFT MT 700 messages represent documentary credits (letters of credit) and are sent before exporters ship merchandise goods; thus, the dollar amount of the letter of credit provides an early indicator of the nominal value of the trade that will take place.
- The average maturity of a letter of credit is 60 days.
- SWIFT data for MT 700 messages include message type code, message name, originating country, counterparty country, currency used, total number of SWIFT transactions sent and received during the month, and total net amount sent and received in the original currency and US dollar equivalent.
- MT 700 messages go in the opposite direction of the trade flow (financial flow precedes merchandise movement).

### Coverage and cross-country variation
- SWIFT MT 700 messages financed about 15 percent of world trade in 2019.
- The share of trade financed through SWIFT varies significantly across economies:
  - Among the top 10 importers in the world in 2019, India, Hong Kong SAR, and China were the largest users of SWIFT MT 700 trade messages with a share over 20 percent of their total merchandise trade.
  - Among the largest 10 exporters in 2019, Hong Kong SAR and United Kingdom had shares over 25 percent, followed by Korea, Japan, and China.
- Use of letters of credit is mostly prevalent in bilateral trade with emerging markets, most notably in Asia; open contracts are more prevalent in bilateral trade between advanced economies; cash-in-advance is more prevalent amongst low-income and developing countries.
- The lead time between MT 700 issuance and customs-recorded goods varies by production time, proximity of trading partners, and transportation method (examples: United States–Mexico lead time may be a week or two; China–Germany lead time may be one to two months).

### Empirical relationships with world trade
- SWIFT trade messages generally move broadly in line with CPB world trade, while being more volatile and subject to spikes unrelated to underlying trade flows.
- A simple scatter regression of SWIFT trade messages against CPB world trade yields an R2 of 47 percent.
- Adding Brent crude oil prices and the new export orders subcomponent of the global manufacturing PMI to SWIFT raises the R2 to 76 percent in the multivariate scatter analysis.
- In reduced-form regressions of world trade (WT) on lags of WT, SWIFT trade messages (SWIFT), Brent crude oil prices (Brent), and manufacturing PMI (PMI):
  - All three explanatory variables (SWIFT, Brent, PMI) are significant determinants of world trade in various specifications.
  - Contemporaneous coefficients on SWIFT are positive and highly significant in all specifications.
  - Brent and PMI coefficients are positive and highly significant, including in their first lags.
  - When SWIFT is omitted, OIL and PMI (and some of their lags) remain significant and the R2 remains high (0.673–0.768), indicating OIL explains much of the variation in nominal world trade and that OIL and SWIFT are non-orthogonal.
  - The specification with all explanatory variables attains an R2 of close to 80 percent and an adjusted R2 of 75 percent.

### Forecasting performance and methodology notes
- SWIFT data are available monthly a few business days after month-end, aggregated by country and anonymized, enabling timely short-term forecasting.
- Both linear regressions and machine-learning algorithms were applied to extract lead information from SWIFT messages; linear regression forecasts often outperform machine-learning forecasts, consistent with a largely linear relationship between trade data and its financing through SWIFT.
- A reduced-form forecasting equation used log differences for WT, SWIFT, and Brent (with up to four lags) and the PMI in its diffusion-index form re-centered around zero; lag index i goes from 1 to 4 and lag index j goes from 0 to 4.
- The regressions provide a good basis to forecast world trade; an initial forecast was undertaken on January 15, 2019 using CPB world trade up to October 2018 and SWIFT up to December (data availability constraints noted).

*Source: IMF working paper text (selected sections on SWIFT trade messages, world trade regressions, and forecasting methodology).*

### 2018. A simple autoregressive process at the time predicted world trade to continue growing

### 2018. A simple autoregressive process at the time predicted world trade to continue growing

### Forecast performance and timeline
- A simple autoregressive process (AR(2)) as of January 15, 2019 predicted world trade to continue growing at a constant rate (green line in Figure 6).
- The forecast using only SWIFT messages up to December 2018 predicted a gradual decline in late 2018/early 2019 (blue line).
- Adding Brent crude oil prices extended by oil futures available on January 15, 2019 produced a more negative forecast (purple line).
- Actual world merchandise trade declined rapidly in November and December 2018 and stabilized in the first four months of 2019, broadly in line with the forecast that included oil prices (red line).
- Repeated forecasts for 2019 and the first eight months of 2020 were close to realized data (Figure 7).
- During the COVID pandemic:
  - The April 16, 2020 forecast correctly indicated a significant decline in world trade, though not as sharp as ultimately occurred.
  - CPB data available only up to January 2020 indicated only stabilization in world trade.
  - The latest SWIFT forecast as of August 17, 2020 predicted a moderate rebound in world trade in Q3 and Q4 2020.
  - CPB data for June 2020 (released in late August) confirmed a rebound stronger than predicted by the August 17, 2020 forecast.

### Key regression specifications and diagnostics (Table 1)
- Dependent Variable: World Trade. Sample: April 2011-May 2020 (110 observations).
- Regression specifications compared include combinations of lagged World Trade, SWIFT, Brent, and PMI.
- Selected coefficient patterns (as reported):
  - World Trade (-1) coefficients include: 0.0717 (0.150); -0.2124 (0.134); -0.3342 (0.093)***; -0.4271 (0.087)***; -0.3943 (0.082)***; -0.3036 (0.084)***.
  - SWIFT contemporaneous and lags show positive and significant coefficients in several specifications (e.g., SWIFT 0.1329 (0.048)***).
  - Brent contemporaneous and lag coefficients are generally positive and significant (e.g., Brent 0.1124 (0.021)***; Brent (-1) 0.1100 (0.032)***).
  - PMI contemporaneous coefficient reported as 0.0046 (0.001)*** in one specification.
- Diagnostics (as reported in Table 1):
  - R2 reported as: 0.0680.3200.7010.7930.7680.673
  - Adjusted R2 reported as: 0.0330.2580.6570.7490.7330.644
  - F-Statistic reported as: 2.8464.52911.1532.6940.29.234
  - Prob. (F-Statistic) reported as: 0.02765.19e -05    1.34e -14    2.85e -321.18e -33    4.45e -10
  - Log-likelihood reported as: 266.61283.91329.13349.34342.96324.26
  - Durbin-Watson reported as: 1.9622.0381.9832.0191.9941.978
- Note: Standard errors are heteroscedasticity and autocorrelation robust (HAC) using 1 lags and without small sample correction. Asterisks indicate significance at 10 percent (*), 5 percent (**), and 1 percent level (***).

### Comparison with Baltic Dry Index (BDI) forecasts (Table 2 and Figure 8)
- BDI historically provided an early indicator of world trade developments (e.g., Global Financial Crisis late 2008-early 2009).
- Regression (Sample: May 2006-January 2020, 165 observations) results (Table 2):
  - Constant 0.0030 (0.0016)*
  - BDI 0.0240 (0.0070)***
  - BDI(-1) 0.0180 (0.0074)**
  - BDI(-2) 0.0228 (0.0075)***
  - BDI(-3) 0.0077 (0.0075)
  - BDI(-4) 0.0240 (0.0073)***
  - Diagnostics:
    - R2 0.2424
    - Adjusted R2 0.2186
    - F-Statistic 10.1751
    - Prob. (F-Statistic) 0.0001
    - Durbin-Watson 1.3500
- Forecast comparison as of April 16, 2020 (information available: world trade up to January 2020, SWIFT up to March 2020, BDI up to mid-April):
  - BDI forecast predicted a significant decline until May 2020 followed by a rapid rebound in June and July (blue line in Figure 8).
  - SWIFT forecast predicted a slower decline until March 2020 followed by a more rapid decline until July 2020 (red line in Figure 8).
  - Actual data through May 2020 showed a rapid decline in February/March matching the BDI, followed by a much sharper decline in April than either forecast predicted.
  - Overall: BDI forecasts performed better one- to two-months ahead; SWIFT performed better over the longer forecast horizon.
  - Short-term advantage of BDI may reflect availability of data up to mid-April 2020 versus SWIFT data only up to March 2020.

### Comparison with autoregressive statistical model (AR(2))
- The statistical AR(2) model:
  - Based on past lags of world trade only; excludes explanatory variables such as Brent, SWIFT, PMI.
  - Does not cover all countries: excludes about 9 percent ($1.5 trillion annually on the import side) of world trade compared with the CPB measure.
- Forecast behavior during COVID:
  - January–February 2020: both SWIFT and AR(2) showed relatively flat projections.
  - March–May 2020: SWIFT predicted a significant decline; AR(2) signaled a relatively flat forecast or only an initial decline.
  - June 2020: AR(2) became significantly more pessimistic than SWIFT and correctly predicted a steep decline that occurred in April 2020.
  - July–August 2020: SWIFT signaled a moderate rebound; AR(2) predicted continued decline despite a June correction.
  - CPB data for June showed a larger rebound than SWIFT predicted.
  - AR(2) generally provides forecasts over two to three months; SWIFT provides up to six months.
- Overall assessment:
  - AR(2) forecasts well during normal times and captures trend growth in world trade.
  - Being purely backward-looking, AR(2) is unable to pick up turning points as early as BDI or SWIFT.

### SWIFT and national customs trade: correlation and regression findings
- Correlation analysis uses 40 countries (list of economies provided in source).
- Simple contemporaneous correlation between SWIFT messages and national merchandise exports/imports shows:
  - Highest correlations driven by Turkey and Asian countries: Korea, China, Vietnam, Bangladesh, Indonesia, Malaysia, Thailand.
  - Lowest correlations for several advanced economies: Ireland, Sweden, Belgium, Norway, Japan, United States; and emerging markets: Colombia, Philippines, South Africa, Poland.
  - Contemporaneous correlation likely understates overall correlation due to lagged relationships.
- Country-level regression approach:
  - Linear regressions estimated separately for exports and imports for each of the 40 countries (80 regressions) in log differences using lagged customs data, Brent, and national manufacturing PMI where available; OLS with HAC standard errors.
  - Results broadly match the contemporaneous correlation structure, with SWIFT coefficients positive and significant where SWIFT matters.
- Regional and country highlights:
  - Asia:
    - High R2 range reported as (0.60-0.79) for selected regressions.
    - Bangladesh, India, Korea, Thailand, Vietnam exports; and China, Indonesia, Korea, Malaysia, Vietnam imports show relatively high R2 and positive, significant SWIFT coefficients.
    - Hong Kong SAR and Japan show insignificant or wrongly signed SWIFT coefficients—likely due to banks domiciled there intermediating SWIFT messages for other countries.
  - Europe:
    - Significant SWIFT coefficients for France, Italy, Latvia, Lithuania, Norway, Sweden exports; and Latvia, Lithuania, Russia imports, with R2 in (0.49-0.78).
    - Insignificant SWIFT coefficients for Belgium, Denmark, Estonia, Germany, Ireland, Netherlands, Poland, Portugal, Spain, United Kingdom (both exports and imports); United Kingdom’s financial center role likely blurs the relationship.
  - Western Hemisphere:
    - Significant SWIFT coefficients for Mexico exports, and Brazil, Chile, Mexico imports, with R2 in (0.54-0.88).
    - Insignificant coefficients for Canada, Colombia, United States (both exports and imports); U.S. banks may intermediate SWIFT messages for other countries.
  - Middle East:
    - Israel: SWIFT coefficients significant on both export and import side; R2 0.62 (export) and 0.72 (import).
    - Turkey: SWIFT coefficients highly significant on both sides; R2 0.70 (export) and 0.72 (import).
  - Africa:
    - Ghana: SWIFT coefficients significant for imports (contemporaneous and lags 1 and 3); R2 0.50.
    - Nigeria: SWIFT coefficients significant on exports (contemporaneous and lags 1 and 2); R2 0.41.
    - South Africa: SWIFT coefficients insignificant for both exports and imports—possible intermediating by South African banks for other countries.
- Figure 10 reports contemporaneous correlations and marks significance of positive SWIFT coefficients at 10 percent (*), 5 percent (**), and 1 percent (***) levels.

### Machine-learning vs. linear regression: overview and intent
- A “horse race” between linear regression and machine-learning forecasts is presented to assess non-linearities in the SWIFT–trade relationship.
- The section provides an overview and overall assessment of linear regression and machine-learning forecasts for world trade and the 40 countries.
- Detailed description of the machine-learning algorithms (MLAs) and comparison methodology is referenced for further detail (beyond the provided extract).

*Source: Authors’ regression results and analysis as presented in the supplied IMF document.*

### Appendix III. Appendix IV provides a description of the forecast methodology used.

### Appendix III. Appendix IV provides a description of the forecast methodology used.

### Linear Regression Forecasts
- Linear regression forecasts are built using the estimated regressions of equation (1) to forecast one-step ahead and then recursively forecasting longer horizons.
- Customs data are extended using the one-step ahead forecast.
- SWIFT data are generally available one to three months ahead of the customs data; for the remainder, SWIFT data are extended through an AR(1) process.
- Brent crude oil prices are extended through the closing futures prices on the date of the forecast for the one-, three-, and six-month contracts, while interpolating the other months.
- The new export orders subcomponent of the PMI is usually available one to three months ahead of customs data; for the remainder of the forecast horizon it is extended through an AR(1) process.
- Example (April 16, 2020):
  - CPB world trade data available up to January 2020; SWIFT up to March 2020 indicated a significant decline.
  - Brent crude oil prices fell from $68 per barrel in early January to $27 per barrel on April 16.
  - New export orders subcomponent of the global manufacturing PMI fell from 49.5 in January to 43.0 in March.
  - The linear regression forecast on April 16, 2020 indicated a significant decline in world trade going forward.

### Machine-learning forecasts (MLAs)
- Three MLA categories used: linear, single nonparametric, and ensemble nonparametric.
  - Linear MLAs: Lasso and Ridge regressions.
  - Single nonparametric MLAs: Decision Tree Regression and Support Vector Regression.
  - Ensemble MLAs: Bagging, Gradient Boost, and Random Forest (tree-based ensembles).
- Each MLA is trained over the full sample period and then used to produce one- to six-month ahead forecasts using the same one-step ahead approach as linear regressions.
- Example (Korea imports, April 16, 2020):
  - Korea merchandise import data for March 2020 signaled a rebound.
  - SWIFT, Brent futures, and Korea’s PMI new export orders signaled a decline; linear regression forecast projected a steep decline up to May 2020 before a rebound in June and July.
  - Customs data subsequently showed a trough in April instead of May.
  - The Lasso forecast marginally outperformed the linear regression in capturing the pattern, but the difference in forecast errors was marginal.

### Evaluation of linear and machine-learning forecasts
- Evaluation metric: root mean squared error (RMSE).
- Training set: subsample up to May 2019. Test set: June 2019 to May 2020, evaluated with monthly rolling forecasts and RMSEs for one- through six-month ahead forecasts.
- Latvia imports example:
  - RMSEs range between 5 and 14 percent.
  - Shorter horizons: linear regression, ridge, support vector regression, and lasso have much smaller RMSEs than other forecasts.
  - Over longer horizons (five to six months) this advantage disappears.
  - Interpretation: linear regression methods have clear short-run advantage for Latvia; advantage fades at longer horizons.
- Aggregate performance:
  - Linear regression forecasts perform best over a 1-month ahead forecast in nearly half the sample.
  - When including Lasso and Ridge, the share increases to two thirds of the sample.
  - Implication: the relationship between SWIFT trade messages and merchandise trade is largely linear for most countries.
- Formal testing:
  - All forecasts evaluated using the Diebold-Mariano (DM) test against a naïve forecast (simple average growth rate of exports/imports).
  - A few countries have statistically significant forecasts different from the naïve forecast, indicating scope to improve forecasts by adding explanatory variables.

### Selected forecast performance statistics (Diebold-Mariano one-step ahead examples from Table 3)
- World (Best Forecast: Linear Regression): DM Statistic -1.2926; P-Value 0.1961; RMSE 0.0235; Naïve RMSE 0.0539.
- Chile (Exports, Best Forecast: Random Forest): DM Statistic 3.7222; P-Value 0.0002; RMSE 0.0801; Naïve RMSE 0.0709.
- Ghana (Imports, Best Forecast: Linear Regression): DM Statistic -4.0206; P-Value 0.0001; RMSE 0.1095; Naïve RMSE 0.1443.
- Korea (Imports, Best Forecast: Lasso): DM Statistic -2.3016; P-Value 0.0214; RMSE 0.0420; Naïve RMSE 0.0611.
- Latvia (Imports, Best Forecast: Linear Regression): DM Statistic -2.3876; P-Value 0.0170; RMSE 0.0501; Naïve RMSE 0.1097.
- Notes: Bolded forecasts in the original table indicate DM tests significant at the 95th percentile.

### Conclusions and implications
- SWIFT trade messages, Brent crude oil prices, and the PMI new export orders subcomponent are useful predictors for short-term merchandise trade.
- Although SWIFT messages finance 15 percent of world trade, they have predictive power for world trade and can help detect turning points, especially for forecasting trade in Asia.
- Limitations:
  - The national-level relationship between SWIFT messages and merchandise trade is blurred in economies hosting financial centers (Hong Kong SAR, Japan, the United Kingdom, the United States), making SWIFT less reliable for those national forecasts.
- Forecast methodology insights:
  - Linear regression and its Lasso and Ridge variants outperform many non-linear MLAs in about two thirds of the sample, supporting a predominantly linear relationship between SWIFT messages and merchandise trade.
  - Future research should assess whether SWIFT-based forecasts statistically outperform forecasts based on the Baltic Dry Index or on a simple autoregressive process.

*Source: wpiea2020247-print-pdf - Appendix III. Appendix IV provides a description of the forecast methodology used. (https://www.imf.org/-/media/files/publications/wp/2020/english/wpiea2020247-print-pdf.pdf)*

### Appendix I—International Trade Financing

### Appendix I—International Trade Financing

### Overview
- This appendix summarizes the four main ways in which international trade can be financed.
- It draws heavily from earlier work by Niepmann and Schmdt-Eisenlohr (2017).
- The four methods of trade financing are: cash-in-advance, open account, letter of credit, and documentary collection.
- Each method has tradeoffs in terms of risks and financial costs for the exporter and importer.

### Tradeoffs (summary from Table I.1)
- A. Cash-in-advance
  - Risks: Exporter None; Importer Large
  - Financial Costs: Exporter None; Importer Medium
- B. Open account
  - Risks: Exporter Large; Importer None
  - Financial Costs: Exporter Medium; Importer None
- C. Letter of credit
  - Risks: Exporter None; Importer None
  - Financial Costs: Exporter Medium; Importer Medium
- D. Documentary collection
  - Risks: Exporter Medium; Importer None
  - Financial Costs: Exporter Large; Importer None

### A. Cash-in-advance
- Mechanism:
  - Importer prepays the exporter for delivery of imported goods.
  - Importer normally draws on a credit from a domestic bank to finance the imported goods in advance of their delivery.
  - Once sold, the importer repays the credit line with interest.
- Allocation of risk and cost:
  - Risks and financial costs fall exclusively on the importer.
  - Importer bears risk that goods will not be delivered on time or will be of substandard quality.
  - Importer bears financial cost of paying interest on its credit line.
  - Exporter bears no risks or financial costs because payment is received in advance (except potential cross-border litigation risk).
- Prevalence:
  - Most prevalent in low-income countries, where importers lack access to other forms of trade financing or where the cost of financing is prohibitive.

### B. Open account
- Mechanism:
  - Legal contract requiring the importer to pay the exporter once goods are received.
  - Importer can verify quality and charge penalties for delays before payment.
- Allocation of risk and cost:
  - Risks and financial costs fall exclusively on the exporter.
  - Exporter assumes risk of producing and shipping goods ahead of payment.
  - Exporter needs working capital to produce and ship until payment is received.
- Prevalence:
  - Very common among advanced economies due to easier contract enforcement and long-standing, trust-based relationships.

### C. Letters of credit
- Mechanism:
  - Also called documentary credit.
  - A guarantee by the bank servicing the importer to pay the exporter once the exporter produces documents (normally a bill of lading) proving the goods have been shipped.
  - Letter of credit is usually presented once the goods are ordered and extinguished once the goods are shipped.
  - Exporter can use the letter of credit as collateral to request a credit line from its bank; importer can obtain a credit line from its bank once goods are shipped until sold.
  - Importing bank usually charges the importer a fixed fee and interest on a letter of credit.
- Allocation of risk and cost:
  - Risks and financial costs are shared between importer and exporter.
  - Risk borne by exporter until goods are shipped, then by importer.
  - Exporter pays interest for working capital until goods are shipped; importer pays for the credit line after shipment.
  - Fees for the letter of credit are often split between importer and exporter, but this varies.
- Prevalence and other features:
  - Most frequently used for trade with emerging markets, particularly in Asia.
  - Mitigates risks and shares financial burden while generating fees and interest income for banks.
  - Mitigates likelihood of legal disputes because letters of credit are usually governed by rules and regulations established by the International Chamber of Commerce (ICC).

### D. Documentary collection
- Mechanism:
  - Transfer of shipping/ownership documents from the exporter (or exporter’s bank) to the importer’s bank.
  - Importer’s bank transfers documents to the importer only after payment is made to the exporter.
  - No guarantee of payment (unlike a letter of credit); serves as a form of insurance that importer will pay upon receipt.
- Allocation of risk and cost:
  - Exporter carries the risk and the financial cost.
  - Advantage over open account: ensures prompt payment once goods are received.
  - Nonetheless, risk and financial cost remain borne by the exporter.
- Prevalence and trends:
  - Relatively new means of financing global trade.
  - According to the ICC, documentary collections accounted for about one tenth the volume of letters of credit in 2017 and their use declined significantly that year.

*wpiea2020247-print-pdf - Appendix I—International Trade Financing*

### Appendix II—Charts and Linear Regression Results

### Appendix II—Charts and Linear Regression Results

### Overview findings
- SWIFT trade-message measures enter positively in most country regressions and are often statistically significant. Examples below preserve coefficient estimates and significance levels as reported in the tables.
- Lagged trade growth terms (imports or exports with lags 1–4) commonly have negative coefficients, reflecting autoregressive dynamics in trade growth.
- Commodity-price controls (BRENT) show positive and often significant coefficients in many country regressions; effects vary in timing and magnitude by country.
- PMI controls show mixed effects: in some regressions PMI coefficients are positive and significant (for example, France Exports: PMI 0.0068 (0.002)***), while in others PMI coefficients are small or insignificant.
- Diagnostics frequently report high goodness-of-fit (R2) for many country regressions; Durbin–Watson statistics are generally near 2, indicating limited residual autocorrelation under HAC standard errors.

### Country-specific regression highlights (coefficient on SWIFT, observations, R2, adjusted R2)
- Bangladesh (Exports)
  - SWIFT: 0.4586 (0.115)***
  - Observations: 111
  - R2: 0.686
  - Adjusted R2: 0.64

- Brazil (Imports)
  - SWIFT: 0.041 (0.016)**
  - Observations: 112
  - R2: 0.546
  - Adjusted R2: 0.452

- Chile (Imports)
  - SWIFT: 0.1739 (0.048)***
  - Observations: 112
  - R2: 0.641
  - Adjusted R2: 0.567

- China (Imports)
  - SWIFT: 0.1699 (0.056)***
  - Observations: 112
  - R2: 0.62
  - Adjusted R2: 0.541

- France (Exports)
  - SWIFT: 0.0633 (0.029)**
  - Observations: 111
  - R2: 0.725
  - Adjusted R2: 0.667

- Ghana (Imports)
  - SWIFT: 0.095 (0.03)***
  - Observations: 111
  - R2: 0.496
  - Adjusted R2: 0.422

- India (Exports)
  - SWIFT: 0.1388 (0.06)**
  - Observations: 111
  - R2: 0.789
  - Adjusted R2: 0.745

- Indonesia (Imports)
  - SWIFT: 0.1133 (0.04)***
  - Observations: 107
  - R2: 0.698
  - Adjusted R2: 0.632

- Israel (Exports)
  - SWIFT: 0.04 (0.029)
  - Observations: 111
  - R2: 0.62
  - Adjusted R2: 0.541

- Israel (Imports)
  - SWIFT: 0.0294 (0.026)
  - Observations: 111
  - R2: 0.721
  - Adjusted R2: 0.663

- Italy (Exports)
  - SWIFT: -0.0075 (0.027)
  - Observations: 111
  - R2: 0.784
  - Adjusted R2: 0.739

- Korea (Exports)
  - SWIFT: 0.1608 (0.059)***
  - Observations: 112
  - R2: 0.595
  - Adjusted R2: 0.511

- Korea (Imports)
  - SWIFT: 0.2637 (0.053)***
  - Observations: 112
  - R2: 0.663
  - Adjusted R2: 0.594

- Latvia (Exports)
  - SWIFT: 0.0384 (0.015)**
  - Observations: 111
  - R2: 0.524
  - Adjusted R2: 0.454

- Lithuania (Exports)
  - SWIFT: 0.0377 (0.011)***
  - Observations: 111
  - R2: 0.492
  - Adjusted R2: 0.417

- Malaysia (Imports)
  - SWIFT: 0.1041 (0.043)**
  - Observations: 92
  - R2: 0.74
  - Adjusted R2: 0.671

- Mexico (Exports)
  - SWIFT: 0.0338 (0.006)***
  - Observations: 107
  - R2: 0.876
  - Adjusted R2: 0.849

- Nigeria (Exports)
  - SWIFT: 0.0706 (0.039)*
  - Observations: 109
  - R2: 0.408
  - Adjusted R2: 0.32

- Norway (Exports)
  - SWIFT: 0.0489 (0.02)**
  - Observations: 111
  - R2: 0.53
  - Adjusted R2: 0.432

- Russia (Imports)
  - SWIFT: 0.0723 (0.016)***
  - Observations: 111
  - R2: 0.506
  - Adjusted R2: 0.403

- Thailand (Exports)
  - SWIFT: 0.1461 (0.057)**
  - Observations: 51
  - R2: 0.703
  - Adjusted R2: 0.522

- Turkey (Exports)
  - SWIFT: 0.1045 (0.039)***
  - Observations: 112
  - R2: 0.696
  - Adjusted R2: 0.634

- Turkey (Imports)
  - SWIFT: 0.2715 (0.044)***
  - Observations: 112
  - R2: 0.718
  - Adjusted R2: 0.66

- Vietnam (Imports)
  - SWIFT: 0.3278 (0.069)***
  - Observations: 109
  - R2: 0.683
  - Adjusted R2: 0.616

### Common control-variable patterns
- BRENT (oil price) coefficients:
  - Frequently positive and significant; examples include Bangladesh BRENT 0.4256 (0.232)**, China BRENT 0.1033 (0.038)***, France BRENT 0.1247 (0.032)***, Korea (imports) BRENT 0.0254 (0.032) (not significant), Russia BRENT 0.1727 (0.043)***, Norway BRENT 0.3253 (0.06)***.
- PMI coefficients:
  - Positive and significant in some country regressions (e.g., France PMI 0.0068 (0.002)***; India PMI 0.0142 (0.002)***), mixed or insignificant in others.

### Regression estimation and inference details
- Standard errors reported in parentheses are heteroskedasticity and autocorrelation robust (HAC) using 1 lag and without small sample correction.
- Asterisks indicate significance at the 10 percent (*), 5 percent (**), and 1 percent (***) levels.
- Durbin–Watson statistics in the reported regressions are generally close to 2 (examples: Bangladesh 1.953; Brazil 2.035; Chile 2.087; China 2.008), suggesting limited residual autocorrelation under the HAC standard errors used.

*The full set of charts and regression results are available from the authors.*

### Appendix III—Machine-Learning Algorithms

### Appendix III—Machine-Learning Algorithms

### Overview
- MLAs have grown in importance to establish correlation structures within big data and to identify both linear and non-linear correlations.
- In this paper, MLAs are used to provide alternative methods to identify correlation structures between SWIFT and trade data that may not be captured by linear regression.
- One contribution is to investigate whether complex methods outperform simple and interpretable linear regression in predicting trade; results show that in this case, linear regression is generally more suitable.
- MLAs can be classified into parametric and non-parametric methods; the paper uses two parametric MLAs (Ridge and LASSO) and six nonparametric MLAs (Decision Tree Regression, Support Vector Regression, Bagging, Random Forest, and Gradient Boost). Among non-parametric MLAs, Decision Tree Regression, Support Vector Regression, and Neural Network are described as single methods, while Gradient Boost, Bagging, and Random Forest are ensembled methods.

### Parametric MLAs
- Purpose: alternative regression methods to improve fit under specific correlation structures and to address multi-collinearity.
- Methods used: Ridge and LASSO regressions.
- Key characteristics:
  - Both are based on standard linear regression plus regularization to reduce variance.
  - Both use all variables and adjust coefficient estimates of non-significant variables to shrink regressors towards zero.
  - Difference: Ridge keeps all regressors; LASSO can assign zero coefficients and drop some regressors, producing a more parsimonious model.
- Loss functions (as presented):
  - OLS loss function: f(ω) = Σ(y_i − x_i^T ω)^2
  - Ridge: f(ω) = Σ(y_i − x_i^T ω)^2 + λ Σ ω_j^2, where λ is the regularization penalty degree.
  - LASSO: f(ω) = Σ(y_i − x_i^T ω)^2 + λ Σ |ω_j|, and ω_j can be zero for statistically insignificant regressors.
- Use case: useful in datasets with large potential regressors and no clear ex-ante correlation structure; LASSO helps home in on a statistically significant linear parsimonious model.

### Non-parametric MLAs (single-method)
- General: Do not assume a particular correlation structure; derive correlation structure from operations that divide data into subsets or derive bimodal distributions.
- Single-method examples in the paper: Decision Tree Regression and Support Vector Regression (SVR); Neural Network is mentioned as a single method.
- Decision Tree Regression:
  - Captures nonlinearity by dividing data into homogeneous subsets to minimize overall standard deviation.
  - Uses a top-down binary approach choosing the attribute that yields largest standard deviation reduction across generated subsets.
  - Tradeoff: between subset size and minimization of standard error; effective when subsets are homogeneous.
  - Illustrated example: dataset split into subsets R1, R2, R3 with local means Y = 2 (R1), Y = 5 (R2), Y = 6.67 (R3) to capture a highly non-linear global mean.
- Support Vector Regression (SVR):
  - Fits observations using a fixed-width stripe instead of a line; seeks a stripe covering as many observations as possible to minimize aggregate standard error.
  - Stripe can be non-linear; SVR can turn a nonlinear problem into a linear one by mapping regressors into a higher dimensional space via a kernel function.
  - Example: for f(x) = 2X^2 + ε, ε ∈ (0,1), transform with Φ(x) = X^2 so f(x) = 2Φ(x) + ε becomes linear in Φ(x).
  - Kernel types: linear, polynomial, radial basis function, sigmoid.

### Non-parametric ensemble MLAs
- General: combine predictions from multiple single-method models to generate a more accurate forecast.
- Ensemble methods discussed: Gradient Boost, Bagging (bootstrap aggregating), and Random Forest.
- Bagging:
  - Extracts subsamples via bootstrapping to produce N independent training sets; fits base method on each and averages outcomes (equal importance) for regression problems.
- Gradient Boosting:
  - Iteratively estimates models using residuals of previous models; each model trained on residuals (example: true value 10, first model predicts 6 → residual 4; second predicts 3 → residual 1; final prediction aggregates 6 + 3 + ...).
  - The implementation used in the paper chooses the fastest direction to reduce residuals and shrinks the learning rate during iterations to avoid overfitting.
- Random Forest:
  - Parallelly selects a random subset of input variables to train Decision Tree regressions and averages results across trees.
  - Example: with inputs X = {X1, X2, X3, X4, X5} and three trees producing predictions k1, k2, k3, final output k = (k1 + k2 + k3)/3.
- In practice, Decision Tree Regression is the most frequently used base method for ensembles.

### Under- and over-fitting; hyperparameter tuning
- Underfitting: when model fails to capture underlying structure (e.g., fitting linear model to non-linear trade and SWIFT data).
- Overfitting: when model fits noise as well as signal, performing poorly out-of-sample.
- MLAs have hyperparameters that determine structure and influence the degree of overfitting; Ridge penalty degree λ is one such hyperparameter.
- To avoid overfitting, select optimal hyperparameters to balance in-sample and out-of-sample performance.
- K-fold cross-validation:
  - Common method to avoid overfitting by minimizing out-of-sample forecast error.
  - Example when K = 5: in-sample training set is randomly partitioned into 5 equally sized subsets; each subset in turn is used as validation while the remaining 4 constitute training.
- Conclusion: MLAs can overcome underfitting of OLS and avoid overfitting by finetuning hyperparameters to generate relatively lower forecast errors.

### Advantages and disadvantages of MLAs versus linear regressions
- Linear regressions:
  - Require strong assumptions: linear (or log-linear) relationship, multivariate normality, limited multicollinearity, no autocorrelation, and homoscedasticity.
  - If assumptions hold, provide parametric estimation with explanatory power and globally valid forecasts.
  - If assumptions fail, estimates and out-of-sample forecasts may be misleading.
- MLAs:
  - Do not impose ex-ante parametric structure; can cover wide array of functional forms and select features to capture non-linear correlations.
  - More effective with multicollinearity and can detect interaction terms automatically.
  - Main advantages: flexibility to identify complex and hidden relationships.
  - Main disadvantages: risk of overfitting, potential to identify wrong functional forms, and lack of parametric representation (except Lasso and Ridge) making interpretation more difficult.

*Appendix III—Machine-Learning Algorithms (content unit)*

---


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