Skip to Content
  • Proceeding Paper
  • Open Access

16 November 2026

Robust SVR Forecasting Under Data Anomalies: Integrating Extreme Value Theory and Imputation Techniques with Application to Morocco’s Phosphate Exports †

,
and
1
Mathematics Statistics and Applications Laboratory (LMSA), Mohammed V University in Rabat, Rabat 10000, Morocco
2
College of Engineering and Architecture, International University of Rabat, TicLAB, Sala Al Jadida 11100, Morocco
*
Author to whom correspondence should be addressed.
†
Presented at the 8th edition of the International Conference on Advanced Technologies for Humanity (ICATH 2026), Rabat, Morocco, 15–17 July 2026.
Eng. Proc.2026, 168(1), 9;https://doi.org/10.3390/engproc2026168009 
(registering DOI)

Abstract

This research proposes a unified approach to combining Extreme Value Theory (EVT) for anomaly detection with imputation methods for correction, within the framework of using Support Vector Regression (SVR) for forecasting daily Moroccan phosphate exports. Our contribution lies in evaluating the effect of anomaly correction strategies on forecast performance, following probabilistic anomaly identification. EVT identified 92 anomalous observations in the standardized time series. Among the evaluated correction strategies, simple outlier removal achieved the best forecasting performance (mean absolute error (MAE) = 6.55 , root mean square error (RMSE) = 8.71 , coefficient of determination ( R 2 ) = 0.954 ), whereas median interpolation resulted in the lowest predictive accuracy. The model we propose provides a systematic and replicable method for managing anomalies in time-series databases, while highlighting the critical importance of correction techniques for prediction accuracy.

1. Introduction

Forecasting with time series plays an important role in economic decision-making [1,2,3]. However, real-world time series are often disrupted by anomalies. These anomalies or outliers may result from measurement errors, recording problems, unusual events or abrupt changes in the underlying process. They can introduce errors into the database, distort the statistical properties of the time series, affect parameter estimation, and consequently hinder the effectiveness and reliability of forecasting models [4]. Therefore, it is essential to consider anomaly handling as a fundamental element of the modeling process [5].
Our study proposes a technique that is particularly useful for outliers, which can have a significant impact on forecasts—a valuable approach for time series analysis and forecasting that follows a well-defined three-step process. We begin with the theory of extreme values for anomaly detection, which focuses on the extremes of the data distribution; then, we seek to correct these anomalies using various techniques; and, finally, we refine our forecasts by taking the obtained results into account [6,7].
We then examine how various correction methods affect the reliability of time series [8]. We then use a support vector machine regression model to examine how these modifications affect predictive performance [9,10].
Although anomaly detection, imputation, and SVR-based forecasting have been widely studied, these components are often considered separately. The systematic integration of EVT-based anomaly detection, correction strategies and SVR forecasting has not been thoroughly studied. This lack of exploration motivates the proposed EVT–imputation–SVR framework. The framework aims to examine whether handling observations properly can lead to better forecasting accuracy.
Applying this method to our dataset allows us to test our approach in a setting with high variability. We then evaluate performance using several metrics, such, as absolute errors mean squared errors and goodness-of-fit indices. The goal is to determine which correction strategy works best for improving forecast accuracy [11,12].

3. Methodological Framework

3.1. Data Description & Preprocessing: Moroccan Phosphate Exports

This study is based on daily data on Morocco’s phosphate exports, expressed in millions of Moroccan dirhams (MDH), covering the period from 1 January 2019 to 31 December 2023. The data used comes from the Central Administration of Customs and Indirect Taxes.
The analysis is based on a time series of exports spanning from January 2019 to December 2023. To satisfy the assumptions of the Extreme Value Theory (EVT) and to simplify the comparison of observations, we standardize the series by subtracting the mean and dividing by the standard deviation, using a StandardScaler [16]. Anomaly detection is based on the resulting standardized residuals.

3.2. Extreme Value Theory-Based Anomaly Detection

Anomaly detection is based on modeling distribution tails using extreme value theory and, more specifically, by fitting a generalized Pareto distribution (GPD) to excess values exceeding a high threshold [17].
Selecting the threshold is a crucial step. An initial diagnosis is performed using a mean excess plot, which illustrates the expected value of the excesses as a function of various thresholds.
The excesses are defined by
y i = x i − u , for x i > u .
These excesses are then fitted to a generalized Pareto distribution whose probability density function is given by
G ξ , σ ( y ) = 1 − 1 + ξ y σ − 1 / ξ ,
under the following conditions:
y > 0 , 1 + ξ y σ > 0 ,
where ξ is the shape parameter and σ is the scale parameter.

3.3. Anomaly Correction Methods

After identifying outliers using the EVT method, we proceed to correct them to ensure the reliability of future analyses. To this end, we have chosen to use five commonly employed methods.

3.3.1. Outlier Removal

Removing outliers is often considered the simplest way to address the problem, involving the complete elimination of data points deemed outliers. Although this method has the drawback of creating gaps in the data set and reducing the sample size, it remains a suitable approach when extreme values are rare and could skew the estimates [18].

3.3.2. Forward Fill

This technique is particularly useful for data with a high degree of repetition or when missing values are caused by short-lived events; this method involves replacing each missing data point with the last valid data point observed prior to it, so for a missing value at time t, we define x t as equal to x t − 1 , which demonstrates its advantage in terms of ease of application [19].

3.3.3. Backward Fill

This method is useful when the observation following the outlier better reflects the underlying trend of the time series being analyzed; unlike the forward fill method, the backward fill technique replaces the outlier with the valid value that comes after it [20].

3.3.4. Linear Interpolation

Linear interpolation aims to replace an outlier with a value lying on the line connecting the two adjacent valid observations. Thus, if we have an outlier at a given time t with adjacent observations x t − 1 and x t + 1 , then the adjusted value is calculated as follows:
x ^ t = x t − 1 + x t + 1 2 .
This approach assumes that the trend between adjacent points is linear. It offers a good balance between simplicity and accounting for the temporal structure of the data [21].

3.3.5. Median Interpolation

This method is very useful for handling outliers while preserving the local trend of the data series; it is particularly well-suited to situations where the data exhibit irregular variations. In practice, median interpolation is a method that involves replacing an outlier with the median of a set of values surrounding that observation [22].
  • The smoothed value is defined by
    x ^ t = med { x s : S ∈ W t } ,
    where W t is a set of k observations centered around time t.

3.4. Forecasting Model: Support Vector Regression (SVR)

Support vector regression is a supervised learning technique derived from support vector machines (SVMs) and is based on the principle of defining a function f ( x ) to estimate the observations with an error rate below a certain tolerance threshold ϵ , while maintaining the simplicity of the model, which is particularly effective for complex and potentially nonlinear relationships between variables [23,24]. The following optimization problem illustrates the trade-off discussed:
min w , b , ξ , ξ ∗ 1 2 ∥ w ∥ 2 + C ∑ t = 1 n ( ξ t + ξ t ∗ ) ,
where ε determines the width of the insensitivity tube, C is a regularization parameter that balances model complexity and error tolerance, and ξ t , ξ t ∗ are relaxation variables that reflect deviations from this threshold.
In this study, SVR is used as a predictive model to measure the impact of outlier detection and correction techniques on predictive performance, rather than specifically to refine the model.

3.5. Performance Evaluation Metrics

There are several criteria that can be used to evaluate the forecasting model, including absolute errors, squared errors, and goodness-of-fit indicators.
Each set of metrics offers a specific perspective on forecasting accuracy:
  • Absolute errors (MAE, NMAE, SMAPE, MAAPE) assess the average magnitude of errors in terms of absolute value. The mean absolute error (MAE) is insensitive to extreme values, whereas the symmetric mean absolute proportional error (SMAPE) is particularly suitable for series containing zero values or values close to zero. The normalized mean absolute error (NMAE) allows for the comparison of series with varying scales. The mean arctangent absolute percentage error (MAAPE) provides a bounded alternative to percentage-based error metrics and is less sensitive to extreme percentage errors [25].
  • Quadratic errors (MSE, RMSE, NRMSE) impose a harsher penalty on large errors by raising them to the second power. The root mean square error (RMSE) is expressed in the unit of measurement of the target variable, whereas the normalized root mean square error (NRMSE) allows for comparisons across different scales [26].
  • Model fit indicators ( R 2 , EVS) measure the proportion of variance explained by the model. The coefficient of determination R 2 assesses the model’s overall fit, whereas the EVS (Explained Variance Score) has the advantage of not penalizing systematic errors (bias) [27,28].
  • Using these indicators together creates a picture of how well predictions work. It shows the accuracy how sensitive the results are to unusual data points and how well the model fits the data. This approach gives a view of performance from many angles.

3.6. Integrated EVT-Imputation-SVR Framework

The suggested paradigm unifies forecasting, anomaly correction, and anomaly detection into a single pipeline. EVT is first utilized to detect extreme observations using the POT-GPD technique, as shown in Figure 1. Five different correction techniques are then applied to the identified anomalies: median replacement, linear interpolation, forward filling, reverse filling, and suppression. An SVR model is then fed each rectified series for forecasting.
Figure 1. Proposed methodology pipeline for anomaly correction and time series forecasting.
The methodical comparison of different corrective techniques inside the same EVT-based detection and SVR forecasting framework is the main contribution. This design enables us to determine which correction technique produces the most accurate forecasts, as well as if anomalies have an impact on forecasting accuracy. Therefore, rather than suggesting a new EVT or SVR algorithm, the originality is found in the combined EVT–imputation–SVR pipeline and in the empirical assessment of the forecasting impact of alternative anomaly treatments.

4. Results and Discussion

4.1. EVT-Based Anomaly Detection

The EVT method led us to identify 92 anomalies corresponding to periods during which the normalized data exceeded the critical threshold set at the 95th percentile of the normalized residuals, namely u = 1.4973 , and which do not decrease uniformly over time, particularly for the years 2021 and 2022 (see Figure 2). Furthermore, after adjusting the generalized Pareto distribution to account for extreme values, we obtained the following parameters: fitted GPD parameters of ξ ^ = − 0.6947 and σ ^ = 0.5585 .
Figure 2. EVT-based anomaly detection in the standardized Moroccan phosphate export time series.
A negative shape parameter ( ξ ^ < 0 ) indicates that the fitted Generalized Pareto Distribution (GPD) has a bounded upper tail with a finite right endpoint. Thus, the negative value does not indicate a heavy-tailed distribution; rather, it suggests that the extreme excesses have an upper bound under the fitted model. In the present study, the estimated value ξ ^ = − 0.6947 therefore indicates a bounded upper tail for the extreme observations.

4.2. Analysis of Corrected Time Series

The use of various techniques to correct anomalies results in specific changes to the original time series. Figure 3 illustrates a visual comparison of the adjusted series obtained using five distinct techniques: exclusion, forward fill, Backward Fill, linear interpolation, and median interpolation.
Figure 3. SVR forecasting results after applying different anomaly correction methods: zoomed-in view (April–July 2021).
Removing outliers results in a break in the time series by simply deleting the observations considered to be outliers. Although simple, this method has the disadvantage of reducing the sample size and creating gaps that may hinder the detection of temporal patterns. Forward interpolation and backward interpolation produce homogeneous series, but result in a continuity effect (repetition of the previous value) or a prediction impact (repetition of the subsequent value), respectively. The results obtained using linear interpolation provide approximate values between adjacent observations, and these values show remarkable consistency over time, demonstrating that this approach offers a good balance between simplicity and the preservation of trends; conversely, median interpolation yields adjusted values for 1 June 2021 and 15 June 2021, which remain in line with the observed central trends, demonstrating that this method is very robust and reduces the impact of outliers.

4.3. SVR Predictive Performance Evaluation

Moving now to the evaluation of the support vector regression model’s performance by applying it to the test set, and analyzing Table 1, which presents the values of the evaluation metrics after applying each outlier removal method, we can see that the simple outlier removal method offers the best performance for the error metrics ( M A E = 6.55 , R M S E = 8.71 ), and the coefficient of determination is also higher ( R 2 = 0.954 ), which indicates that removing these outliers makes sense; otherwise, they would have introduced noise into the model’s learning process. On the other hand, the Forward Fill, Backward Fill, and linear interpolation yield very similar results, which suggests that these three imputation methods have comparable impacts on prediction quality. As for the last method, median interpolation, as shown in the table, it yields significantly degraded accuracy, with a mean absolute error of 9.87 , a mean squared error of 11.66 , and a coefficient of determination of 0.918 . The SMAPE, which increases from 15.08 % to 19.67 % , and the MAAPE, which increases from 0.165 to 0.216 , both show this drop. This indicates that variations across time are difficult for median interpolation to represent.
Table 1. Performance comparison of SVR model under different imputation methods (Test set).
One noteworthy observation relates to the explained variance score, or EVS statistic. The median approach has the greatest EVS score of 0.976 , while producing the lowest coefficient of determination. This might suggest that the variance in the median-adjusted series is different from that of the original series, which has a negative impact on the coefficient of determination without necessarily changing the model’s capacity to explain relative changes.
The forecasts are compared in Figure 4. All approaches yield projections between January and May 2023 that are just slightly different from the actual numbers. This is due to the fact that no significant abnormalities occurred during this time. A zero value, or 0 MDH, is noted in May 2023. This observation is eliminated using the deletion procedure as it is considered an outlier. The other approaches, on the other hand, approach it in a different way. The model forecasts vary significantly depending on the method, demonstrating that choosing the right technique to correct outliers is important. Regarding the forecasts obtained after applying median interpolation, it can be said that they deviate significantly from the actual values, particularly between September 2023 and December 2023; on the other hand, starting in early 2024, the forecasts show an increase after applying each of the correction methods, which implies that the difference between the correction techniques applied remains reasonable.
Figure 4. SVR forecasting results after applying different anomaly correction methods: overall comparison.

5. Concluding Remarks and Future Directions

This article presents an approach that combines anomaly detection with correction methods to improve economic forecasts. The results are of interest for practical applications and pave the way for further research. One potentially useful method would be to employ imputation techniques that adapt to the context of the time series. The use of deep learning to simultaneously detect and correct anomalies could also be a promising avenue. This approach could outperform current methods and deliver more accurate results. Although the proposed framework yielded encouraging results, its validation was conducted on a specific dataset. Future research could therefore investigate its applicability to other economic and industrial contexts. In addition, the development of an automatic criterion for selecting the most appropriate imputation method according to the characteristics of the time series represents a promising direction. Finally, integrating anomaly detection, correction, and forecasting into a unified deep learning framework could further improve predictive performance and better capture complex temporal dependencies.

Author Contributions

Conceptualization, I.C.; formal analysis, I.C.; writing—original draft preparation, I.C.; supervision, M.F. and O.J.; writing—review and editing, M.F. and O.J. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

No new data were created or analyzed in this study. Data sharing is not applicable to this article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Makridakis, S.; Spiliotis, E.; Assimakopoulos, V. The M4 Competition: 100,000 time series and 61 forecasting methods. Int. J. Forecast. 2020, 36, 54–74. [Google Scholar] [CrossRef] [Scilit]
  2. Benjelloun, Z.; Saoud, K. Phosphate mining and the circular economy: Morocco’s OCP Group’s approach to sustainable water use. In Sustainable Industrial Water Use: Perspectives, Incentives; IWA Publishing: London, UK, 2021; pp. 63–72. [Google Scholar]
  3. Fergus, P.; Chalmers, C. Performance evaluation metrics. In Applied Deep Learning: Tools, Techniques, and Implementation; Springer: Berlin/Heidelberg, Germany, 2022; pp. 115–138. [Google Scholar]
  4. Blázquez-García, A.; Conde, A.; Mori, U.; Lozano, J.A. A review on outlier/anomaly detection in time series data. ACM Comput. Surv. 2021, 54, 1–33. [Google Scholar] [CrossRef] [Scilit]
  5. Ostroški, D.; Slovenec, K.; Brajdić, I.; Mikuc, M. Anomaly correction in time series data for improved forecasting. In Proceedings of the 2021 16th International Conference on Telecommunications (ConTEL); IEEE: Piscataway, NJ, USA, 2021; pp. 85–88. [Google Scholar]
  6. Kahil, S.; Jellouli, O.; Fihri, M. Hybrid clustering and extreme value theory for anomaly detection in electricity consumption: A case study on Tetouan’s grid. Statistics 2025, 60, 340–381. [Google Scholar] [CrossRef] [Scilit]
  7. Mikosch, T.; Wintenberger, O. Extreme value theory for time series. In Models with Power-Law Tails; Springer: Berlin/Heidelberg, Germany, 2024. [Google Scholar]
  8. Patcha, A.; Park, J.-M. An overview of anomaly detection techniques: Existing solutions and latest technological trends. Comput. Netw. 2007, 51, 3448–3470. [Google Scholar] [CrossRef] [Scilit]
  9. Cao, L.-J.; Tay, F.E.H. Support vector machine with adaptive parameters in financial time series forecasting. IEEE Trans. Neural Netw. 2003, 14, 1506–1518. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  10. Boujmiraz, S.; El Ghazi, A.; Bouziane, K.; Sanjari, M.J.; Jellouli, O.; Berrada, A. High-resolution AI-based forecasting and techno-economic assessment of green hydrogen production from a hybrid PV/wind system at the regional scale. Int. J. Hydrogen Energy 2025, 190, 152098. [Google Scholar] [CrossRef] [Scilit]
  11. Gupta, S.; Kishan, B.; Gulia, P. Comparative analysis of predictive algorithms for performance measurement. IEEE Access 2024, 12, 33949–33958. [Google Scholar] [CrossRef] [Scilit]
  12. Kahil, S.; Jellouli, O.; Fihri, M. A statistical learning framework for solar irradiance forecasting using temperature clustering and tree-based models. Theor. Appl. Climatol. 2026, 157, 111. [Google Scholar] [CrossRef] [Scilit]
  13. Vignotto, E.; Engelke, S. Extreme value theory for anomaly detection–the GPD classifier. Extremes 2020, 23, 501–520. [Google Scholar] [CrossRef] [Scilit]
  14. Meisenbacher, S.; Turowski, M.; Phipps, K.; Rätz, M.; Müller, D.; Hagenmeyer, V.; Mikut, R. Review of automated time series forecasting pipelines. Wiley Interdiscip. Rev. Data Min. Knowl. Discov. 2022, 12, e1475. [Google Scholar] [CrossRef] [Scilit]
  15. Sapankevych, N.I.; Sankar, R. Time series prediction using support vector machines: A survey. IEEE Comput. Intell. Mag. 2009, 4, 24–38. [Google Scholar] [CrossRef] [Scilit]
  16. Elmotawakkil, A.; Moumane, A.; Sadiki, A.; Zahi, A.; Al Karkouri, J.; Batchi, M.; Kumar Bhagat, S.; Enneya, N. Forecasting short-term rainfall patterns in arid and semi-arid regions using machine learning and deep learning models: A case study from Morocco. Theor. Appl. Climatol. 2025, 156, 436. [Google Scholar] [CrossRef] [Scilit]
  17. Nabil, M.; Hnida, M.; Haqiq, A.; Hilal, I. Advanced Anomaly Detection in Mobile Networks: A Hybrid Approach Based on Statistical and Machine Learning Techniques. Int. J. Interact. Mob. Technol. 2025, 19, 162–182. [Google Scholar] [CrossRef] [Scilit]
  18. Abahous, H.; Ronchail, J.; Sifeddine, A.; Kenny, L.; Bouchaou, L. Trend and change point analyses of annual precipitation in the Souss-Massa Region in Morocco during 1932–2010. Theor. Appl. Climatol. 2018, 134, 1153–1163. [Google Scholar] [CrossRef] [Scilit]
  19. Mavridis, D.; Moustaki, I. Detecting outliers in factor analysis using the forward search algorithm. Multivar. Behav. Res. 2008, 43, 453–475. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  20. Rodionova, O.Y.; Pomerantsev, A.L. Detection of outliers in projection-based modeling. Anal. Chem. 2019, 92, 2656–2664. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  21. Wahir, N.A.; Nor, M.E.; Rusiman, M.S.; Gopal, K. Treatment of outliers via interpolation method with neural network forecast performances. J. Phys. Conf. Ser. 2018, 995, 012025. [Google Scholar] [CrossRef] [Scilit]
  22. Rousseeuw, P.J. Robust estimation and identifying outliers. In Handbook of Statistical Methods for Engineers and Scientists; McGraw-Hill: New York, NY, USA, 1990; Volume 16, pp. 11–16. [Google Scholar]
  23. Bargam, B.; Boudhar, A.; Kinnard, C.; Bouamri, H.; Nifa, K.; Chehbouni, A. Evaluation of the support vector regression (SVR) and the random forest (RF) models accuracy for streamflow prediction under a data-scarce basin in Morocco. Discov. Appl. Sci. 2024, 6, 306. [Google Scholar] [CrossRef] [Scilit]
  24. Chabba, I.; Jellouli, O.; Fihri, M. Forecasting Moroccan Electricity Imports Using Time Series Models: A Comparative Study of SARIMA and Support Vector Regression. Bol. Soc. Parana. Mat. 2026, 44, 1–17. [Google Scholar] [CrossRef] [Scilit]
  25. Chicco, D.; Warrens, M.J. The coefficient of determination R-squared is more informative than SMAPE, MAE, MAPE, MSE and RMSE in regression analysis evaluation. PeerJ Comput. Sci. 2021, 7, e623. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  26. Shcherbakov, M.V.; Brebels, A.; Shcherbakova, N.L.; Tyukov, A.P.; Janovsky, T.A.; Kamaev, V.A. A survey of forecast error measures. World Appl. Sci. J. 2013, 24, 171–176. [Google Scholar]
  27. Bardsley, W.E. A goodness of fit measure related to r2 for model performance assessment. Hydrol. Process. 2013, 27, 2851–2856. [Google Scholar] [CrossRef] [Scilit]
  28. Ejaz, W.; Anpalagan, A. Internet of Things for Smart Cities: Technologies, Big Data and Security; Springer: Berlin/Heidelberg, Germany, 2019. [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.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.