Time Series Prediction of Rainfall and Temperature Trend using ARIMA Model

Rainfall and temperature are two key factors to examine while assessing climate change. Bangladesh has witnessed extremes in rainfall and temperature during the previous few decades, affecting both the environment and the agricultural economy. In this study, the ARIMA model is used to predict and forecast rainfall and temperature in Chattogram, Bangladesh from 1953 to 2070 considering seasonal variations. Analyzed data indicated a substantial to a fairly significant upward trend in December, with a slight increase in rainfall between years 2021-2050 and 2050-2070. Rainfall reflects a more dominant rising trend in later parts of the selected four-time series, indicating more rainfall during the Monsoon season. Temperature follows an upward trend with time, the most significant positive trend occurring between 2021 and 2050, and a large negative trend occurring between 2050 and 2070. In the years 2021-2050, the yearly average temperature is expected to drop during the Rabi season. In April, May, July, and October, there is a significant negative connection between rainfall and temperature, meaning that temperatures will rise with less precipitation and vice versa.


Introduction
Bangladesh is a low-lying country in south Asia, located between 20º34'N to 26º38'N latitude and 88º01'E to 92º41'E longitude, with heavy rainfall during the summer and monsoon seasons and little rainfall throughout the rest of the year. It is located on the deltas of rivers that start in the Himalayas and run through the nation. The nation is bordered on the south by the Bay of Bengal, on the east by the Assam Hills, and on the north by the Himalayas. Bangladesh is situated in the tropical monsoon season, which means it is hot and humid. Pre-monsoon (March-May), Monsoon (June-September), Post-monsoon (October-November), and Winter are the four major seasons of Bangladesh (December-February) [1,2].
Variation of rainfall and temperature has received plenty of attention from the international community and policymakers. Observations show that climate change is causing changes in rainfall amount, intensity, frequency, and type. Temperature is rising globally, and rainfall frequency and intensity are fluctuating, according to several studies [3][4][5]. These two parameters fluctuate in different ways in different regions [6]. Climate change is exacerbated by urbanization and human activities. [7]. The agricultural activities of Bangladesh are also influenced by climatic factors such as rainfall and temperature. Moreover, in any region, rainfall and temperature are considered to be the most significant criteria for managing the agriculture system, productivity, food security, and crop demand [8]. Furthermore, analysis of rainfall and temperature variation trend gives useful information for water resources planning, flood control, and drought management [9]. Rainfall and temperature trend analysis aids in mitigating the consequences of climate change and, as a corollary, aids in the identification of solutions for urban drainage management systems. [10]. Many researchers found that the temperature is increasing day by day and the rainfall pattern is shifting for the onset and cessation months [8,10,11] also the changing trend is statistically insignificant [11]. Although temperature shows a statistically significant positive trend in most cases [12,13]. Nasher and Uddin [14], concluded the northern portion of Bangladesh is prone to extreme climate whereas the southern portion is more prone to warming.
Many researchers used ARIMA model for forecasting and predicting climatic parameters [15][16][17]. ARIMA model can be applied to rationalize the results from different approaches in the present study in addition to justify the outcomes from other studies. Mann-Kandall (MK) and Sen's slope (SS) tests are useful for trend analysis and determination of the magnitude of change at a verified significant level [18][19][20]. Bhuyan et al. [21] predicted temperature will be increased at a rate of 1.62℃ and rainfall will be decreased by 40.1 mm during the period 2040-2100 in the north-western region of Bangladesh. Using similar methods, Hossain et al. [22] investigated the variability of rainfall in Bangladesh's southwest coastal area, finding increasing patterns. Similar type of study is in rudimentary level in the south-eastern region (e. g. Chattogram) of Bangladesh. The study will forecast future rainfall and temperature changes using the ARIMA model for Bangladesh's south-eastern area (for example, Chattogram). This research will also show seasonal variations in rainfall and temperature.

Study Area
Chattogram city (as seen in Fig. 1) has been taken as the study area. Monthly data of rainfall and temperature collected from 1953 to 2020 from Patenga, Chattogram (22.  Total time series is divided into four phases (1953-1990, 1991-2020,2021-2050, 2051-2070). Trend analysis and significance test have been done using Mann-Kandall (MK) analysis and magnitude of change is determined using Sen's slope (SS) estimator. Moreover, correlation analysis between rainfall and temperature is done using Spearman's rank correlation method. Finally, the study is concluded with a comparative variation of rainfall and temperature in different seasons.

Prediction and forecasting using ARIMA
The Auto-Regressive Integrated Moving Average (ARIMA) model is used to forecast rainfall and temperature trends. The model is simple and effective, demonstrating a stochastic time series model that may be used to anticipate future events using present data. The three essential elements of the ARIMA model are autoregressive, integrated, and moving average, which drives the evaluation and selection of coefficients iteratively and recursively. Because data stationarity is required, stationarity tests were initially performed using monthly data for the period of the research by displaying Auto Correlation Function (ACF) and Partial Auto Correlation Function (PACF) as shown in Fig. 2.
The monthly data has been found to be inconsistent and nonstationary, as seen in Fig.  2(a), with spikes crossing the upper and lower border levels. The ARIMA model was created using IBM-SPSS version 20 and Box-Jenkins' algorithm methods. As previously stated, the ARIMA (p, d, q) model uses three predictor variables to predict and forecast data, where p refers to the number of autoregressive orders, d to the order of differencing applied to the series, and q (0) to the number of moving average orders of the data series. Prior to future prediction, the various ACF and PACF have been assessed as acquired from several trials for various p, d, and q values until the spikes in ACF and PACF fall between upper and lower boundary limits. Fig. 2(b) depicts the final trial in this sequence.

Statistical method for trend analysis
Trend analysis of rainfall and temperature were done using Mann-Kandall (MK) analysis. The magnitude of the changes in the rainfall and temperature were calculated using Sen's Slope (SS) estimator. In Mann-Kendall analysis, the number of sequential values in studied data series is denoted by n. When n is less than 9, the absolute value of S is directly compared to Mann and Kendall's theoretical S distribution [23]. The Mann-Kendall test statistic S is calculated by using Eq. (1). Where, x j and x k are the sequential data values. When S bears a positive value, it indicates an upward or increasing trend and if the value is negative, it indicates a downward trend or decreasing trend. If n is at least 10 or more than 10, the test follows a normal distribution and hence normal approximation test is used with expectation (E) and variance of S VAR(S) as using Eq. (2).
Here, q is the number of tied groups and t p is the number of data points in the p th tied group in the dataset. The standardized test statistic (Z) is calculated using Eq. (3).
Where, the value of Z is the Mann-Kendall test statistic, which has a conventional normal distribution with a mean of 0 and variance of 1. In this study, confidence intervals of 90 %, 95 %, 99 %, 99.99 % (p < 0.10, p < 0.05, p < 0.01 and p < 0.001 respectively) were used to categorize the significance of positive and negative trends of temperature and rainfall.
Sen's slope estimator is known as the slope of the linear trend, which has been estimated using the Theil-Sen estimator [24]. It is a nonparametric technique used to determine the true slope of an existing trend where the trend can be assumed linear (as change per time). The slope (Q) estimates of N pairs of data are first computed by Eq. (4).

(4)
Where x j and x k are data values at times j and k (j > k), respectively. The median of these N values of Q is the Sen's estimator of the slope.

Correlation analysis
Spearman's rank correlation coefficient (r s ) is a method to determine the correlation between variables that are not normally distributed using a monotonic function. In this study, correlation is done between rainfall and temperature for different months and seasons. The coefficient can be determined using Eq. (5).
Where, n denotes the number of alternatives, and d i represents the changes between the ranks of two parameters. In this study, confidence intervals of 95 % and 99 % (p < 0.05, p < 0.01) were chosen for the analysis.

Trend of rainfall variation
The predicting of future rainfall (Fig. 3) and temperature (Fig. 4) was done using the current trend ARIMA (28~30, 0, 0) model. For each example, several statistical metrics such as stationary R squared (R 2 ) and R squared (R 2 ) were employed to assess the model's accuracy. The average stationary R squared (R 2 ) and R squared (R 2 ) for rainfall and temperature prediction were 0.952 and 0.884, respectively, according to this study. Pal and Masum found a similar result [25].  The monthly average rainfall data for the four-time spans (based on the industrial development and urbanization phases) have been shown in Fig. 5(a). From the plot, significant changes in monthly rainfall have been found over the years and the years to come. Monthly rainfall showed augmented value during March-September meaning increasing rain in Pre-monsoon (March-May) and Monsoon (June-September) period. Similar type of trend was observed by Rahman et al. [17] when predicting the rainfall over Bangladesh. Excessive rainfall will cause high floods endangering the crops and creating waterlogging in the city. On the other hand, October-November showed a similar decreasing (December-January) rainfall trend followed by an increment during February predicting lesser rainfall and drier crop season. Seasonal variation in Fig. 5(b) also showed increased rainfall in the Pre-monsoon (March-May) and Monsoon (June-September) period resulting in an increment in the Kharif season and continuous dry days in Rabi season. Usually, January and July are the driest and wettest months of the year respectively.   The yearly deviation of rainfall from the mean value (see Fig. 6) displayed that, although few occurrences of positive deviation happened in earlier years, it became frequent after the year 2008. More positive deviance being regular incidents in the future refer heavily to very heavy yearly precipitation that can result in devastating landslides in the hilly zones of the city.

Trend of temperature variation
The average temperature of Chattogram city is usually high all year round, especially during the Pre-monsoon and Monsoon seasons. In Fig. 7(a), the average monthly temperature variation has been displayed, with August displaying a consistent increment throughout all phases. Except for April, August, and December, average monthly temperatures are increasing through 2021-2050, then declining from 2050 to 2070. Fig.  7(b) shows the warmest years from 1991 to2020, which is inconsistent given the current high rate of global warming because the temperature is anticipated to climb. The monthly temperature is varying from 1 °C to 3 °C between 1953-1990 and 1991-2020. The variation is decreased from 0.5 °C to 2 °C between 1991-2020 and 2020-2050. Seasonal variation is also showed a similar pattern. From 1990 to 2020, the seasons were warmer, and they are anticipated to cool slightly in the future. The deviation plot showed a similar prognosis of smaller temperature differences in future years (Fig. 8). The average yearly temperature difference from the mean temperature ranged from -0.7 °C to 0.9 °C through 2025, and it is expected to range from +0.25 °C to -0.26 °C starting in 2026, implying less yearly weather variation.

Results of trend (MK-SS) analysis
The MK and SS tests for monthly, seasonal, and annual rainfall (Table 1) and temperature ( Table 2) showed that the changes are significant. Among all the months, the month of April has a strong positive trend (99 %) from 1953 to1990, and a moderately positive trend is projected from 2021 to 2050. In December 2021-2050 and 2050-2070, there is a sign of a moderately significant positive trend, with a modest increase in rainfall. Among the four-time series phases, rainfall is displaying a more positive trend in later phases compared to previous phases, indicating greater rainfall during the Monsoon season. Rabi and Kharif have a positive trend from 1991 to 2020. In terms of temperature, more months are showing a negative trend in the latter phases after being positive in the preceding phase, indicating a future with lower temperatures. The temperature in August follows a positive trend over time, with the most significant positive trend occurring in 2021-2050 and a major negative trend occurring later in 2050-2070. The winter season is going to be colder compared to past years with November having a positive trend until 2020, and a vigilantly negative trend later. On the other hand, in April and June, it is seen to have a consistent positive trend skipping the 2021-2050 phase. With a warmer Pre-Monsoon period, Post monsoon temperature showed a significant positive trend earlier until 1990. In the years 2021-2050, the annual average temperature is expected to decline, with a notable negative temperature trend during the Rabi season.  The correlation study was performed to investigate the relationship between rainfall and temperature. During April, May, July, and October, as shown in Table 3, there is a significant negative relationship between rainfall and temperature, implying that temperature rises when precipitation drops and vice versa. Typically, these are the warmest months of the year. In the months of March and June, there is also a weak negative connection. Despite the fact that it does not rain much throughout the dry season, there is a nonsignificant positive relationship between rainfall and average temperature from November to January, showing that a modest rise in average temperature will result in greater rainfall. There is no notable relationship in any other month. Rainfall and temperature have a modest negative connection during the Pre-Monsoon and Post-Monsoon seasons. Temperature fluctuates unfavorably during Rabi season and positively during Kharif season, despite the fact that there is no significant yearly relationship.

Conclusion
This study analyzed the previous rainfall and temperature records to forecast changes in their trends in the study area over short and long periods using ARIMA model. The value of average stationary R squared (R 2 ) and R squared (R 2 ) validates the accuracy of the model. As the values are satisfactory, it can be established that the model is accurate and acceptable. In various climatic and crop seasons, the rainfall pattern displays fewer substantial variations. The temperature pattern, on the other hand, displays considerable variations across most of the seasons. In the following 30 years, the temperature is expected to drop at a pace of 0.012 °C each year. Except for March-July in the pre-and post-monsoon seasons, where there is a substantial negative association, there is a negative correlation