A non stationary process can be split in different part: a trend, a seasonality and residuals that will likely be stationnary.
The trend represent the global evolution of the serie.
The trend can be estimated rr we can get rid of this trend by differentiating the serie.
Suppose the process \(X_t\) is composed of a deterministic trend \(m_t\) and a random process (white noise) \(\varepsilon_t\).
For the parametric estimation we assume that the trend \(m_t\) has a linear form: \(m_t=a+bt\).
We estimate \(\hat{a}\) and \(\hat{b}\) using the least squares:
\[\{\hat{a}, \hat{b}\} = \min_{\{a, b\}} \sum_{t=0}^T(x_t - a - bt)^2\]
The solutions are:
The trend can be estimated using a moving average of a given window size for example \(2h\): \([t-h; t+h]\).
\[\bar{m}_t = \frac{1}{2h+1} \sum_{s=-h}^{h}x_{t+s}\]The seasonality is a repetition of pattern at a given interval.
The seasonality correction factor can be estimated as in the Holt-Winters method with seasonality. Or we can get rid of this seasonnality by differentiating the serie.
We can get rid of trend and seasonality using differentiation. Let define the operator \(\Delta_h\) as:
\[\Delta_h X_t = X_t - X_{t-h}\]Let also define the operator \(\Delta_h^k\) as \(k\) repetition of the operator \(\Delta_h\) on the serie. \(\Delta_h\) is \(\Delta_h^1\).
The operator \(\Delta_h^k\) is used to suppress polynomial trend of order \(k\).
Let \(X_t\) be a process with a trend and a seasonality:
\[X_t = m_t + s_t + \varepsilon_t\]Where:
Then:
\[\Delta_h X_t = X_t - X_{t-h} = (m_t - m_{t-h}) + (\varepsilon_t - \varepsilon_{t-h})\]If \(m_t\) has a linear trend, hence \(m_t - m_{t-h}\) does not depend on \(t\) and hence \(\Delta_h X_t\) is a stationary process.
See: