Time Series
Overview
Time series analysis studies observations indexed in time order and models how current values depend on past behavior, seasonality, shocks, and noise. It is a core method in forecasting, monitoring, and signal interpretation across finance, operations, IoT, and scientific measurement. The foundational ideas are summarized in the Time series literature and then specialized for stationarity testing, decomposition, smoothing, and model-based prediction.
The unifying concepts are serial dependence, stationarity, trend/seasonality decomposition, and stochastic forecasting models. Autocorrelation diagnostics quantify dependence across lags, while stationarity tests assess whether distributional properties remain stable over time. Decomposition methods separate signals into components such as trend T_t, seasonal effects S_t, and residuals R_t, often expressed as y_t = T_t + S_t + R_t. Forecasting frameworks then model dynamics directly, including ARIMA-family equations such as \phi(L)(1-L)^d y_t = \theta(L)\varepsilon_t.
Implementation in this category is primarily backed by statsmodels for econometric and forecasting routines, with complementary signal-processing utilities from SciPy and numerical primitives from NumPy. This combination provides statistically grounded inference and efficient vectorized computation.
For dependence diagnostics and unit-root testing, ACF, ACOVF, PACF, CCF, and CCOVF measure auto/cross-structure across lags and help identify candidate model orders. Q_STAT adds Ljung-Box significance checks for residual whiteness. Formal stationarity decisions are supported by ADFULLER, KPSS, RURTEST, and ZIVOT_ANDREWS, including break-aware testing for structural shifts.
For signal preparation and seasonal structure analysis, DETREND removes linear or constant drift prior to downstream modeling, while SEASDECOMP, STL, and MSTL separate observed series into trend, seasonal, and remainder components under single- or multi-seasonal assumptions. In frequency-domain workflows, PERIODOGRAM and WELCH estimate spectral density to reveal dominant cycles and periodic drivers.
For model-driven prediction, ARMA_ORDER_IC and HANNAN_RISSANEN support ARMA order/parameter estimation, and INNOVATIONS_MLE provides likelihood-based SARIMA parameter fitting. Forecast generation is handled by ARIMA_FORECAST and SARIMAX_FORECAST for autoregressive integrated models with optional seasonal and exogenous structure. Smoother level/trend-seasonality forecasting is available through SES_FORECAST, HOLT_FORECAST, and HW_FORECAST.
For rolling smoothing and feature engineering, EMA_LFILTER and EMA_PERIOD compute exponential moving averages with direct- or period-based smoothing control, while SMA_CONV and SMA_CUMSUM provide two efficient implementations of simple moving averages. Weighted variants WINMA_CONV and WMA emphasize recent or user-prioritized observations and are common in trading signals, KPI trend dashboards, and preprocessing.
Autocorrelation And Stationarity Tests
| Tool | Description |
|---|---|
| ACF | Compute autocorrelation values across lags with optional confidence intervals and Ljung-Box statistics. |
| ACOVF | Estimate autocovariance values of a time series across lags. |
| ADFULLER | Run the Augmented Dickey-Fuller unit-root test for stationarity diagnostics. |
| CCF | Compute cross-correlation between two time series across nonnegative lags. |
| CCOVF | Estimate cross-covariance values between two time series across lags. |
| KPSS | Run the KPSS stationarity test under level or trend null hypotheses. |
| PACF | Compute partial autocorrelation values across lags for lag-order diagnostics. |
| Q_STAT | Compute Ljung-Box Q statistics and p-values from autocorrelation coefficients. |
| RURTEST | Run the range unit-root test as an alternative stationarity diagnostic. |
| ZIVOT_ANDREWS | Run the Zivot-Andrews unit-root test allowing one endogenous structural break. |
Decomposition And Seasonality
| Tool | Description |
|---|---|
| DETREND | Remove linear or constant trend from input data. |
| MSTL | Perform multi-seasonal STL decomposition on a time series. |
| PERIODOGRAM | Estimate the power spectral density of a time series using a periodogram. |
| SEASDECOMP | Decompose a time series into trend, seasonal, and residual components. |
| STL | Perform STL decomposition of a univariate time series. |
| WELCH | Estimate the power spectral density of a time series using Welch’s method. |
Forecasting Models
| Tool | Description |
|---|---|
| ARIMA_FORECAST | Fit an ARIMA model and return out-of-sample forecasts. |
| ARMA_ORDER_IC | Select ARMA order using an information criterion. |
| HANNAN_RISSANEN | Estimate ARMA parameters using the Hannan-Rissanen procedure. |
| HOLT_FORECAST | Fit Holt trend exponential smoothing and return forecasts. |
| HW_FORECAST | Fit Holt-Winters exponential smoothing and return forecasts. |
| INNOVATIONS_MLE | Estimate SARIMA parameters using innovations maximum likelihood. |
| SARIMAX_FORECAST | Fit a SARIMAX model and return out-of-sample forecasts. |
| SES_FORECAST | Fit simple exponential smoothing and return forecasts. |
Moving Averages
| Tool | Description |
|---|---|
| EMA_LFILTER | Compute an exponential moving average using recursive linear filtering. |
| EMA_PERIOD | Compute an exponential moving average using a period-derived smoothing constant. |
| SMA_CONV | Compute a simple moving average using discrete convolution with a uniform window. |
| SMA_CUMSUM | Compute a simple moving average using cumulative-sum differencing. |
| WINMA_CONV | Compute a weighted moving average by convolving data with a user-defined weight window. |
| WMA | Compute a rolling weighted moving average using user-supplied weights. |