Abstract
This paper introduces a new hybrid forecasting architecture that combines Nonlinear Autoregressive (NAR) models, the proxy Standardized Precipitation-Evapotranspiration Index (SPEI), and a Nonlinear Autoregressive with Exogenous Inputs (NARX) framework for Soil Moisture Index (SMI) prediction. The suggested methodology solves the crucial difficulty of combining future climatic knowledge into soil moisture forecasting by using a cascaded approach. Stage 1 uses univariate NAR models to create multi-step-ahead predictions of precipitation and temperature. Stage 2 converts these forecasts into proxy SPEI values using a physically based water balance computation, and Stage 3 employs a NARX model that uses observed historical SMI and forecast-derived proxy SPEI as exogenous inputs. The framework is assessed using high-frequency observations from 2014 to 2020, with training data through 2019 and validation covering the whole 2020 horizon. The study combining forecast-driven climatic indicators with autoregressive soil moisture dynamics resulted in prediction accuracy (R2 = 0.9888, RMSE = 0.0827, MAE = 0.0567). This study presents a new NAR–SPEI–NARX model for SMI prediction forecasting, based on three-stage modeling, where NAR models forecast precipitation and temperature and then turn them into SPEI-proxy as an exogenous input for NARX.
Keywords:
Soil Moisture Index (SMI); Standardized Precipitation-Evapotranspiration Index (SPEI); Nonlinear Autoregressive model (NAR); Nonlinear Autoregressive with Exogenous Inputs (NARX); time series MSC:
62-04; 62-07; 62P12
1. Introduction
Hydrological variables like soil moisture affect agricultural production, water re-source management, and land–atmosphere interactions. Drought monitoring, irrigation scheduling, and climate change impact assessment increasingly depend on high-frequency Soil Moisture Index predictions. Predicting soil moisture dynamics helps manage natural resources and mitigate water shortages [1,2,3,4,5].
High-frequency SMI forecasting is challenging because of complex, non-linear, and dynamic soil processes driven by hydro-meteorological elements [6]. Unfortunately, many places lack hydro-meteorological data including sun radiation, wind speed, and relative humidity. Innovative methods are needed to apply data-intensive models that need a comprehensive suite of environmental variables due to data scarcity [7].
Conventional statistical models frequently fail to account for the intrinsic non-linearity and dynamic interdependencies seen in environmental time series data. The application of the Mann–Kendall test to meteorological variables reveals an absence of a linear trend [8,9]. Artificial Intelligence and machine learning methodologies, especially neural networks, have arisen as formidable instruments for time series forecasting in intricate environmental systems, such as hydrology and climatology [6,10,11,12]. Their capacity to discern complex patterns immediately from data, without the necessity of explicit mechanical equations, renders them very appropriate for such applications.
Climate proxies are a good way to fill the gap in hydro-meteorological data. The Standardized Precipitation-Evapotranspiration measure is a multi-scalar drought measure that may characterize meteorological, agricultural, and hydrological droughts across timeframes [13,14]. Importantly, SPEI is derived from precipitation minus potential evapotranspiration [14]. More easily accessible meteorological data like temperature and sun radiation can estimate PET [14]. This technique permits SPEI to be synthesized as a robust climatic proxy from univariate precipitation (P) and temperature (T) estimates, eliminating the requirement for complicated hydro-meteorological inputs for direct SMI modeling [15,16].
Hybrid models are widely acknowledged for their superior predictive capabilities in intricate hydrological systems, providing an advanced solution for data-scarce contexts [13,17,18,19].
Several studies have shown that the Nonlinear Autoregressive with Exogenous Inputs (NARX) model can anticipate hydrological and climatic variables, including temperature and precipitation dynamics. Ahmed [20] used NARX to forecast terrestrial water storage in ten major African watersheds, finding robust relationships between GRACE-derived data and key climatic controls like rainfall, temperature, and evapotranspiration. A total of 60% of the basins showed “very good” performance (Nash–Sutcliffe efficiency >0.75). Sultana et al. [21] combined NARX with Bayesian optimization methods for short-term forecasting and explicitly included precipitation and temperature as exogenous factors along with cloud cover and irradiance to improve prediction accuracy. Santoso et al. [22] also tested NARX against other machine learning algorithms for forecasting, using ambient temperature and precipitation data to enhance prediction. Zeng et al. [23] developed a NARX neural network for short-term temperature prediction in seasonally frozen soil subgrades that outperforms backpropagation networks by capturing the nonlinear interactions between temperature, water content, and frost heave through feedback and delay mechanisms.
The Standardized Precipitation-Evapotranspiration Index (SPEI) and the Soil Moisture Index (SMI) are two closely related measures for keeping on drought. SPEI is often a good, weather-based stand-in for soil moisture levels. The main link is that SPEI figures out the water balance (precipitation minus potential evapotranspiration), which directly affects the amount of moisture in the soil and, as a result, agricultural drought [24,25]. Negative SPEI implies high evaporation and little rain, which lowers soil moisture, resulting in a strong link between the two.
Studies show a substantial positive association between SPEI and soil moisture, often 0.5–0.6 or higher, especially in the upper 20–100 cm. Because soil moisture has “memory,” SPEI is most connected with soil moisture for short-to-medium accumulation periods (1 to 6 months), which matches agricultural drought [24,26].
Hamarash [27] proposes the Soil Moisture and Evapotranspiration Revealed Drought Index (SERDI), which uses the Penman–Monteith approach to diagnose drought more accurately and quickly, especially in semi-arid locations. With these factors, the SERDI overcomes the limits of previous drought indices and provides a more complete tool for early drought identification. Agricultural drought, where water supply directly affects crop development, is best detected by the SERDI soil moisture integration. In areas with water shortage, the SERDI capacity to quantify evapotranspiration and soil moisture is a major benefit.
The Standardized Precipitation-Evapotranspiration Index (SPEI) and the Soil Moisture Index (SMI) have the same scale, and therefore, they are suitable for modeling.
Kheimi and Zounemat-Kermani [28] assesses the predictive accuracy of various computational models for Soil Moisture (SM), comparing hard computing models (MLR, AR, ARMA, ARIMA) with soft computing AI models (NAR, NARX, MLPNN, LSTM, DRNN, CNN and ensemble models (Adaboost, Bagging and Boosting)). An analysis of data from sandy clay loam soil reveals hard computing models, particularly the stochastic AR model, underperforms compared to the Naïve model. Shallow learning models such as NAR and MLPNN outperform hard models, aided by exogenous precipitation data. Deep learning models like LSTM demonstrate high accuracy (PCC > 0.9, RMSE < 1.39) but are computationally expensive. Ensemble models achieve the best performance (PCC > 0.92, RMSE < 1.28), enhancing modeling accuracy by up to 6% and 23% in RMSE and PCC compared to stochastic models.
This research presents a novel three-stage hybrid neural network architecture combining Nonlinear Autoregressive (NAR) and Nonlinear Autoregressive with Exogenous Inputs (NARX) models to forecast the high-frequency Soil Moisture Index (SMI). The approach integrates the strengths of NAR/NARX models to capture non-linear time series dynamics and utilizes the proxy Standardized Precipitation-Evapotranspiration Index (SPEI-proxy) as a climatic proxy. NARX (Nonlinear Autoregressive Exogenous) and NAR (Nonlinear Autoregressive) models are sophisticated time series modeling techniques, particularly effective for mapping complicated nonlinear interactions. NARX uses external (exogenous) inputs to make more accurate predictions, while both models provide quick convergence, high accuracy, resilience to disruptions, and effective management of long-term data dependencies [29,30].
The framework consists of three main stages.
Stage 1 uses Nonlinear Autoregressive neural networks for multi-step forecasting of precipitation and temperature.
Stage 2 calculates proxy SPEI-proxy values (based on temperature and precipitation) from these meteorological forecasts through a moving window water balance technique.
Stage 3 employs a NARX model that predicts SMI using both lagged observed SMI values and lagged SPEI-proxy forecasts values derived from Stage 1 forecasts.
The paper includes a comprehensive mathematical formulation for each stage, detailed parameter justification, and an analysis of forecasting error propagation. Additionally, this article proposes a joint optimization version of the architecture (NAR–SPEI–NARX), aiming to enhance predictive accuracy and streamline deployment.
Key contributions made by this study are as follows:
- The creation of an innovative, multi-level neural network architecture particularly designed for high-frequency SMI prediction.
- A proven system for efficiently employing proxy SPEI-proxy calculated from precipitation and temperature data, to address the constraints imposed by the lack of extensive hydro-meteorological variables.
- An enhancement in predictive modeling for soil moisture, providing a more precise and robust solution for environmental management in data-limited areas.
Furthermore, a theoretical and computational extension of the entire pipeline (NAR–SPEI–NARX) that enables collaborative optimization will be shown. The new three-stage integration, in which NAR models forecast precipitation and temperature and then convert them into SPEI as an exogenous input for NARX-based SMI prediction, addresses the problem of operational foresight that exists in traditional NARX applications, which assume complete knowledge of climatic variables.
2. Data Description and Preprocessing
2.1. Dataset for Measuring Station Novi Sad, Vojvodina, Serbia
The dataset consists of high-frequency observations gathered at a monitored station near Novi Sad, Vojvodina, Serbia, from January 2014 to December 2020. Three variables comprise the fundamental measurements: volumetric soil moisture content (SM, given as a percentage), precipitation (P, measured in mm per observation interval), and air temperature (T, in °C). The temporal resolution is around hourly, encompassing a total of 62,234 observations across the whole period. This is shown in Figure 1.
Figure 1.
Display of soil moisture, precipitation and temperature across a time frame, Novi Sad.
Measuring devices were placed on the higher river terrace. It is well-suited for population growth because of its minimum dissection, simple water supply, flood-free regions, and ideal circumstances for agricultural and traffic movement. Soil moisture sensors are located inside the active root zone.
Precipitation exhibits extreme zero-inflation (median and quartiles all zero), reflecting the intermittent nature of rainfall events. When precipitation occurs, however, intensities can reach 23.8 mm per hour. Temperature spans a wide range from −19.45 °C to 41.11 °C, capturing the full seasonal cycle and extreme events. Soil moisture varies between approximately 12% and 32%, with a mean of 22.1%.
Temperature and precipitation are the two features that make up the exogenous variable the proxy Standardized Precipitation-Evapotranspiration Index (SPEI-proxy). Exogenous variables, such as the (SPEI-proxy) in the proposed NAR–SPEI–NARX model, are used as extra inputs to capture external climatic forces that influence soil moisture dynamics. In a NARX architecture, the target variable (SMI) is predicted based on both its own prior values (autoregressive component) and lagged exogenous inputs. By adding SPEI, which combines precipitation and temperature into a single index describing climatic water balance, the model obtains access to physically important data on recent moisture supply and atmospheric demand. This exogenous information allows the network to separate the impacts of meteorological variability from the underlying persistence of soil moisture, boosting the accuracy of one-step-ahead forecasts when compared to a purely autoregressive method. A Nonlinear Autoregressive with Exogenous Inputs (NARX) model that employs SPEI-proxy as an exogenous proxy better predicts SMI because it effectively captures the nonlinear, hysteretic link between atmospheric water balance (SPEI-proxy) and delayed Soil Moisture Index (SMI) response.
2.2. Train–Test Split
The dataset is partitioned chronologically to maintain temporal causality and enable rigorous out-of-sample evaluation. The partition is defined as:
This division results in 52,631 training observations and 8836 test observations. This constitutes around 85.6% of the data for training and 14.4% for testing, offering significant historical data for model estimates while allocating a whole year for out-of-sample assessment. The choice of 2020 as the test year offers a comprehensive yearly cycle for assessment, guaranteeing that all test data are chronologically subsequent to the training period, hence eliminating look-ahead bias in model building.
2.3. Soil Moisture Index
The Soil Moisture Index (SMI) is constructed as a standardized anomaly relative to training period statistics. For each observation at time :
where:
- is the observed soil moisture at time .
- is the training period mean.
- is the training period standard deviation.
The mean and standard deviation and are computed exclusively from training data. This guarantees that test period values are articulated in relation to past normative conditions, averting look-ahead bias in the normalization process. This standardization guarantees that the target variable possesses a mean of zero and a variance of one throughout the training period, enhancing neural network training by centering the target distribution and adjusting it to a range suitable for activation function behavior. Utilizing just training-period data guarantees that no information from the test period affects the transformation, hence preserving strict temporal causality.
3. Mathematical Framework
3.1. Problem Formulation
The suggested hybrid forecasting framework consists of three interdependent steps that convert historical data on precipitation, temperature, and soil moisture into predictions of future soil moisture levels. The entire system may be shown as a composite function:
where:
- denotes the target variable of interest—the Soil Moisture Index (SMI) at time t.
- is the -step-ahead forecast.
- are lagged SPEI-proxy values derived from Stage 1 forecasts, which represent exogenous climate variables, specifically precipitation and temperature .
- and are autoregressive and exogenous lag orders, respectively.
The SPEI-proxy values themselves derive from Stage 1 meteorological forecasts:
where:
- and are forecasts from Stage 1 NAR models.
- is the accumulation window for SPEI-proxy computation.
- represents the water balance and standardization transformation.
Finally, the meteorological forecasts are generated recursively from historical observations:
where:
- is the autoregressive lag order for meteorological variables.
- and are the NAR model functions for precipitation and temperature.
The essential observation necessitates an understanding of forthcoming exogenous factors. In operational contexts, these variables remain unknown at the time of forecasting. This hybrid design addresses this issue by substituting actual future exogenous variables with predictions produced from distinct univariate models. Figure 2 shows a structured hybrid forecasting system.
Figure 2.
Workflow of hybrid forecasting system.
3.2. Stage 1: Nonlinear Autoregressive (NAR) Forecasting of Precipitation and Temperature
For each climatic univariate time series (denoting either precipitation or temperature), the Nonlinear Autoregressive (NAR) model articulates the current value as a nonlinear function of its own lagged values, defined by
where:
- is output memory order (number of output lags for meteorological variables).
- is a nonlinear function approximated by a neural network (MLP).
- represents the irreducible error term.
3.3. Stage 2: SPEI-Proxy Computation from Forecasted Series P and T
Precipitation is subtracted from potential evapotranspiration (PET) in the calculation of true SPEI—proxy. Since PET variables (radiation, humidity, and wind) are not mentioned, this model uses a proxy that is expressly specified. For each time step, the water balance departure is computed as:
where:
- is the water balance surplus/deficit at time .
- is precipitation at time .
- is temperature at time (°C).
- is a scaling parameter.
- avoids negative “evaporation” when .
The parameter indicates a simplified estimate of the relationship that exists between temperature and the potential for evapotranspiration. The amount of potential evapotranspiration in formulations that are based on physical principles is contingent upon a few elements, including radiation, humidity, and wind speed. The linear approximation can represent the first-order dependency on temperature while effectively keeping the simplicity of the computing process.
In order to calculate the SPEI, the cumulative water balance during a certain time window is taken into consideration:
where is the accumulation window length (approximately 30 days at hourly resolution).
The choice of (30 days × 24 h) reflects the timescale of interest for agricultural and hydrological applications. Monthly timeframes can smooth out high-frequency noise caused by individual precipitation events while also capturing sub-seasonal and seasonal variations in soil moisture. The amount of time it takes for the moisture in the soil to react might range anywhere from a few days to many weeks. During the 30-day accumulation period, high-frequency noise is smoothed down, and persistent moisture shortfalls and surpluses are captured. In this way, the noisy forecasts P and T are transformed into a driver that is steadier.
The SPEI-proxy is then defined as the standardized anomaly of the accumulated water balance:
where and are computed on the training period only.
The SPEI-proxy is utilized as both factors influence soil moisture. The proxy SPEI (Standardized Precipitation-Evapotranspiration Index) synthesizes precipitation and temperature-induced evapotranspiration. It offers a standardized assessment of water availability, which is directly pertinent to SMI. The model utilizes projected precipitation and temperature to calculate the Standardized Precipitation-Evapotranspiration Index (SPEI), simulating a realistic forecasting system in which future climatic conditions remain uncertain yet anticipated.
In this implementation, the SPEI-proxy is estimated using a simple climatic water balance, defined as the difference between precipitation (P) and a temperature-driven evaporative demand proxy: with k = 0.05 as a constant scaling factor. The accumulated value of D across a 720-step rolling window (about 30 days at hourly resolution) is then normalized into a z-score using the mean and standard deviation derived just from the training period. This formulation is a simplified proxy for the standard SPEI. It does not use a physically based potential evapotranspiration model (e.g., Thornthwaite or Penman–Monteith) or a parametric probability distribution (e.g., log-logistic) to normalize the accumulated differences.
The technique uses a linear temperature-driven demand term and basic Gaussian standardization, making it a computationally efficient approximation ideal for hybrid forecasting pipelines. However, it does not fully implement the typical SPEI-proxy.
3.4. Stage 3: NARX Modeling of Soil Moisture Index (SMI)
The goal of the NARX model is to forecast the subsequent value of a time series by considering other influencing time series, as well as historical values or prior forecasts of the series. Most of the dynamic networks examined are either concentrated networks, with dynamics restricted to the input layer, or feedforward networks. The Nonlinear Autoregressive network with exogenous inputs (NARX) is a recurrent dynamic network characterized by feedback links that include many levels of the network. The NARX model derives from the linear ARX model, frequently employed in time series analysis.
The model displays exogenous factors that affect the value of the time series, which need to be forecasted. The input order specifies the quantity of historical external variables included in the system. The exogenous variables may be present in an arbitrary quantity, including none, one, or several. Generally, exogenous variables also constitute time series. The defining equation for the NARX model is:
in which the subsequent value of the dependent output signal, denoted by , is regressed on the values of the output signal that came before it as well as the values of an independent (exogenous) input signal that came before it. If the previous stages are applied, the Equation (2) from the beginning is followed, and this should be shown.
The NARX (Nonlinear Autoregressive with Exogenous Inputs) model enhances the NAR framework by including exogenous factors that affect the goal dynamics. The NARX model for soil moisture forecasting can be defined for easier understanding in the following way:
where:
- is the autoregressive order for SMI (memory of soil system).
- is the exogenous input order for SPEI (memory of climate forcing).
- is a nonlinear function approximated by an MLP.
This equation corresponds to the image shown in Figure 2.
The complete input vector at prediction time is:
The training dataset for Stage 3 is constructed using the complete historical record through 2019. For each time index that satisfies:
the input-output pair is:
The requirement ensures that all lagged values are well-defined and that the SPEI-proxy accumulation window can be fully computed from available data.
NARX captures the persistence and internal dynamics of soil moisture and enables the model to integrate the impact of meteorological factors (via SPEI-proxy) on prospective SMI. The MLP can learn intricate relationships between historical SMI and climatic circumstances. The NAR–SPEI–NARX pipeline tests using observed SMI values from the past instead of anticipated values. A realistic operational situation with real-time soil moisture readings up to the present time-step allows one-step-ahead SMI projections. Because future climate data are unknown, Stage 1 recursively projected climate variables (P and T) are used to produce exogenous inputs (SPEI-proxy). This technique eliminates error accumulation from iteratively feeding back projected SMI values for multi-step forecasting and appropriately uses SMI significant short-term autocorrelation (particularly at hourly resolution) to achieve high accuracy. For actual multi-step-ahead forecasting (predicting several days ahead without new observations), a separate recursive or direct technique is needed; however, the described method is suitable for operational one-step-ahead prediction.
4. Algorithm for Hybrid Forecasting SMI Model
In order to make a computer algorithm regarding the soil moisture indicator (SMI), the model incorporates a non-linear autoregressive exogenous (NARX) neural network, a physically grounded drought indicator (SPEI-proxy), and a univariate Nonlinear Autoregressive (NAR) prediction of temperature and precipitation.
All of these components are incorporated into the model. In the explanation of program structure, each level, as well as the functions and parameters involved, their methods, and the rationale for their inclusion, are all covered. Additionally, the explanation includes the reason for including them, as part of the development process for the application.
The implementation is entirely written in Python 3.7.4 and organized as a reproducible research codebase. The main forecasting pipeline is exposed through main.py, while reusable components (data preprocessing, NAR and NARX models, SPEI-proxy computation, and evaluation utilities) are modularized in the src directory. An accompanying Jupyter notebook (NoviSad_NAR_SPEI_NARX_SMI.ipynb) documents (Supplementary Materials) the full experimental workflow, from exploratory analysis to model training, validation, and visualization of the SMI forecasts. For ease of reproduction, we also provide a Docker image (built from the included Dockerfile) that encapsulates the Python environment, dependencies, and notebooks, allowing readers to run all experiments and regenerate the figures without additional configuration. The complete source code and container specification are publicly available on GitHub [31].
The dataset is divided by timestamps: all observations before 31 December 2019 are designated for training, whilst the entirety of 2020 is allocated for testing. This division adheres to temporal causality and simulates a genuine forecasting situation in which the model is trained on past data and assessed on entirely unobserved future data. The whole pipeline is structured to be causal: at every forecast time, the model depends solely on historical observations and forecasts generated from those historical data, therefore preventing any future information from influencing the predictions.
The model forecasts SMI rather than raw soil moisture to mitigate scale effects and ensure comparability of mistakes over time. It produces a stationary target, frequently approximating a zero-mean process. It enhances the stability of neural training by improving optimal conditioning. It enables the interpretation of error measurements (RMSE) in terms of standard deviation units.
Descriptive statistics are first conducted, and three variables are illustrated visually. Subsequently, the dataset is partitioned into a training set and a test set, and the Soil Moisture Index is computed using the training set.
A representation of the algorithm’s block diagram, which may be seen in Figure 3.
Figure 3.
Block scheme for NAR–SPEI–NARX hybrid forecasting SMI model.
Italics will be used to display the names of functions in the subsequent chapters, and bolding will be used to emphasize the arguments of functions. Both of these features will be emphasized.
4.1. Stage 1: NAR Models for Precipitation and Temperature
The first stage makes multi-step predictions of temperature (T) and precipitation (P) for the whole test horizon (2020) based merely on their own previous values. The SPEI-proxy index for the future is then calculated using these forecasts. The notebook has three main functionalities that help with this.
The function make_lag_matrix uses NumPy sliding_window_view to convert a univariate time series into a supervised learning dataset: it creates a matrix X where each row consists of lags consecutive past observations, and the corresponding target y is the next value immediately after the window. Efficient vectorized construction of lag features avoids Python loops over time.
The function fit_nar takes a pandas series (either train[P] or train[T]), applies make_lag_matrix to obtain the feature matrix and target vector, and then builds a pipeline comprising a StandardScaler and an MLPRegressor. The parameter lags is set to 48, which corresponds to approximately two days of hourly data, chosen to capture diurnal cycles and short-term memory in the climate series. The scaler normalizes the features to zero mean and unit variance, crucial for neural network convergence. The MLPRegressor is configured with hidden_layer_sizes = (64, 32), meaning two hidden layers with 64 and 32 neurons respectively, providing sufficient capacity to model nonlinear dependencies—enough capacity for nonlinear dynamics without being excessively large for a lagged tabular setup. The activation is ReLU, the solver is Adam with an initial learning rate of 1e-3, and L2 regularization (alpha) is set to 1e-4. ReLU is a standard stable choice and good gradient flow for MLPs, it reduces overfitting, especially with correlated lag features. The max_iter parameter is 40, but early stopping is enabled with a validation fraction of 0.1 and a patience of 5 epochs (n_iter_no_change), which prevents overfitting. The random_state ensures reproducibility. A feed-forward neural network is chosen for its ability to model complex nonlinear relationships in time series, often necessary for atmospheric variables.
After the NAR models are set up for both temperature and precipitation, the function recursive_forecast makes predictions for several steps. It needs the trained model, the whole history of the training series (as a numpy array), the number of steps to predict (the length of the test set), and the same delays that were used during training. The process begins with the latest lagged values of the past and makes predictions one step forward, adding each new forecast to the history so it may be used as input for the following phase. When models cannot get real future values, this recursive (or iterative) method is the norm for multi-step forecasting. The projections for 2020 are saved as P_hat and T_hat, which match the test indices.
4.2. Stage 2: SPEI-Proxy Algorithm Derived from Forecasted Precipitation and Temperature
The second stage utilizes projections of precipitation and temperature to create a singular drought index: the proxy Standardized Precipitation-Evapotranspiration Index (SPEI-proxy). This index combines precipitation and temperature-induced evapotranspiration, serving as a significant measure of water availability that directly affects soil moisture. The calculation occurs through several stages. The goal is to create a climate proxy (SPEI-proxy) from forecasted precipitation and temperature, then use it as an exogenous driver for SMI.
First, a simplified water balance is calculated as , where k is a scalar parameter set to 0.05 that serves as a proxy for the effect of temperature on evapotranspiration. The use of ensures that only positive temperatures contribute to water loss. Without full meteorological drivers (radiation, humidity, wind), this is a pragmatic proxy so that hotter conditions reduce net water availability. The series P_full and T_full are created by concatenating the observed training values with the forecasted test values (P_hat and T_hat), ensuring continuity in the time series. The resulting daily (hourly) balance D_full is then accumulated over a rolling window of length WINDOW = 720, which corresponds to approximately 30 days of hourly data. This accumulation captures medium-term water surplus or deficit, a key feature of the SPEI-proxy at the one-month scale. In 2020, the model requires the exogenous driver to be operationally accessible. Thus, it is constructed based on the Stage 1 projections during the testing phase.
The accumulated series D_acc is then standardized to obtain SPEI-proxy. To guarantee that the index is anchored to the historical climatic regime and to maintain causality, the mean and standard deviation are computed exclusively from the training section of D_acc (after eliminating any initial NaN values owing to the rolling window). This is done in order to maintain the credibility of the index. The entire D_acc series (including the test period) is then transformed using these training statistics—SPEI-proxy. This step guarantees that no information from the test period influences the transformation, preserving the integrity of the forecast evaluation. The resulting SPEI-proxy series is aligned with the original data-frame index and will serve as the exogenous input for the final NARX model.
4.3. Stage 3: NARX Model for SMI
The third and final stage involves combining the observed Soil Moisture Index (SMI) that is produced from soil moisture measurements with the SPEI-proxy that is based on forecasts to make a prediction about future SMI in a way that is one step ahead. For ensuring that test SMI values are stated in relation to the historical distribution, the SMI itself is generated at the very beginning of the notebook as a z-score of the raw soil moisture (SM). This is done by utilizing just training statistics.
Previous values of SMI are intended to be used as feedback in the NARX model, whereas previous values of the SPEI-proxy are intended to be used as exogenous inputs. Feature construction is handled by the function build_Xy, which, given a set of target time indices, extracts the preceding LAGS_SMI = 48 SMI values and the preceding LAGS_X = 48 SPEI-proxy values for each target time. These two vectors are concatenated horizontally, resulting in feature vectors of length 96. A 48-step memory for both feedback and exogenous input. The function is applied separately to the training and test indices to create X_train, y_train and X_test, y_test. The function hstack, input in NARX, is a vector that physically combines exogenous delays and feedback lags together.
The NARX model uses the same pipeline as in Stage 1: a StandardScaler followed by an MLPRegressor with identical hyperparameters (hidden_layer_sizes = (64, 32), max_iter = 40, etc.). The model is trained on the training dataset in a standard supervised fashion, learning to map the combined lagged SMI and lagged SPEI-proxy to the next SMI value. Importantly, during training, both the SMI and SPEI-proxy features come from observed or computed values within the training period. A “nonlinear regression on standardized lagged features” is still the learning issue that must be solved. Consistency in behavior is maintained between Stage 1 and Stage 3 by the utilization of the same training controls, which include scaling, early halting, and regularization. Due to the fact that the learning issue is still “nonlinear regression on standardized lagged features,” the hyperparameters are kept the same through this process. Consistency in behavior is maintained between Stage 1 and Stage 3 by the utilization of the same training controls, which include scaling, early halting, and regularization.
During the period when the test is being conducted, the model operates in a manner that is entirely causal. For each prediction at time t, it takes use of the prior SMI values that have been seen (since SMI is created from real-time soil moisture monitoring) as well as the expected SPEI-proxy values that have been received from Stage 1 (for the exogenous part). In this setup, which is comparable to an operational forecast in the actual world, the most current soil moisture is always available, but it is required to generate forecasts for future climatic inputs. This configuration is equivalent to any operational forecast.
Collectively, autoregressive learning, recursive multi-step meteorological forecasting, hydrologically justified transformation, and nonlinear exogenous regression build a cohesive forecasting system. Make_lag_matrix creates state embeddings, fit_nar estimates Nonlinear Autoregressive mappings, recursive_forecast extends one-step predictors to multi-step horizons, water_balance converts climatic variables into deficit dynamics, and build_Xy builds feedback–exogenous feature matrices for NARX learning. To balance model flexibility, stability, and generalization, the bold parameters control memory depth, network capacity, regularization strength, optimization dynamics, and hydrological scaling. A structured hybrid forecasting approach propagates meteorological uncertainty into soil moisture estimates while maintaining statistical rigor and practical viability.
5. Results
5.1. Results for Measuring Station Novi Sad, Vojvodina, Serbia
Evaluation of the 2020 test set for the Soil Moisture Index (SMI) model yielded an R2 of 0.9888, RMSE of 0.0827 and MAE of 0.0567, demonstrating exceptional one-step-ahead accuracy. The close alignment between observed and predicted SMI values is supported by graphical representation. The high R2 is primarily due to the model’s autoregressive nature, where true past SMI data up to time t-1 influences predictions significantly. The addition of exogenous standardized precipitation evaporation index (SPEI-proxy) inputs further refines predictions during climate deviations, enhancing reliability in real-time forecasting scenarios. Key to the accuracy are factors such as strong autoregressive dependence with substantial memory in soil moisture, effective integration of climate forcing through SPEI-proxy during significant weather events, sufficient model capacity from a neural network architecture preventing overfitting, and standardized variable properties that facilitate effective learning. These collective elements contribute to the model’s ability to offer highly reliable forecasts.
Figure 4 shows the 2020 test horizon time series comparison of observed and expected SMI values. The projected series matches the observed dynamics across all seasons, including the low-frequency seasonal cycle and high-frequency precipitation event variations. The complete code, including the following graph, is available at the following link [31].
Figure 4.
Observed vs. predicted values for SMI, Novi Sad.
The visual inspection indicates that projected values show negligible phase lag compared to data, suggesting that the autoregressive component accurately reflects the time of soil moisture responses to external influences. The model replicates both the intensity of dry-down events (declining SMI after the cessation of precipitation) and the size of wetting events (rising SMI after precipitation).
In instances of extreme values (both elevated and diminished SMI), the model preserves accuracy without indications of saturation or clipping. The residuals resemble white noise, exhibiting no systematic bias or autocorrelation, indicating that the model has fully utilized all discernible information from the input characteristics.
5.2. Results for Measuring Station Kac, Vojvodina, Serbia
The NAR–SPEI–NARX hybrid forecasting model was applied to data from another measuring station to test the existing model. This dataset consists of 38,763 rows of high-frequency observations of soil moisture (SM), precipitation (P), and air temperature (T) from the Kac measuring station in Vojvodina, Serbia, covering December 2013 to April 2018, and what is shown in Figure 5.
Figure 5.
Display of soil moisture, precipitation and temperature across a time frame, Kac.
The data is divided chronologically, with all samples up to the end of 2017 utilized for training and the entire year of 2018 set aside for testing. The proposed three-stage hybrid model, which includes a univariate NAR forecast of climate variables, a transformation into a SPEI-proxy drought index, and a final NARX model for SMI, performed well on the 2018 test set, with a coefficient of determination R2 of 0.8838 and a root mean square error (RMSE) of 0.0932.
Figure 6 shows a time series comparison of observed and expected SMI values, at the Kac measuring station.
Figure 6.
Observed vs. predicted values for SMI, Kac.
The entire code, along with the subsequent graph, may be accessed at the following website [31].
This excellent prediction accuracy indicates the model use in an operational one-step-ahead forecasting framework that takes past observed SMI and anticipated climate-derived SPEI values as inputs.
6. Discussion
The suggested three-stage hybrid design improves hydrological forecasting methodology. Traditional soil moisture forecasting assumes complete knowledge of future meteorological conditions (hindcasting mode) or ignores future climatic information. The cascaded NAR–SPEI–NARX system generates meteorological forecasts that propagate through a physically based index transformation before feeding the soil moisture model exogenously.
All standardizations utilize training-period data and tight temporal segmentation to guarantee that test period information does not affect model development. When future observations are lacking, operational forecasting requires causal integrity.
In Stage 1, NAR models use recursive applications to anticipate the whole test horizon at any moment without meteorological observations beyond the training period. The framework’s parameters balance theoretical, empirical, and computational constraints.
NAR models are trained to minimize their individual prediction errors on P and T, not to enhance the final SMI forecast, making sequential training successful but suboptimal. A unified method that optimizes all parameters to reduce SMI prediction error might improve performance and ease implementation.
This study proposes a differentiated pipeline from end to end. The SPEI-proxy computation should be treated as a differentiable layer to allow gradients to flow from the NARX output to the NAR networks for P and T. The model can create a computational graph that inputs historical P, T, and SMI sequences and returns a forecast SMI.
The NAR models learn to generate predictions that are beneficial for the final SMI prediction, rather than only correct for their individual variables. There is no need for distinct training stages; instead, it streamlines the procedure. Better accuracy is possible since the shared target may result in a better overall solution.
Although empirically strong, certain restrictions must be acknowledged. Stage 1 meteorological predictions are constructed recursively. Thus, early inaccuracies may grow over longer horizons. This propagation is tolerable for one-year test horizons, but error accumulation may be an issue for multi-year projections. Complex formulations might increase SPEI-proxy accuracy but require more data. The present approach generates point predictions without uncertainty intervals. Probabilistic predictions improve risk assessment in operational applications. A single monitoring location limits generalizability to locations with varied climatic regimes, soil qualities, and measurement features.
SPEI-proxy is an ideal exogenous variable for measuring drought conditions since it provides a standardized, multi-scalar metric that is directly related to soil moisture dynamics. SPEI-proxy smoothest variations in raw precipitation and temperature, which are volatile and intermittent at hourly scales, using a rolling accumulation window (e.g., 30 days) and probabilistic standardization based on training period distribution. This process produces a more consistent and useful input that reflects the cumulative impact of recent climatic anomalies. Furthermore, because SPEI-proxy is derived from anticipated climate variables (Stage 1), it follows operational causality. At prediction time, only past-observed SMI and climate projections are employed, eliminating the false assumption of knowing future weather.
The hybrid NAR–SPEI–NARX system has various benefits over traditional forecasting techniques. First, it directly solves the exogenous variable foresight problem by employing specific NAR models to provide precipitation and temperature forecasts, which are then used to create SPEI-proxy. This guarantees that the final SMI predictions are based on information accessible in a real-time operating scenario, making the model appropriate for decision support. The three-stage structure separates climatic variables and soil moisture dynamics, allowing for tailoring to unique data properties, such as utilizing robust Multi-Layer Perceptron (MLP) to handle intermittent precipitation. The cascade of modifications (water balance accumulation, log-logistic fitting, and standardization) incorporates domain knowledge into the learning process, decreasing the pressure on the neural network to uncover associations from raw data. This mix of causal structure, modular design, and feature engineering adds strong predictability and interpretability to the model.
It is important to recognize some constraints. First, the basic PET proxy calculations ignore humidity, wind speed, and radiation, all of which have an influence on evapotranspiration. This simplification is common in practical scenarios when these variables are unavailable; however, more complex PET formulations (e.g., Penman-Monteith, Hargreaves) may improve performance at the expense of additional data. Second, water balance varies throughout time. To maintain the interpretation of SPEI-proxy as an anomaly when compared to current normal conditions, the distribution fitting reference period must be updated on a regular basis. Third, climate-variable recursive forecasting can compound forecast errors over longer durations. To mitigate this influence, our analysis uses one-step-ahead SMI predictions; multi-step forecasting necessitates extra uncertainty propagation considerations. This can be improved in future work.
7. Conclusions
This research presents a three-stage hybrid architecture for Soil Moisture Index forecasting that combines NAR models for meteorological forecasting, SPEI-proxy transformation, and NARX modeling of soil moisture dynamics. The cascaded NAR–SPEI–NARX technique combines forecasted climatic data with autoregressive soil moisture dynamics, providing high prediction accuracy (R2 = 0.9888, RMSE = 0.0827, MAE = 0.0567) across a one-year test horizon. The 48 h lag windows for autoregressive and exogenous components give enough temporal context to capture soil moisture memory and climatic forcing effects while retaining input dimensionality. The 30-day SPEI-proxy accumulation window captures a monthly scale of water balance variations that cumulatively affect soil moisture, balancing responsiveness and noise reduction. The system is ideal for operational forecasting applications without future data due to chronological partitioning and training-period standardization that enforce temporal causality. NAR models may be anticipated at any time without meteorological measurements beyond the training period because of their recursive multi-step forecasting.
Penzar [32] demonstrates that the forecasting equation clearly indicates that predictions regarding the Palmer Drought Severity Index will be inaccurate when the index experiences abrupt changes. This means that we can predict the value for next month if we know the actual value and the values from the last two months. Similarly, this model also gives a very precise prediction with high accuracy.
A theoretical constraint on recursive error propagation and an end-to-end differentiable extension were presented, possibly enhancing accuracy by optimizing all components together.
The model was trained on data from one measuring station but tested on data from another measuring station. Since the Python code is publicly available on GitHub [31], it is easy to check whether this model works in other locations around the world. This could be a topic of future research.
Future research aims to develop and evaluate the end-to-end model and add probabilistic forecasts using ensemble methods. enhancing long-range dependency modeling with attention mechanisms and transformer designs.
Supplementary Materials
The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/a19040287/s1.
Author Contributions
Conceptualization, M.T. and P.M.T.; methodology, M.T. and D.K.; software, D.D.; validation, D.K. and D.D.; formal analysis, M.T. and D.K.; investigation, P.M.T.; writing—original draft preparation, M.T. and P.M.T.; writing—review and editing, D.K. and D.D.; visualization, D.V.; supervision, D.V. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Data Availability Statement
Data is unavailable due to privacy or ethical restrictions, but Python code is full available at: https://github.com/MilosT82/NAR-SPEI-NARX-Hybrid-SMI-Forecasting-model.git (accessed on 22 February 2026).
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Alsumaiei, A.A.; Alrashidi, M.S. Hydrometeorological Drought Forecasting in Hyper-Arid Climates Using Nonlinear Autoregressive Neural Networks. Water 2020, 12, 2611. [Google Scholar] [CrossRef] [Scilit]
- Rabiei, S.; Babaeian, E.; Grunwald, S. Deep Learning-Based Short- and Mid-Term Surface and Subsurface Soil Moisture Projections from Remote Sensing and Digital Soil Maps. Remote Sens. 2025, 17, 3219. [Google Scholar] [CrossRef] [Scilit]
- Gara, A.; Gader, K.; Khlifi, S.; Bouvier, C.; Ouessar, M.; Vanclooster, M.; Al-Ansari, N.; El-Hendawy, S.; Mattar, M.A. Evaluating the Spatial and Temporal Transferability of Model Parameters of a Distributed Soil Conservation Service–Soil Moisture Antecedent–Simple Lag and Route Model for South Mediterranean Catchments. Water 2025, 17, 569. [Google Scholar] [CrossRef] [Scilit]
- Bandara, K.; Pabasara, K.; Gunawardhana, L.; Bamunawala, J.; Sirisena, J.; Rajapakse, L. Coupling Rainfall Intensity and Satellite-Derived Soil Moisture for Time of Concentration Prediction: A Data-Driven Hydrological Approach to Enhance Climate Responsiveness. Hydrology 2025, 12, 264. [Google Scholar] [CrossRef] [Scilit]
- Ali, S. Plant-Soil Interactions in Agricultural Systems; Ali, S., Jia, Q., Zhang, J., Ali, S., Eds.; MDPI: Basel, Switzerland, 2025; ISBN 978-3-7258-2964-4. [Google Scholar]
- Malinović-Milićević, S.; Radovanović, M.M.; Radenković, S.D.; Vyklyuk, Y.; Milovanović, B.; Milanović Pešić, A.; Milenković, M.; Popović, V.; Petrović, M.; Sydor, P.; et al. Application of Solar Activity Time Series in Machine Learning Predictive Modeling of Precipitation-Induced Floods. Mathematics 2023, 11, 795. [Google Scholar] [CrossRef] [Scilit]
- Bile, A.; Tari, H.; Grinde, A.; Frasca, F.; Siani, A.M.; Fazio, E. Novel Model Based on Artificial Neural Networks to Predict Short-Term Temperature Evolution in Museum Environment. Sensors 2022, 22, 615. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Krtolica, I.; Todorov, M.; Prohaska, S.; Stojković, M. Annual and Low-Flow Trends in Serbia. J. Hydrol. Eng. 2024, 29, 05024008. [Google Scholar] [CrossRef] [Scilit]
- Todorov, M.; Tihi, N.; Pavlović, M.; Suljević, S. The Mann-Kendall Test for Weather Forecasting in Smart Cities. In Proceedings of the International Scientific Conference—Sinteza 2025, Belgrade, Serbia, 9 May 2025; pp. 228–232. [Google Scholar]
- Hermansah, H.; Rosadi, D.; Abdurakhman, A.; Utami, H. Automatic Time Series Forecasting Using Nonlinear Autoregressive Neural Network Model with Exogenous Input. Bull. EEI 2021, 10, 2836–2844. [Google Scholar] [CrossRef] [Scilit]
- Di Nunno, F.; Granata, F.; Gargano, R.; De Marinis, G. Nonlinear Autoregressive Exogenous (NARX) Neural Network Models for Storm Tide Forecasting in the Venice Lagoon. In Proceedings of the EWaS5, Naples, Italy, 12–15 July 2022; p. 93. [Google Scholar]
- Ruiz, L.; Cuéllar, M.; Calvo-Flores, M.; Jiménez, M. An Application of Non-Linear Autoregressive Neural Networks to Predict Energy Consumption in Public Buildings. Energies 2016, 9, 684. [Google Scholar] [CrossRef] [Scilit]
- Carrillo-Carrillo, M.; Ibáñez-Castillo, L.; Arteaga-Ramírez, R.; Arévalo-Galarza, G. SPEI Drought Forecasting in Central Mexico. Water 2025, 17, 2005. [Google Scholar] [CrossRef] [Scilit]
- Wang, Q.; Zeng, J.; Qi, J.; Zhang, X.; Zeng, Y.; Shui, W.; Xu, Z.; Zhang, R.; Wu, X.; Cong, J. A Multi-Scale Daily SPEI Dataset for Drought Characterization at Observation Stations over Mainland China from 1961 to 2018. Earth Syst. Sci. Data 2021, 13, 331–341. [Google Scholar] [CrossRef] [Scilit]
- Vicente-Serrano, S.M.; Beguería, S.; López-Moreno, J.I. A Multiscalar Drought Index Sensitive to Global Warming: The Standardized Precipitation Evapotranspiration Index. J. Clim. 2010, 23, 1696–1718. [Google Scholar] [CrossRef] [Scilit]
- Yao, P.; Fan, H.; Wu, Q. Optimal Drought Index Selection for Soil Moisture Monitoring at Multiple Depths in China’s Agricultural Regions. Agriculture 2025, 15, 423. [Google Scholar] [CrossRef] [Scilit]
- Mandrikova, O.; Polozov, Y.; Zhukova, N.; Shichkina, Y. Approximation and Analysis of Natural Data Based on NARX Neural Networks Involving Wavelet Filtering. Mathematics 2022, 10, 4345. [Google Scholar] [CrossRef] [Scilit]
- Biazar, S.M.; Golmohammadi, G.; Nedhunuri, R.R.; Shaghaghi, S.; Mohammadi, K. Artificial Intelligence in Hydrology: Advancements in Soil, Water Resource Management, and Sustainable Development. Sustainability 2025, 17, 2250. [Google Scholar] [CrossRef] [Scilit]
- Zhang, R.; Song, C.; Zhang, Z.; Xie, J.; Chen, T.; Xu, T. Machine Learning for Soil Moisture Analysis: A Survey and Emerging Perspectives. Int. J. Data Sci. Anal. 2026, 21, 66. [Google Scholar] [CrossRef] [Scilit]
- Ahmed, M.; Sultan, M.; Elbayoumi, T.; Tissot, P. Forecasting GRACE Data over the African Watersheds Using Artificial Neural Networks. Remote Sens. 2019, 11, 1769. [Google Scholar] [CrossRef] [Scilit]
- Sultana, N.; Hossain, S.M.Z.; Almuhaini, S.H.; Düştegör, D. Bayesian Optimization Algorithm-Based Statistical and Machine Learning Approaches for Forecasting Short-Term Electricity Demand. Energies 2022, 15, 3425. [Google Scholar] [CrossRef] [Scilit]
- Santoso, A.; Wijaya, F.D.; Setiawan, N.A.; Waluyo, J. Data Mining Algorithms for Operating Pressure Forecasting of Crude Oil Distribution Pipelines to Identify Potential Blockages. Mach. Learn. Knowl. Extr. 2022, 4, 700–714. [Google Scholar] [CrossRef] [Scilit]
- Zeng, C.; Liu, X.; Chen, L.; He, X.; Kang, Z. Enhanced Short-Term Temperature Prediction of Seasonally Frozen Soil Subgrades Using the NARX Neural Network. Appl. Sci. 2024, 14, 10257. [Google Scholar] [CrossRef] [Scilit]
- Lu, Y.; Yang, T.; Fu, J.; Song, W. Utility of the Standardized Precipitation Evapotranspiration Index (SPEI) to Detect Agricultural Droughts over China. J. Hydrol. Reg. Stud. 2025, 58, 102190. [Google Scholar] [CrossRef] [Scilit]
- Peng, L.; Sheffield, J.; Wei, Z.; Ek, M.; Wood, E.F. An Enhanced Standardized Precipitation–Evapotranspiration Index (SPEI) Drought-Monitoring Method Integrating Land Surface Characteristics. Earth Syst. Dyn. 2024, 15, 1277–1300. [Google Scholar] [CrossRef] [Scilit]
- Yuan, S.; Quiring, S.M.; Zhao, C. Evaluating the Utility of Drought Indices as Soil Moisture Proxies for Drought Monitoring and Land–Atmosphere Interactions. J. Hydrometeorol. 2020, 21, 2157–2175. [Google Scholar] [CrossRef] [Scilit]
- Hamarash, H.; Rasul, A.; Hamad, R. A Novel Index for Agricultural Drought Measurement: Soil Moisture and Evapotranspiration Revealed Drought Index (SERDI). Climate 2024, 12, 209. [Google Scholar] [CrossRef] [Scilit]
- Kheimi, M.; Zounemat-Kermani, M. Conventional and Advanced AI-Based Models in Soil Moisture Prediction. Phys. Chem. Earth Parts A/B/C 2025, 139, 103944. [Google Scholar] [CrossRef] [Scilit]
- Shams, M.B. Nonlinear Autoregressive with Exogenous Input (NARX) Modelling for Fouling Prediction in Industrial Dead-End Ultrafiltration Process. Desalination Water Treat. 2017, 75, 34–44. [Google Scholar] [CrossRef] [Scilit]
- Shi, W.; Wan, X.; Zhao, F.; Deng, R. A Dual-Model Framework Combining Nonlinear Autoregressive with Exogenous Inputs (NARX) and LSTM Networks for Enhanced Daily Runoff Prediction and Error Correction. Environ. Model. Softw. 2025, 192, 106570. [Google Scholar] [CrossRef] [Scilit]
- Github. Available online: https://github.com/MilosT82/NAR-SPEI-NARX-Hybrid-SMI-Forecasting-model.git (accessed on 22 February 2026).
- Penzar, B. Palmer Drought Severity Index for Zagreb and Its Statistical Forecast. Pap. Present. 1976, 13, 1–58. (In Croatian) [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.





