_ANDR EE_<sup>_ ́_</sup> _AND PAPE_ _SEPTEMBER 5, 2023_ _8_ The model (2) is estimated multiple times as the imputation process continuous to iterate over the data. Andr ́ee (2021) noted that the statistical properties of the data change throughout the imputation process, and that the ideal prediction model grows in flexibility as the process iterates. Specifically, in the sequence of models _{f_ 1<sup>_A, f_</sup> 2<sup>_A, ..., f_</sup> _I_<sup>_A}_for</sup><sup>_I_iterations,themodel</sup><sup>_f_</sup> _i_<sup>_A_</sup> may train on better data than model _fi_<sup>_A_</sup> _−_ 1<sup>andthusthecomplexityofthelearnermaygrowwiththedata.</sup> The application here performs the first half of iterations (set at 4) using an elastic net model (implemented by Hastie et al. (2021)). The penalties in the elastic net model help reduce the impact of uninformative predictors (Friedman et al., 2010). At iterations 5 through 8, a cubist regression is used following Quinlan (1992); Witten et al. (2016).

Cubist is a piece-wise linear model that combines decision trees, boosting, and neighborhood smoothing, that together allow the model to capture several features typical to spatial time series data, including smooth nonlinearities (Andr ́ee et al., 2019), spatial regime switches (Andr ́ee et al., 2017; Andr ́ee, 2020), as well as threshold nonlinearities (Tong, 2015). This makes the cubist nonlinearities model more suitable for numerical data than Random Forest-type nonlinearities (Kuhn et al., 2012).<sup>3</sup> The hyper-parameters of both models are tuned at each step. The modeltuning focuses on a Normalized Mean-Absolute-Error criterion, which is robust to outliers. The elastic net model optimizes over the standard _L_ 1 and _L_ 2 penalties and the mixing parameter (commonly denoted _α_ ). _L_ 1 penalizes likelihood by the absolute sum of coefficients, and _L_ 2 by the sum of squared parameter values, thereby discouraging large parameter estimates but having very different impacts when redundant parameters approach 0. Since exchange rates may suddenly drop (it is not uncommon for currencies in low-income countries to lose a peg), the institutional exchange rate is excluded from the linear elastic net model.

The decisive factor to use Cubist, and not say XGBoost, is that Cubist models are very fast to tune and validate. This is of critical importance to the application. In the current application, a relatively large number of food items is processed, and narrow set of tuning parameters is preferred over a wide one to make the computation feasible. The cubist model tunes over the neighborhood size used for smoothing, and the boosting iterations, using grid of _Neighborhood_ = (4 _,_ 6) _× Committees_ = (10 _,_ 25) combinations. Models are validated using _k_ = 4 folds, this means that _k_ + 1 _× Neighborhood × Committees_ = 20 model specifications provides an estimate of typical retail exchange rates.

> 3Cubist is an extension of M5 regression trees that incorporates pruning, neighborhood smoothing and boosting. Essentially is uses a computationally efficient strategy to recursively partition the data space and fit simple piece-wise linear prediction models within each partition, whose predictions are combined using neighborhood averaging of local model predictions. The advantages over M5 are that it can produce smoother transitions across numeric outputs, and much faster runtime. Both being of high importance to the current application. The advantages over Random Forest are that the cubist model has linear regressions at terminal nodes and so it can extrapolate slightly out of range, while Random Forests can only interpolate using medians or averages of typical values associated within the ranges of the input data.