# Addressing the Non-Stationarity and Complexity of Time Series Data for Long-Term Forecasts
## 2 Methodology
### Weak-Stationarizing Block and Non-Stationarity Restoring Block  
Spectral analysis requires the input time series to be weakly stationary [16]. meaning that the joint moments of the first- and second-order across equal-length segments are consistent. While achieving perfect stationarity is difficult, our objective is to reduce the non-stationary properties of the time series.  
ARIMA models use differencing to obtain the weak-stationary signals [7]. Building on this concept, the \"weak-stationarizing\" block is designed to yield a weak-stationary signal with a single differencing step. This involves aligning two copies of the input, where each data point in the copies lies in similar phase positions but varies by a single period of the dominant frequency component in the time series. One copy remains unchanged, while the other is rolled back by a value we term as the \"optimum roll back value\" (ORV), representing a single period of the dominant frequency.  
The ORV is determined using the PSD of the time series [56]. The PSD is calculated by multiplying the FFT of the input with its complex conjugate, with the dominant frequency components having the highest PSD values. Since there are multiple dependent time series, the ORV is chosen as the most frequent position with the highest PSD values across the different dependent time series. Then, one copy of the input signal is rolled back by the ORV and subtracted from the original input signal. However, since the ORV may not be optimum for all the dependent time series, two additional learnable parameters are used as weights and biases to adjust the effect of the differencing for each input series. The learnable weights and biases are single dimensional arrays of length \(N\), where, as in previous sections, this represents the number of dependent time series. The output of the \"weak-stationarizing\" block is a weak-stationary output (WSO).  
The PSD can be obtained as  
\[PSD=FFT([X]^{1:N})*Conj(FFT([X]^{1:N})) \tag{2}\]  
where _Conj()_ gives the complex conjugate value of the input. Using _PSD_, the _ORV_ is then obtained as  
\[ORV=Mode(Position(Max(PSD))) \tag{3}\]  
Finally, the _WSO_ is given by  
\[WSO=\omega^{1:N}*([X]^{1:N}-RollBack([X]^{1:N},ORV))+\beta^{1:N} \tag{4}\]  
where \(\omega^{1:N}\) = [\(\omega^{1}\), \(\omega^{2}\), \(\omega^{3}\),..., \(\omega^{N}\)] and \(\beta^{1:N}\) = [\(\beta^{1}\), \(\beta^{2}\), \(\beta^{3}\),..., \(\beta^{N}\)] are the weights and biases for 'N' dependent time series.  
Transforming the time series using the \"weak-stationarizing\" block causes the loss of important statistical information. To compensate for this loss of information the \"non-stationarity restoring\" block is introduced before the projection layer to restore the necessary details. The output of this block is a non-stationary output (NSO), where the rolled back portion is denoted as non-stationary information representation (NSIR), i.e., NSIR = \(RollBack([X]^{1:N},ORV)\), for simplicity. This output then goes through the ConvMixer layers. If \(F\) represents the output of the ConvMixer architecture (discussed in Section 2.4), then, the process in the \"non-stationarity restoring\" block can be represented as  
\[NSO=\frac{F(WSO)-\beta^{1:N}}{\omega^{1:N}}+NSIR \tag{5}\]  
The detailed architectures of the \"weak-stationarizing\" block and the \"non-stationarity restoring\" block can be seen in the lower half of Figure 1.