Decomposition, modeling and forecasting of the time series of discharge of the Desna river using the “bsts” package of the R programming language

Borys Khrystiuk
Ukrainian Hydrometeorological Institute of the State Emergency Service of Ukraine and the National Academy of Sciences of Ukraine, Kyiv
https://orcid.org/0000-0003-4290-3745

Liudmyla Gorbachova
Ukrainian Hydrometeorological Institute of the State Emergency Service of Ukraine and the National Academy of Sciences of Ukraine, Kyiv
https://orcid.org/0000-0003-1033-9385

DOI: https://doi.org/10.15407/Meteorology2026.09.062

Keywords: package «bsts», structural model of time series, discharge, training and test samples, trends

Abstract

Qualitative forecasting of river water levels is an important component for planning and functioning of various water-dependent sectors of the economy: agriculture and municipal services, hydropower, fisheries, shipping, etc. Forecasting of river daily discharges is based on both simple graphical methods and deterministic and stochastic models. The article is devoted to the use of the “bsts” package of the R programming language for modeling and forecasting daily discharges of the Desna River – Litky village. After decomposition of the time series of daily discharges was found that these series consist of three components: a trend, a seasonal component, and random fluctuations. In the process of creating the 'bsts' model, the main functions of the 'bsts' package, which form the various components of this model, were considered: add.seasonal, add.local.level, add.ar, add.local. linear.trend, add.semilocal. linear.trend and add.student.local.linear.trend. The results of modeling the daily discharges of the training and test samples were evaluated using five statistical indicators: residual.sd, prediction.sd, rsquare, relative.gof та МАРЕ, and also by the accumulated error curve of the next step. The optimal model is the “bsts” - model without predictors, which models daily discharges using the add.student.local.linear.trend function and random fluctuations. This model is suitable for short-term forecasting of daily discharges of the Desna River – Litky village during periods of their long and smooth increase or decrease, as well as during periods of stable low water levels. Forecasting daily discharges using the 'bsts' - model is based on a trend that relates this model to forecasting based on spring flood decline curves, which take into account the depletion of water reserves in the channel network, and trends that take into account the inertia of hydrological processes.

References

1. Annual data on the regime and resources of land surface waters, 2020. Part 1. Rivers and Channels. Vol. 2. Dnipro Basin (2021). Kyiv: Central Geophysical Observatory named after Boris Sreznevsky. [in Ukrainian]

2. Befany, N.F., & Kalinin, G.P. (1983). Exercises and methodological developments on hydrological forecasts (2nd edition). Leningrad: Hydrometeoizdat. [in Russian]

3. Bounceur, N., Hoteit, I., & Knio, O. (2020). A Bayesian Structural Time Series Approach for Predicting Red Sea Temperatures. Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 13, 1996–2009. http://doi.org/10.1109/jstars.2020.2989218

4. Chakravarti, A., Joshi, N., & Panjiar, H. (2015). Rainfall Runoff Analysis Using Artificial Neural Network. Indian Journal of Science and Technology, 8(14), 1–7. https://doi.org/10.17485/ijst/2015/v8i14/54370

5. Gorbachova, L.A, & Kolyanchuk, O.V. (2011). Catalog of spring floods in the basin of the Desna River. Nauk. pratsi UkrNDGMI, 261, 179–191. [in Ukrainian]

6. Guide to Hydrological Practices (2009). Management of Water Resources and Application of Hydrological Practices. Vol. II. Sixth edition. WMO-No. 168. Geneva: World Meteorological Organization.

7. Hyndman, R.J., & Killick, R. (2026). CRAN Task View: Time Series Analysis. Version 2026-01-31. Available at: https://CRAN.R-project.org/view=TimeSeries

8. Ilich, N., Gharib, A., & Davies, E.G.R. (2018). Kernel distributed residual function in a revised multiple order autoregressive model and its applications in hydrology. Hydrological Sciences Journal, 63(12), 1745–1758. https://doi.org/10.1080/02626667.2018.1541090

9. Katimon, A., Shahid, Sh., & Mohsenipour, M. (2018). Modeling water quality and hydrological variables using ARIMA: a case study of Johor River, Malaysia. Sustainable Water Resources Management, 4(4), 991–998. https://doi.org/10.1007/s40899-017-0202-8

10. Khrystiuk, B., & Gorbachova, L. (2019). Long-term forecasting of extraordinary spring floods by commensurability method on the Dnipro River near Kyiv city, Ukraine. Environmental Research, Engineering and Management, 75 (2), 74–81. https://doi.org/10.5755/j01.erem.75.2.22683

11. Khrystiuk, B., & Gorbachova, L. (2025). Simulation of rain floods of the Stryi River by an artificial neural network. Meteorology. Hydrology. Environmental monitoring, 1(7), 71–78. https://doi.org/10.15407/meteorology2025.07.071 [in Ukrainian]

12. Kochanek, K., & Markiewicz, I. (2022). Statistical Approach to Hydrological Analysis. Water, 14, 1094. https://doi.org/10.3390/w14071094

13. Koshkina, O.V. (2017). Factors, parameters and current tendencies of the maximum runoff of spring flood in the Desna River basin. Dys. ...kand. geogr. nauk: 11.00.07. Kyiv: Taras Shevchenko National University of Kyiv. [in Ukrainian]

14. Lipinskiy, V.M., Dyachuk, V.A., & Babichenko, V.M. (2003). Climate of Ukraine. Kyiv: Raevsky Publishing House. [in Ukrainian]

15. Lukman, M. & Tanan, B. (2021). Time series modeling by using exponential smoothing technique for river flow discharge forecasting (case study: Cabenge, Walanae, and Cenranae rivers system). IOP Conference Series: Materials Science and Engineering, 1088. http://doi.org/10.1088/1757-899X/1088/1/012100

16. Machiwal, D., & Jha, M.K. (2012). Hydrologic Time Series Analysis: Theory and Practice. India, New Delhi: Springer. https://doi.org/10.1007/978-94-007-1861-6

17. Mohammed, A., Bakar, M.A.A., Mansor, M.M., & Ariff, N.M. (2024). Modelling Malaysia Air Quality Data using Bayesian Structural Time Series Models. Sains Malaysiana, 53(11), 3817–3829. http://doi.org/10.17576/jsm-2024-5311-23

18. Nop, C., Fadhil, R.M., & Unami, K. (2021). A multi-state Markov chain model for rainfall to be used in optimal operation of rainwater harvesting systems. Journal of Cleaner Production, 285, 124912. https://doi.org/10.1016/j.jclepro.2020.124912

19. Righetti, N. (2025). Time Series Analysis with R. Available at: https://nicolarighetti.github.io/Time-Series-Analysis-With-R/

20. Rozos, E. (2020). A methodology for simple and fast streamflow modelling. Hydrological Sciences Journal, 65(7), 1084–1095. https://doi.org/10.1080/02626667.2020.1728475

21. Scott, S.L. (2025). Package «bsts». Bayesian Structural Time Series. Available at: https://cran.r-project.org/web/packages/bsts/bsts.pdf

22. Scott, S.L., & Varian, H.R. (2014). Predicting the Present with Bayesian Structural Time Series. International Journal of Mathematical Modelling and Numerical Optimisation, 5(1-2), 4–23. https://doi.org/10.1504/IJMMNO.2014.059942

23. Shang, M., Huang, J., Liu, P., Gao, J., & Li, J. (2025). Coupled exponential smoothing and gray model for water quality prediction in the Guo River, China. Water Science and Technology, 91(8), 960–976. https://doi.org/10.2166/wst.2025.051

24. Sharma, T.C., & Panu, U.S. (2025). Modelling Hydrological Droughts in Canadian Rivers Based on Markov Chains Using the Standardized Hydrological Index as a Platform. Hydrology, 12, 23. https://doi.org/10.3390/hydrology12020023

25. Svetunkov, I. (2023). Forecasting and Analytics with the Augmented Dynamic Adaptive Model (ADAM). New York: Chapman and Hall/CRC. https://doi.org/10.1201/9781003452652

26. Zengin, H., Özcan, M., Değermenci, A.S., & Çitgez, T. (2023). Multiple linear regression models for the estimation of water flows for forestmanagement and planning in Türkiye. Water SA, 49(3), 220–229. https://doi.org/10.17159/wsa/2023.v49.i3.4000

About ׀ Editorial board ׀ Ethics ׀ For authors ׀ For reviewers ׀ Archive ׀ Contacts