## 2 Time Series Forecasting for Energy Reduction
### Forecasting Methods
#### 2.3.1 Statistical Methods  
1. Naive and sNaive: This is the most basic forecasting method. The method assumes the next value will be the same as the last one. sNaive, defined in Equation (1), is similar to the Naive method but considering the observation from one period before. Both Naive and sNaive do not provide a model, only an instantaneous forecast point. \[y_{t}=y_{t-period}\] (1) where \(y_{t}\) is the actual observation, and \(y_{t-period}\) is a point of a time period before.
2. Moving Average: This method, defined by Equation (2), takes the average of the time series over a fixed period \(n\), called an _average window_. \(X_{t}\) is the actual observation and \(\hat{y}_{t}\) the prediction. The method reduces the noise but does not anticipate trend or seasonality. \[\hat{y}_{t}=\frac{X_{t}+X_{t-1}+\cdots+X_{t-n+1}}{n}=\frac{1}{n}\sum_{i=t-n+1} ^{t}X_{i}\] (2)
3. Exponential Smoothing (ETS): This method assigns weights to the observations. The weights decay exponentially as we move back in time. It is defined by: \[\hat{y}_{t}=\alpha\cdot y_{t}+(1-\alpha)\cdot\hat{y}_{t-1}\] (3) The model is a weighted average between the most recent observation \(y_{t}\) and the most recent forecast \(\hat{y}_{t-1}\). \(\alpha\) is a smoothing factor, which defines how fast the model forgets the last available observation. The lower the \(\alpha\), the smoother the result, and in the case of \(\alpha=1\), the result is the current observation. There is no formally correct procedure for choosing \(\alpha\), but it can be optimized.  
Figure 2: Time Series Decomposition in Trend, Seasonality, and Residuals.  
Double Exponential Smoothing (DETS): ETS does not perform well when the time series presents a trend. This method is a solution for such cases. It consists of dividing the time series into intercept \(l\) and trend \(b\) and applying the same exponential smoothing to the trend. The time series is divided into two functions: the first one describes the intercept that depends on the current observation, and the second function describes the trend, which depends on the intercept's latest change and the previous values of the trend. The method is defined by the following equations:  
\[l_{x}=\alpha y_{x}+(1-\alpha)(l_{x-1}+b_{x-1}) \tag{4}\]  
\[b_{x}=\beta(l_{x}-l_{x-1})+(1-\beta)(b_{x-1}) \tag{5}\]  
\[\hat{y}_{x+1}=l_{x}+b_{x} \tag{6}\]
5. Seasonal Autoregressive Integrated Moving Average (SARIMA): The SARIMA model is a combination of the Integrated ARMA model (ARIMA) and a seasonal component. It is very similar to the ARIMA model but is preferable when the time series exhibits seasonality. The (AR) stands for Autoregressive, a regression of the time series onto itself. The (MA) stands for Moving Average [12]. The (I) is the order of integration, which represents the number of nonseasonal differences needed to transform the sequence to stationary. Finally, the letter (S) completes the SARIMA model, and it represents the seasonality present in the sequence, providing the model with the capacity to model seasonal components. Although this method can provide an accurate forecast, the selection and identification of the best model parameters can be very time-consuming and require many iterations.  
Figure 3 presents an example of the statistical methods explained before in a seasonal time series. The one with smaller error is the SARIMA model, but this is only achievable after many iterations searching for the best parameters. ETS and DETs are good at recognizing sinusoidal patterns; therefore, they can approximate the real values. In the case of DETS, a better tuning of its \(\alpha\) and \(\beta\) are needed.