Keywords

1 Introduction

Climate change is a challenge for humanity as temperatures in many parts of the world have reached record highs, causing catastrophes and placing many countries in a state of emergency. Global warming is related to the natural phenomenon of the Earth’s energy absorption and emission system becoming out of balance as the sun changes and the concentration of CO2 increases. As a result of a series of industrial activities, the system for absorbing and emitting energy is in disequilibrium, leading to an increase in temperature and global warming. In this paper, we focus on predicting global temperature to show the degree of global warming.

The ARIMA (Auto-Regressive Integrated Moving Average) model is a statistical analysis model that uses time series data to future trends. LSTM (Long Short-Term Memory) networks are a type of recurrent neural network capable of learning order dependence in sequence prediction problems. The reasons for our choice of research methodology are as follows. There is almost no research on the analysis and prediction of global temperature using ARIMA and LSTM. At the same time, we compare the accuracy of ARIMA with that of LSTM through the prediction results of global temperature.

In this paper, we aim to find a valid mathematical model to predict global temperature. Based on literature analysis above, we select polynomial regression model, ARIMA model and LSTM neural networks model. Throughout this paper, it assumes that the data collected are true and valid, all global temperatures are terrestrial, and the global temperature is calculated by the average temperature of all cities.

The paper is organized as follows. In Sect. 2, we summarize related work about global temperature prediction. Section 3 builds a regression model in terms of spatial scales, and makes a preliminary analysis of the data. Section 4 introduces the data source, ARIMA model and LSTM model. Section 5 analyzes and forecasts the change of global monthly average temperature with time using ARIMA model and LSTM model, respectively. By comparing the results of the two models, the optimal model is selected and the annual average temperature is predicted according to the optimal model. Finally, Sect. 6 concludes the paper.

2 Related Work

With the increasing impact of global warming on human beings, many domestic experts have also begun to pay attention to global temperature change.

In the time series study, Guoqing Zhang, Pengfei Li, Li Huang and Yaofei Wu conducted the Mann-Kendall mutation test and established the HoltWinters seasonless exponential smoothing model to predict trends in global mean temperature growth over the next 50 years, based on the collected data on global mean temperature distance levels [1]. Shuna Ni, Bo Tang, and Jiahui Cai addressed the characteristics of both trend and fluctuation of global annual mean temperature historical data, and proposed to use the combination of gray system theory and time series analysis to build a GM-ARMA combined model to predict global annual mean temperature [2]. In the work of Zhu and Li, since temperature data are closely related to time, the time series method can be used to analyze and evaluate temperature data [3]. The ARIMA (12,1,5) model is used to predict the global average temperature for the next century (2023–2100) [3].

The global mean annual temperature of the past ten years is predicted by using isometric recursive prediction method. Foreign countries have studied the problem of global warming earlier, and there are more related studies and rich results. Peide Zhang showed that the ARIMA (Auto Regressive Synthetic Moving Average) is one of the most popular linear time series forecasting models of the past 30 years [4]. In the study of neural networks, Yufeng Xue and Chaomei Yang used the Mexican cap wavelet function to analyze the river to study the characteristics of global temperature change in the last hundred years using artificial neural network to predict the global temperature change trend [5]. The results show that the temperature change has different characteristics and sudden change points in different time scales.

Ye Tao and Jinglin Du used random forest to select the meteorological elements highly correlated with temperature as input variables, eliminated the noise in the original meteorological data and reduced the complexity of the network [6]. Their prediction model was established using LSTM (Long and Short-Term Memory) network, and experiments were conducted on the collected multi-element meteorological data. Huiqing Hou considered the atmospheric carbon dioxide emissions over the years, the heat absorption and heat dissipation of the earth, and the ocean surface temperature change. Then the author established a global climate change prediction model based on BP neural network to predict the climate change in the next 25 years [7]. Wu, Yang and Li used a ISSA–LSTM model-based approach for predicting the air quality index (AQI), which consists of three main components: random forest (RF) and mRMR, improved sparrow search algorithm (ISSA), and long short-term memory network (LSTM) [8].

Recently, researches on ANNs (artificial neural networks) forecasting have shown that ANNs are promising methods for linear forecasting. Taylor and Buizza investigated the application of weather ensemble predictions in ANNs to load forecasting from 1 to 10 days in advance [9]. For the issue of global temperature prediction, Yin Zhang et al. used ARIMA model and LSTM model to perform multi-factor regression of global temperature in China [10].

As for other non-global temperature problems, the results of domestic and international studies using ARIMA models and LSTM models are quite remarkable. Sima Siami-Namini, Neda Tavakoli, Akbar Siami Namin investigated that whether the newly developed deep learning-based algorithms for forecasting time series data, such as LSTM, are superior to the traditional algorithms such as ARIMA model, and the results showed that LSTM outperforms ARIMA model [11]. Elsaraiti Meftah, and Adel Merabet aimed to find the most effective predictive model for time series. The result showed that, compared to the ARIMA, using ANNs, recurrent neural networks (RNNs), and LSTM have less errors and higher accuracy in the predictions of wind speed [12].

Based on this recent escalation, the Monkeypox outbreak has become a severe and urgent worldwide public health concern. Long, Tan and Newman aimed to develop an efficient forecasting tool that allows health experts to implement effective prevention policies for Monkeypox. This research utilized five machine learning models, namely, ARIMA, LSTM, Prophet, NeuralProphet, and a stacking model, which forecast the next 7-day trend of Monkeypox cases in the United States [13].

The work of Duan, Gong, Luo and Zhao build a combined model to accurately predict the AQI based on real AQI data from four cities. They used an ARIMA model, a CNN-LSTM model and the Dung Beetle Optimizer algorithm to determine the optimal hyperparameters and check the accuracy of the model [14].Wang used two forecasting models that are proposed in this study, which is the Autoregressive Integrated Moving Average model (ARIMA) compared with Long Short-Term Memory (LSTM), aiming to find a model with higher accuracy of the base station mobile traffic prediction [15].

Summarizing the related research, there is almost no research on the analysis and prediction of global temperature using ARIMA and LSTM. In this paper, we predict global temperature using ARIMA and LSTM and make comparison between the accuracy of ARIMA and that of LSTM.

3 Preliminary Data Analysis

3.1 Data Pre-processing

In this paper, we use the data from Berkeley Earth [16] and preprocess it. The time frame is unified from January 1900 to October 2013. The latitude and longitude of the cities are processed. South latitude and east longitude are assigned positive, and north latitude and west longitude are assigned negative. Since longitude has less influence on temperature [17], based on latitude, we divide the cities into four zones: North Temperate Zone, Northern Tropics, Southern Tropics and South Temperate Zone, with the criteria shown in Table 1.

Table 1. Regional classification criteria

3.2 Data Analysis

3.2.1 Global Temperature and Time

Based on the four zones obtained above, the regional average temperature trends from January to December in each zone are analyzed separately. Then we get a preliminary understanding of the global temperature.

Fig. 1.
figure 1

The temperature curve of the regions varies with the month

As shown in Fig. 1, in the long term, global temperatures are on an upward trend and fluctuate up and down on an annual cycle. The annual temperature of the north temperate zone is the lowest in January and the highest in July, with an overall trend of rising and then falling. The annual temperature of the south temperate zone is the lowest in July and the highest in January, with an overall trend of falling to the lowest temperature and then rising. The annual temperature of the northern tropics is the highest in May. And the annual temperature of the southern tropics is the lowest in July. In April and October, the temperature in the north temperate zone is about the same as that in the southern temperate zone. In March and November, the temperature in the northern tropics is approximately the same as that in the southern tropics.

After analysis, we conclude that the temperature in the northern hemisphere tends to rise and then fall throughout the year. And the southern hemisphere shows the opposite trend. The temperature in the southern hemisphere tends to fall and then rise throughout the year. The temperature in the northern and southern hemispheres is basically the same when the sun is directly over the Tropic of Cancer.

3.2.2 Global Temperature and Geographical Location

As shown in Fig. 1, during December to February, temperature is lowest in the north temperate zone and highest in the southern tropics. In July, the temperature in the south temperate zone reaches its lowest value, while the northern tropics is still at their highest temperature. Temperate regions have large fluctuations in temperature throughout the year, while the tropics is in a relatively stable state throughout the year, with their global temperatures above 20 ℃.

3.2.3 Global Temperature and Time, Geographical Location

From the preliminary analysis, we obtain the relationship between global temperature and time, and the relationship between global temperature and geographical location. To further determine the conclusion, we take global temperature as the dependent variable. And we take time, longitude, and latitude as the independent variables. The relationship is analyzed below.

First, the known data set is divided into training and validation sets. The training and validation sets are set at 80% and 20%. After training, the multivariate polynomial regression model has a better fit than the multiple linear regression model with a goodness-of-fit of 0.14. The goodness-of-fit of the quadratic polynomial regression model is 0.67 and the goodness-of-fit of the cubic polynomial regression model is 0.82. Therefore, we choose the cubic polynomial regression model and obtain

$$\begin{array}{*{20}c} {y = 0.43x_{1} + 0.023x_{2} - 16.17x_{3} - 0.0096x_{1}^{2} + 0.0002x_{1} x_{2} - 0.198x_{1} x_{3} - 0.0002x_{2} } \\ { + 0.014x_{2} x_{3} + 0.033x_{3}^{2} - 7.51 \times 10^{{ - 6}} x_{1}^{3} - 9.71 \times 10^{{ - 6}} x_{1}^{2} x_{2} + 0.00013x_{1}^{2} x_{3} } \\ {~~ + 7.25 \times 10^{{ - 6}} x_{1} x_{2}^{2} - 1.9 \times 10^{{ - 5}} x_{1} x_{2} x_{3} + 0.014x_{1} x_{3}^{2} - 1.85 \times 10^{{ - 6}} x_{2}^{3} } \\ { + 1.54 \times 10^{{ - 5}} x_{2}^{2} x_{3} - 0.0011x_{2} x_{3}^{2} - ~~0.019x_{3}^{3} + 28.34,} \\ \end{array}$$
(1)

where \(y\) is the temperature, \({x}_{1}\) is the latitude, \({x}_{2}\) is the longitude, and \({x}_{3}\) is the month.

The regression model is validated by the ratio of the mean square error in the model, and the expression is

$$R^{2} = 1 - \frac{{\mathop \sum \nolimits_{n}^{1} {}y_{{predict_{i} }} - y_{{true_{i} }} {}^{2} }}{{\mathop \sum \nolimits_{1}^{n} {}y_{{trueMean_{i} }} - y_{{true_{i} }} {}^{2} }},i \in \left( {1,n} \right).$$
(2)

The value of \({R}^{2}\) is found to be 0.82 after substituting the data. Then the correlation coefficient \(R\) is calculated by the following equation,

$$R=\sqrt{{R}^{2}.}$$
(3)

Based on the fact that \(R\) = 0.906 > 0.8, the regression relationship is valid.

In summary, there is a large correlation between global temperature and time, longitude, and latitude, and it is in accordance with the relationship of Eq. (1). However, this model is too complex for calculation and may have a large error in the process of landing the actual. Therefore, we have to further analyze the data and select a more suitable model.

4 Data Source and Methodology

4.1 Data Source and Data-processing

We use the self-collected global average temperature as a data set and preprocess it [11]. We determine the uncertainty of the values by means and variances and perform descriptive statistics on the uncertainty. When uncertainty is greater than 1, the data is anomalous. Then such anomalous data are excluded, and the rest of the data are considered as valid data. Next, the temperature values of the missing months are supplemented by the values calculated from the average of two adjacent months. The complete data between 1860 and 2013 are finally retained. Figure 2 is a line graph of the global average temperature change between 1860 and 2013.

Fig. 2.
figure 2

Global average temperature trend in the last 153 years

As shown in Fig. 2, the temperature trend has always been in an upward trend since 1884, which is relatively stable. So the time period chosen for the data in the model is from January 1884 to September 2013. Observing the global temperature line graph, as shown in Fig. 3, the global temperature fluctuates up and down on a yearly cycle.

Fig. 3.
figure 3

The global average temperature from 1884 to 2013

We resample the data in order to further determine the trend of the average temperature, reduce the amplitude of the vibration of the data and make its linear pattern more obvious. As shown in the Fig. 4, we decompose the time series and calculate the trend term, seasonal term and residual term of the time series.

Fig. 4.
figure 4

Resampled global average temperature and its trend terms, seasonal terms and residual terms

The vertical axes of the four subplots in Fig. 4 represent the resampled global average temperature and its trend term, seasonal term, and residual term. Trend term is the increasing or decreasing value in the time series. Residual term represents the random variation in the time series. It can be determined that its non-stationary time series has a strong annual seasonal component and an increasing trend over time. In the following, ARIMA model and LSTM model are built to analyze the global average temperature data and predict the future global temperature level, respectively.

4.2 ARIMA

ARIMA model is a regression model, which is one of the methods of time series forecasting analysis. Its autoregressive model expression is

$${y}_{t}=\mu +\sum\nolimits_{i=1}^{p}{\gamma }_{i}{y}_{t-i}+\varepsilon ,$$
(4)

where \(\mu\) is a constant, \(p\) is the order difference, \(\varepsilon\) is the error, and \(\gamma\) is the autocorrelation coefficient.

To eliminate the errors in the results obtained from the autoregressive model, the following expressions can be used:

$${y}_{t}=\mu +\sum\nolimits_{i=1}^{q}{\beta }_{i}{\varepsilon }_{t-i}+{\varepsilon }_{t},$$
(5)

where \(\mu\) is a constant, \(q\) as the number of sliding average terms \(\varepsilon\) is the error, and \(\gamma\) is the autocorrelation coefficient.

The autoregressive moving average model requires a combination of the two processes, regression and moving average, with the following expression:

$${y}_{t}=\mu +\sum\nolimits_{i=1}^{p}{\gamma }_{i}{y}_{t-i}+\sum\nolimits_{i=1}^{q}{\beta }_{i}{\varepsilon }_{t-i}+{\varepsilon }_{t}.$$
(6)

To enhance the accuracy of the model, we set the training and validation sets to account for 90% and 10% respectively. Then we calculate the number of autoregressive terms \(p\) and the number of sliding average terms \(q\). Both \(p\) and \(q\) belongs to the model parameters.

4.3 LSTM

LSTM is a special kind of RNNS with additional features to memorize the sequence of data. Through some gates along with a memory line incorporated in a typical LSTM, the memorization of the earlier trend of the data is possible. As shown in Fig. 5, this neural network model can perform regression for long time series [10].

Fig. 5.
figure 5

The structure of LSTM neural network model

$$\stackrel{\sim }{{c}_{t}}=tanh\left({w}_{xc}{x}_{t}+{w}_{ch}{x}_{t-1}+{b}_{c}\right),$$
(7)
$${i}_{t}=\sigma \left({w}_{xi}{x}_{t}+{w}_{hi}{h}_{t-1}+{w}_{ci}{c}_{t-1}+{b}_{c}\right),$$
(8)
$${f}_{t}=\sigma ({w}_{xf}{x}_{t}+{w}_{hf}{h}_{t-1}+{w}_{cf}{c}_{t-1}+{b}_{f}) ,$$
(9)
$${o}_{t}=\sigma ({w}_{xo}{x}_{t}+{w}_{ho}{h}_{t-1}+{w}_{co}{c}_{t}+{b}_{o}),$$
(10)
$${c}_{t}={c}_{t-1}\otimes {f}_{t}+{i}_{t}\otimes \stackrel{\sim }{{c}_{t} },$$
(11)
$${h}_{t}={o}_{t}\otimes tanh{c}_{t}.$$
(12)

In which: \(\stackrel{\sim }{{c}_{t}}\) denotes the updated state of the memory cell now. \({i}_{t}\), \({f}_{t}\), \({o}_{t}\), \({c}_{t}\) and \({h}_{t}\) denote the state of the input gate, the forget gate, the output gate, the memory cell, and the output of the hidden layer at time t, respectively. \({x}_{i}\) Denotes the input at time t. \({H}_{t-1}\) and \({c}_{t-1}\) denote the output of the hidden layer and the memory cell at time \(t-1\), respectively. \({w}_{xc}\) Denote the weight matrices of the memory cell with the input \({x}_{i}\), and \({w}_{ch}\) denote the weight matrices of the memory cell with the hidden layer. \({w}_{xt}\)\({w}_{hi}\) and \({w}_{ci}\) denote the weight matrices of the input gate and \({x}_{t}\), the hidden layer, and the memory cell, respectively. \({w}_{xf}\), \({w}_{hf}\) and \({w}_{cf}\) are the weight matrices of forgetting gate with \({x}_{i}\), output layer, and memory cell, respectively. \({w}_{xo}\), \({w}_{ho}\) and \({w}_{co}\) are the weight matrices of memory cell with \({x}_{i}\), output layer, and memory cell, respectively. \(\otimes\) is the dot product, \(\sigma\) is the Sigmoid activation function, and \({b}_{c}\), \({b}_{i}\), \({b}_{f}\) and \({b}_{fo}\) are for the bias.

5 ARIMA VS LSTM: An Experimental Study of Global Temperature Prediction

5.1 Global Temperature Prediction Based on ARIMA

For the ARIMA \((p,d,q)\) model and the data obtained from the preliminary analysis, we choose the optimal ARIMA \((1, 1, 1)\) model. First, in general, the series can be made smooth by using first-order and second-order differences. First, we choose the difference order d = 1. Then, we adjust the parameters according to the AIC index. The model is most appropriate when the AIC reaches the minimum of negative values. Substituting this temperature data, the ARIMA \((1, 1, 1)\) model is solved to obtain the prediction results of the validation set and compared with the validation set.

Fig. 6.
figure 6

ARIMA forecast result

As shown in Fig. 6, the results are as follows. Since 1884, the global temperature level has always maintained a steady increase. And the prediction results of its validation set basically overlap with the straight line of the validation set. It shows that the global temperature level in the future will also increase with time. The prediction results of the validation set in the Fig. 6 are basically the same as those of the verification set, which shows that the model is good and can make excellent predictions of global temperature.

With the ARIMA model, we can predict the global average temperature for each month. Substituting the data into the model, we get the annual average temperature in future based on the monthly average temperature in future and visualize the results of prediction.

Fig. 7.
figure 7

ARIMA predict result

As shown in Fig. 7, the global average temperature is increasing year by year. The global average temperature will reach 10.53 ℃ in 2050 and 11.42 ℃ in 2100.

5.2 Global Temperature Prediction Based on LSTM

To enhance the accuracy of the LSTM model, we now set the training and validation sets to account for 90% and 10%, respectively. We train the LSTM model, where the number of batches size is 200 and the number of neurons in the LSTM layer is 4. The prediction results of the validation set are obtained by substituting the global average temperature data and compared with the true values of the validation set.

Fig. 8.
figure 8

The real value and prediction result of prediction set

As shown in Fig. 8, the results are as follows. The prediction results of the validation set basically overlap with the trend of the verification set, which shows that the model has a good prediction effect. With the LSTM model, we can predict the global average temperature for each month. Substituting the data into the model, we get the average yearly temperature in the future based on the average monthly temperature in the future and visualize the predicted results.

Fig. 9.
figure 9

LSTM predict result

As shown in Fig. 9, the global average temperature is also increasing. The global average temperature will reach 9.32 ℃ in 2050 and 10.1 ℃ in 2100.

5.3 Comparison of Both Global Temperature Prediction Models

Comparing the two global temperature prediction models, RMSE is used to compare the accuracy of the models. RMSE refers to the estimator of the model, which can be used to measure the deviation between the predicted value and the real value. The expression is as follows,

$$RMSE=\sqrt{\frac{1}{n}\sum\nolimits_{k=1}^{n}[S(k)-\overline{S }(k){]}^{2}}.$$
(13)

The RMSE results of ARIMA model and LSTM model are shown in Table 2.

Table 2. Evaluation and comparison of two models

The smaller the RMSE value of the model, the higher the accuracy. Therefore, the ARIMA model is more accurate in the two prediction models.

This paper speculates that the reason why ARIMA model is better than LSTM may be that the global average temperature data is not very volatile. When the real value fluctuation is not very drastic, the prediction with ARIMA may be more applicable. The neural network LSTM stores data in `memory nerves’, that is, in forgetting gates, input gates, and output gates. The results are not simply averaged, and the predictions may be aggressively biased a bit. The LSTM model may work better when the original data is more volatile.

6 Conclusion

In this paper, we use different methods to study the trend of global average temperature, and use ARIMA model and LSTM model to further analyze the historical data of global average annual temperature. After comparison, the ARIMA model has better prediction effect than the LSTM neural network model. Therefore, the ARIMA model is selected to predict the global average temperature in 2050 and 2100, and the results are very good, which has practical application.

The data selected in this paper all over 100 years. The higher breadth of data not only ensures the rigor of the article, but also eliminates the possibility of inaccurate prediction or classification due to the short time interval. What’s more, two models are used in this paper, which are relatively rarely used for global average prediction at home and abroad. In the future, we can apply the two models to temperature prediction in other regions.

In previous studies, using the LSTM model, the prediction results of LSTM model were better compared to ARIMA model. However, in this paper, the prediction effect of ARIMA model is obviously better. We presume the reasons underlying are as follows. The global average temperature data is not very volatile and the principle of ARIMA is sliding average and autoregressive. Therefore, the prediction results are closer to the historical average. And when the real value fluctuation is not very drastic, the prediction by ARIMA may be more applicable. The conclusion can be extended to general data. Further experiments can be conducted in other data with little fluctuation using this conclusion. Also, the two models can be combined in subsequent studies to analyze and predict the global average temperature. Using the ARIMA model, we have predicted the global average annual temperature in 2050 and 2100, and achieved good results. From the available research results, we believe that with the current level of environmental protection, the global average annual temperature will only increase, which will greatly affect people’s production and life. We must pay attention to the global warming problem, work together to save energy, develop new energy sources, and make more efforts for sustainable human development.