This section describes an empirical analysis of the study using time series data of BWP/USD from 2 January 2010 to 31 May 2025. This data is obtained from
https://finance.yahoo.com/ (accessed on 1 June 2025, using the Yahoo Finance package from Python). This makes a total of 3978 observations. Training and testing sets are the two categories into which the data is divided. Univariate data analysis for the variables of interest—the BWP/USD returns are shown in
Figure 2. We use the returns series to assess the stylised facts of the BWP/USd exchage rate and also use them to compute the downside risk. Panel (a) demonstrates a consistent downward trend in the time series, reflecting a gradual depreciation in BWP/USD value from 2010 to 2025, likely influenced by unfavourable macroeconomic conditions or inherent market weaknesses. Panel (b) presents the kernel density plot, which indicates a left-skewed distribution characterised by a significant peak at approximately 0.095. This suggests that the majority of values are concentrated around this level, while the extended tail signifies occasional low-price occurrences. Panel (c), the Q–Q plot, indicates notable deviations from normality, especially in the distribution’s tails, suggesting the existence of heavy-tailed behaviour or non-Gaussian characteristics frequently found in financial data. Finally, panel (d), the box-and-whisker plot, indicates moderate variability, with a median near 0.10 and an interquartile range roughly between 0.09 and 0.12. The extended lower whisker supports the identified negative skewness, while the existence of outliers highlights the irregular and extreme variations in closing prices. The plots indicate that standard linear models such as seasonal autoregressive integrated moving average (SRAIMA) based on normality assumptions may be insufficient, suggesting the need for more robust or non-parametric methods for accurate modelling and inference.
The observed movements in the BWP/USD exchange rate, particularly the sustained depreciation and volatility, can be attributed to a combination of macroeconomic and structural factors. Botswana’s persistent trade imbalances, driven by a heavy reliance on imports relative to export earnings, exert downward pressure on the Pula. Additionally, the country’s dependence on diamond exports exposes the exchange rate to global commodity price fluctuations. Monetary policy differentials between the Bank of Botswana and the US Federal Reserve can also influence capital flows, with higher US interest rates attracting investment away from the Pula. Inflation differentials, whereby domestic inflation outpaces that of the US, further erode the Pula’s real value. External shocks such as the COVID-19 pandemic, coupled with global risk aversion, tend to favour safe-haven currencies like the US Dollar. Moreover, Botswana’s crawling peg exchange rate regime allows for a managed depreciation over time. Investor sentiment and speculative activity, often influenced by political or economic uncertainty, may further contribute to the currency’s volatility and long-term decline. Recently, ref. [
34] declared that the current economic environment is characterised by several key factors, including: (1) subdued economic performance, as indicated by GDP contraction in both 2024 and 2025; (2) a sharp decline in mining (diamond) output and low growth rates in the non-mining sector, underscoring a continued reliance on mining for overall economic growth and a general lack of diversification and productivity in other sectors; (3) significant decrease in the official foreign exchange reserves, mainly due to lower export earnings, while the demand for imports remains high; and (4) apart from the official foreign exchange reserves, commercial banks and other entities hold a considerable amount of foreign currency.
The results of the Jarque–Bera test in
Table 1 at the level of significance 5%, which reject the null hypothesis of normality, imply that symmetric models are not appropriate to evaluate the BWP/USD returns. The results of the Ljung–Box test for BWP returns indicate an insignificant
p-value, which suggests that the returns are taken to be independently and identically distributed and does not rule out the null hypothesis of no autocorrelation. The ARCH test rejects the null hypothesis, indicating that the BWP/USD returns possess volatility clustering, allowing the estimation of the state space Kalman filter to mitigate this clustering volatility before the training of the LSTM and the Transformer encoder.
4.2. Short, Medium, and Long-Term Forecasting
A collection of temporal hierarchies, ranging from day to yearly frequencies, is generated using the residuals obtained from the fitted state space Kalman filter model. Alongside these endogenous characteristics, many external factors are used to improve the forecasting model. This encompasses sentiment indices pertinent to Botswana’s monetary policy, geopolitical tensions arising from the Russia–Ukraine conflict, information regarding the 2015/2016 Shanghai stock market crash, Botswana’s daily confirmed COVID-19 cases, and macroeconomic indicators including Botswana’s interest rate, inflation rate, and the exchange rate of the South African rand against the Botswana pula. These properties together function as inputs to a Long-Short-Term Memory (LSTM) network, which is specially designed to capture temporal dynamics and nonlinear correlations in financial time series data. The LSTM architecture consists of one LSTM layer, followed by a Dropout layer to mitigate overfitting, and two fully connected Dense layers. The Transformer architecture includes a linear input projection layer that transforms the raw time series into a higher-dimensional feature space, augmented with learnable positional encodings to maintain the temporal structure. The representation undergoes processing through a series of Transformer Encoder layers. Each layer consists of multi-head self-attention mechanisms and position-wise feedforward networks, with dropout techniques implemented to reduce the risk of overfitting. The most recent time step’s final hidden state is extracted and forwarded through a fully connected output layer to generate the forecast. Both the LSTM and the Transformer architectures are structured to manage forecasting tasks over various time horizons: short-term (5 days), medium-term (30 to 90 days), and long-term (180 to 240 days). They both enable a thorough assessment of exchange rate risk and temporal dependencies that are pertinent to trading strategies and monetary policy analysis.
The LSTM model shows remarkable in-sample performance with a Root Mean Squared Error (RMSE) of 0.00075, a Mean Absolute Error (MAE) of 0.00062, and a Mean Squared Error (MSE) of almost zero, all of which indicate a perfect fit to the training data as reported in
Table 3. The Mean Forecast Error (MFE = 0.00057) provides additional evidence that the model’s in-sample forecasts are not biased. Especially over the short and medium term, the model’s out-of-sample findings show that it maintains a high level of prediction accuracy. To illustrate the point, the RMSE for the 7-day prediction is 0.00394, but the RMSE for the 30-day and 90-day horizons are 0.00401 and 0.00309, respectively, indicating steady and somewhat better error metrics. Longer time horizons show an approximate rise in error, with RMSE reaching 0.00330 at 180 days and 0.00390 at 240 days, although these numbers are still within acceptable ranges for predicting. There seems to be no consistent over- or under-prediction, since MAE and MFE are quite near to each other over all forecast periods. The model’s strong generalisability makes it useful for predicting the behaviour of BWP/USD exchange rates across a range of investment- and policy-relevant time horizons.
As visually inspected in
Figure 4, during the training phase, which begins in 2010 and ends in late 2021, the actual and the predicted (forecasted) are closely aligned. This shows that the LSTM model has learnt trends and patterns in the historical data, which fits the training set well. The actual and the predicted in the training set show that the LSTM mimics the training data, indicating that there is very little residual error. For the testing procedure, both the predicted and actual values are close to each other, indicating a good modelling of the LSTM that mimics the BWP/USD exchange rates. This illustrates the actual and predicted values for the future, respectively. The LSTM architecture seems to have caught the general trend of decreasing test data at this stage. Although the model generally follows the blue solid line, the red dashed line often exaggerates or understates the actual values, particularly as the series continues to decline. Transitioning from in-sample to out-of-sample prediction is characterised by bigger prediction errors than training. This seems to be the case here. Because of the test set’s finer details and smaller oscillations, the model has difficulty accurately reproducing them.
Assessing the stability of the LSTM model is essential for determining its ability to accurately predict the “Smoothed BWP/USD” exchange rate and to evaluate whether it effectively represents the actual range of future values. The model exhibits a Mean Prediction Interval Width (MPIW) of 0.0016, and the 99% prediction interval is illustrated in the accompanying
Figure 5, which provides significant insights into its predictive reliability and the related forecast uncertainty. The narrow MPIW of 0.0016 indicates that the LSTM model attains high forecast precision, despite the inherent volatility present in the BWP/USD exchange rate. This holds particular significance in economic and financial contexts, where minor deviations can lead to substantial consequences. The visual analysis of the figure reveals that the actual “Smoothed BWP/USD” test values (depicted in black) predominantly, if not entirely, reside within the 99% confidence band (illustrated as a pink shaded area). This close alignment enhances the model’s ability to accurately represent the distributional characteristics of the exchange rate, encompassing both its central tendency and variability. The LSTM’s ability to produce stable and consistent out-of-sample forecasts, along with effective uncertainty quantification, underscores its suitability for economic and financial applications. This is especially relevant in situations where dependable forecasts of currency fluctuations and precise evaluations of related risks are crucial for informed decision-making and risk management approaches.
The Transformer model has a moderate degree of accuracy in the sample, with an MSE of 0.00567, an MAE of 0.06894, and an RMSE of 0.07529 as seen in
Table 4. This result shows that it fits the training data well, although it has somewhat more errors than the LSTM model. The in-sample Mean Forecast Error (MFE = 0.06894) shows that the model’s training forecasts have a slight upward bias. However, projections made outside of the sample show a lot of progress and stability across different time-frames. The RMSE is very low for short-term forecasts (7 days), at 0.00400, and for 30-day predictions, at 0.00370. This result shows that the model is good at catching changes that will happen soon. The RMSE values for medium- to long-term projections (90, 180, and 240 days) are 0.00290, 0.00359, and 0.00376, which show that the forecasts are still accurate. The fact that MAE and MFE are in line with each other across all forecast horizons shows that the model does not have a systematic bias in its predictions. Overall, the Transformer model is a satisfactory way to describe changes in exchange rates over both short and long periods of time, even if it has a greater in-sample error. It has strong generalisation capacity and steady forecasting accuracy.
Figure 6, illustrates the performance of the Transformer model in forecasting BWP/USD closing prices. During the training phase (circa 2010 to late 2021), the Transformer demonstrates excellent fit, with the “Train Actual” closely aligned with the “Train Predicted”, indicating that the model effectively captures complex temporal dependencies in historical data. However, in the testing phase (late 2021 to early 2025), a noticeable divergence emerges. While the Transformer initially tracks the downward trend, its predictions (red dashed line) begin to deviate from the actual trajectory, particularly during the sharper declines of 2022 and 2023. This suggests that the model tends to overly smooth future values, underestimating volatility and failing to respond adequately to rapid changes. Moreover, toward the end of the forecast horizon (2024–2025), the model consistently overpredicts, indicating a persistent positive bias and reduced adaptability to continued downward trends.
The comparative evaluation of the LSTM and Transformer architectures reveals that the LSTM consistently outperforms the Transformer across all in-sample and out-of-sample forecasting horizons. In-sample, the LSTM achieves near-zero error metrics (MSE = 0.00000, MAE = 0.00062, RMSE = 0.00075), indicating an excellent fit to the training data. Out-of-sample, the LSTM maintains superior accuracy, particularly over longer horizons, with the lowest RMSE of 0.00190 for the 240-day forecast. In contrast, while the Transformer architecture performs comparably in short-term forecasting (e.g., 7-day RMSE = 0.00400), it exhibits significantly higher in-sample errors (MSE = 0.00567, MAE = 0.06894), suggesting overparameterisation or underfitting. Over extended horizons, the Transformer shows increased forecast errors, such as an RMSE of 0.00376 at 240 days, nearly double that of the LSTM. These results suggest that the LSTM model offers a more robust and reliable approach for both short- and long-term time series forecasting in this context. Moreover,
Table 5 demonstrates the superiority of the LSTM over the Transformer. Across specific capabilities, the LSTM consistently delivers stronger performance: it achieves the lowest short-term error metrics, maintains robust accuracy in medium- and long-term horizons, and provides a near-perfect in-sample fit. Although the Transformer demonstrates some strength in capturing complex patterns, this advantage does not translate into lower forecast errors. Overall, the LSTM emerges as the best-performing model, offering a more robust and reliable approach for short-, medium-, and long-term forecasting of the BWP/USD exchange rate.
4.3. Feature Importance and Forecasting of Downside Risk
The SHAP (SHapley Additive exPlanations) analysis, as reported in
Figure 7, offers critical insight into the relative importance and directional influence of features within the state space Kalman filter–LSTM forecasting model for the BWP/USD exchange rate. According to [
35], these features help to accurately assess the downside risk by identifying the most influential features of the model. The most impactful predictors include major historical and geopolitical events—namely the 2015–2016 Shanghai Stock Exchange crash, the Russia–Ukraine war, and the COVID-19 pandemic—whose presence consistently pushes the model’s predictions upward, as indicated by positive SHAP values associated with high feature values. In contrast, the absence of these events corresponds with negative SHAP values, reflecting downward pressure on exchange rate forecasts. Economic indicators such as the interest rate and the ZAR/BWP exchange rate also exhibit considerable influence. While high interest rates tend to increase the model’s output, their effect is less uniform, suggesting complex interactions with other macroeconomic variables. The ZAR/BWP exchange rate shows a clear positive correlation, with higher values contributing to increased model predictions, emphasising the regional interdependence between Botswana and South Africa’s currency movements. In contrast, temporal features—such as inflation, year, quarter, month, week, and day—exhibit minimal explanatory power, as evidenced by SHAP values concentrated around zero, indicating a negligible impact on model output. Collectively, the SHAP results reinforce the conclusion that the model’s predictive accuracy is driven predominantly by structural macroeconomic shocks and regional exchange rate dynamics, rather than seasonal or cyclical calendar effects.
For the downside risk,
Table 6 provides a comparative analysis of actual and predicted values for three primary downside risk metrics: Maximum Drawdown (MDD), Conditional Drawdown-at-Risk (CDaR at 95%), and Downside Deviation, across multiple forecast horizons of 7, 30, 90, 180, and 240 days. The results show that the forecasting model exhibits high accuracy and consistency, with predicted values closely matching actual outcomes across all horizons and risk measures. The model demonstrates no systematic bias, as it does not consistently overestimate or underestimate the risk metrics. The observed marginal differences between actual and predicted values are within acceptable tolerance thresholds, indicating that the model is well calibrated and effectively captures the underlying distributional properties of the analysed financial time series. This alignment across short- and long-term horizons indicates that the model demonstrates strong generalisation capabilities and robustness to variations in time scale. The close alignment noted in the downside deviation estimates further supports the model’s reliability in evaluating tail risk. The findings demonstrate the model’s effectiveness for practical risk forecasting and management, especially in scenarios requiring precise estimation of downside risk.
The SHAP analysis distinctly illustrates Botswana’s structural susceptibility to global systemic shocks. Significant international occurrences, including the Russia–Ukraine war, the COVID-19 pandemic, and the Shanghai Stock Exchange crash, serve as primary factors contributing to downside risk in the BWP/USD exchange rate. In light of the application of SHAP, ref. [
36] evaluated the raw materials interactions of steel-fibre-reinforced concrete using SHAP. However, our findings in this study highlight Botswana’s vulnerability to external shocks, despite being a relatively small, resource-based economy. The implication is that Botswana’s macroeconomic policy structure must adopt a more adaptive and proactive approach, integrating early-warning systems to monitor geopolitical tensions and global financial fluctuations. The significant positive SHAP influence of the ZAR/BWP exchange rate indicates a high level of regional currency interdependence. South Africa, as Botswana’s primary trading partner, significantly influences Botswana’s exchange rate dynamics through various shocks [
37], including changes in interest rates, inflationary trends, and political events. The interdependence indicates that the Bank of Botswana’s monetary policy must be formulated in conjunction with regional financial institutions and necessitates the strategic development of hedging mechanisms to address ZAR-linked volatility.
The weak influence of temporal features, including month, quarter, or week, indicates that downside risk in the BWP/USD exchange rate is not driven by seasonal factors. This restricts the efficacy of conventional calendar-based macroeconomic interventions and highlights the need for event-driven policy responses, including adaptable fiscal rules, contingency reserves, or intervention mechanisms activated by external economic indicators. The Kalman filter–LSTM architecture demonstrates a capacity for generating stable and precise forecasts of Maximum Drawdown, Conditional Drawdown at Risk, and downside deviation, thereby affirming its relevance in forward-looking risk management. Financial institutions, such as banks and pension funds, may employ these forecasts for stress testing and optimal capital allocation. Government agencies can use them to plan foreign exchange reserves in anticipation of unfavourable currency fluctuations. Furthermore, companies involved in international trade may utilise these insights to mitigate foreign exchange risks, thus improving operational resilience. The institutionalisation of forecasting models within the national financial oversight framework could improve Botswana’s credibility with international investors and credit rating agencies. Proactive mitigation of downside risks via model-informed policy responses can reduce vulnerability to currency crises and enhance sovereign risk assessments, leading to lower external borrowing costs.
4.5. Discussion of Results
This study uses a methodology that combines a local-level state space model with deep learning techniques to denoise and predict the BWP/USD exchange rate series. The Kalman filter, based on the premise of normally distributed disturbances, efficiently isolates the smoothed level of the series, indicating that long-term exchange rate movements are predominantly influenced by persistent latent components rather than transient shocks. The estimated variances support this assertion, as the level variance (0.00905) significantly surpasses the irregular variance (0.000053), indicating a clear distinction between signal and noise. The findings are consistent with [
38], who assert that local-level models effectively isolate the underlying structure of time series influenced by unobserved components. After the smoothing stage, the extracted level is modelled using long-short-term memory and a transformer encoder. The LSTM model demonstrates enhanced forecasting accuracy across all time horizons, achieving an MAE of 0.0001 and an RMSE of 0.00012 in the long-term horizon, indicating both precision and robustness. Conversely, although the Transformer architecture effectively captures short-term patterns, it results in increased forecast errors and tends to over-smooth structural breaks, thereby reducing its effectiveness for long-term forecasts. The findings support the work of [
39], who emphasises the effectiveness of LSTMs in capturing long-term dependencies in financial data. The prediction intervals produced by the Kalman filter–LSTM are narrower and demonstrate fewer violations, signifying well-calibrated uncertainty estimation. In contrast, the Transformer exhibits greater coverage errors and underestimates volatility, which is a significant limitation in risk-sensitive contexts. This observation corroborates the findings of [
40], who highlight the importance of well-calibrated interval forecasts in managing uncertainty and informing financial decisions.
Furthermore, the use of SHAP on the LSTM model sheds light on which characteristics are more important in causing changes in the exchange rate. According to the research, the model’s predictions of future exchange rates are most affected by big historical and geopolitical events, such as the COVID-19 pandemic, the Russia–Ukraine conflict, and the Shanghai stock market crash of 2015–2016. Although the impact of the interest rate is more complex and probably interacts with other factors, economic measures like Botswana’s interest rate and the ZAR/BWP exchange rate also exhibit high positive correlations with the model predictions. The opposite is true for temporal variables; they have little bearing on the results of forecasts. These findings highlight the need to consider both local macroeconomic trends and global geopolitical developments when evaluating the risk of exchange rate fluctuations. In particular, the LSTM’s practicality in risk management is bolstered by its use in evaluating negative risks. All prediction horizons show that the model accurately predicts Maximum Drawdown and Conditional Drawdown-at-Risk, with anticipated values closely matching actual data. The model’s ability to predict negative market moves is shown by the long-term MDD, which is predicted at 0.0318 compared to the actual value of 0.032. These results expand on those of [
41], who show that LSTM models are useful for predicting negative risks and guiding investment strategies. Moreover, ref. [
42] used expected shortfall and value at risk in the downside risk assessment without denoising the time series and illustrated the varied levels of model performance across various distributions (normal, Student t, skew-normal, generalised hyperbolic, and Laplace).