Time Series Decomposition¶
Advantages | Disadvantages | ||
---|---|---|---|
Classical | Easy to understand & interpret | 1. Estimate of trend is unavailable in the first few and last few observations 2. Assumes that seasonal component repeats 3. Not robust to outliers due to usage of means | |
X-11 | 1. Relatively robust to outliers 2. Completely automated choices for trend and seasonal changes 3. Tried & tested method | 1. No prediction/confidence intervals 2. Ad hoc method with no underlying model 3. Only for quarterly & monthly data | |
X-12-ARIMA/ X-13-ARIMA | 1. Allow adjustments for trading days and explanatory variables 2. Known outliers can be omitted 3. Level shifts & ramp effects can be modelled 4. Missing values estimated and replaced 5. Holiday factors can be estimated | ||
X-13-ARIMA-SEATS | 1. Model-based 2. Smooth trend estimate 3. Allows estimates at end-points 4. Incorporates changing seasonality | ||
STL Seasonal & Trend Decomposition using Loess | - Iterative alogirthm - Starts with \(\hat T = 0\) - Uses mixture of loess and moving averages to successively refine trend & seasonal estimates - Trend window controls loess bandwidth applied to de-seasonalized values - Season window controls loess bandwidth applied to detrended subseries - Seasonal component allowed to change over time; Rate of change controlled by analyst - Smoothness of trend controlled by analyst | - Versatile - Robust - Handle any type of seasonality | - Only additive (Use log/Box-Cox transformations for other) - No training day/calendar adjustments |
Classical Decomposition¶
\(y_t\) | Appropriate when Magnitude of seasonal fluctuations proportional to level of series | |
---|---|---|
Addititive | \(S_t + T_t + R_t\) | ❌ |
Multiplicative | \(S_t \times T_t \times R_t\) | âś… |
Alternatively, use Box-Cox transformation, and then use additive decomposition. Logs turn multiplicative relationship into additive
Trend Estimation¶
Centered moving averages, to combat odd order
Order (\(m\)) | Curve | Data Retention |
---|---|---|
Larger | Smoother, flatter | Less (end points are lost) |
Smaller | Noisy | More |
Moving average of the same length of a season/cycle removes its pattern
Seasonal Adjusted Data¶
Component excluding the seasonal component
Detrended Series¶
Seasonal component¶
Average of de-trended series for that season. For eg, average of all values in Januaries
You can constraint the seasonal components such that
Remainder Component¶
Fourier Transforms¶
FT’s limitation: FT is completely blind to time, in accordance with Heisenberg’s Uncertainty principle. There’s a tradeoff between correctly estimating the value of function in the frequency & time domain.
It is 1D representation
Types of Fourier Transforms¶
Type | ||
---|---|---|
Continuous Time & Frequency | Functional form of time series is known analytically | \(\hat x(f) = \int \limits_{-\infty}^\infty x(t) e^{-2\pi i f t} dt\) |
Continuous Time, Discrete Frequency (Fourier Series) | \(\hat x(f_n) = \dfrac{1}{T} \int \limits_{0}^T x(t) e^{-2\pi i f_n t} dt; f_n = \dfrac{n}{T}\) | |
Discrete Time & Frequency (Fourier Frequencies) | \(\hat x(f_n) = \sum \limits_{k=0}^{N-1} x_t e^{- 2 \pi i f_n (k \Delta t)} \Delta t; f_n = \dfrac{n}{N \Delta t}; \hat x_n = \hat x^*_{-n}\) | |
FFT (Fast Fourier Transform) |
Denoising using FFT¶
- Apply FFT
- Filter it to only the frequencies with the highest amplitude
- Take inverse FFT
Wavelet Transform¶
Overcomes FT’s limitation: FT is completely blind to time, by obtaining an optimal balance between accuracy in frequency & time domain
Wavelet¶
Short-lived oscillation, localized in time
- Zero mean: \(E[\phi(t)]=0; \int \phi(t) \cdot dt = 0\) (Admissibility condition)
- Finite energy: \(\int [\phi(t)]^2 \cdot dt = k, k < \infty\)
Type | \(\phi(t)\) |
---|---|
Daubechies | |
Coiflet | |
Symlet | |
Haar | |
Morlet | \(k_0 \cdot e^{i w_0 t} \cdot e^{-t^2/2}\) |
Gaussian | |
Shannon | |
Meyer | |
Mexican Hat |
IDK¶
2D representation: \(y(t) \to T(t, f)\) represents the contribution of frequency \(f\) at time \(t\)
Scaled Wavelet \(\phi(t, a, b) = \phi \left(\dfrac{t-b}{a} \right)\)
The value of \(T(a, b) =\) contribution of \(\phi(t, a, b)\) to comprising the signal $$ T(a, b) = \int y(t) \cdot \phi(t, a, b) \cdot dt $$ Demonstrates the goodness of fit: local similarity
Signals¶
Time Resolution | Frequency Resolution | ||
---|---|---|---|
Raw Time Series | High | \(\approx 0\) | |
Fourier Transform | \(\approx 0\) | High | |
Wavelet Transform | Low for small frequencies High for high frequencies This is intuitive, as high freq signals are usually short-lived, and small freq signals are usually long-lived |