Part IV: Advanced Topics | Chapter 1

Time Series Analysis

Modeling temporal dependence, spectral decomposition, and state space methods

Historical Context

Time series analysis has roots stretching back to the 18th century, when astronomers sought to extract periodic signals from noisy observations. Fourier's 1807 work on heat conduction introduced harmonic decomposition, which Schuster later applied to meteorological data through the periodogram in 1898. The autoregressive model was formalized by Yule in 1927 to study sunspot cycles, and Walker extended it to moving averages for monsoon prediction.

The modern era began with Box and Jenkins, whose 1970 monograph systematized the ARIMA methodology into an iterative identification-estimation-diagnostic framework that remains a cornerstone of applied time series analysis. Simultaneously, Kalman's 1960 recursive filtering algorithm revolutionized engineering and econometrics by providing optimal state estimation in linear dynamical systems. Spectral methods matured through the work of Wiener, Kolmogorov, and Blackman-Tukey, connecting the time and frequency domains via the spectral representation theorem.

1.1 Stationarity and Autocorrelation

A time series $\{X_t\}_{t \in \mathbb{Z}}$ is a collection of random variables indexed by time. The fundamental concept enabling tractable analysis is stationarity, which asserts that the statistical properties of the process do not change over time.

Definition: Strict Stationarity

A process $\{X_t\}$ is strictly stationary if for all$k, t_1, \ldots, t_k$ and $h$, the joint distribution of$(X_{t_1+h}, \ldots, X_{t_k+h})$ equals that of $(X_{t_1}, \ldots, X_{t_k})$.

Definition: Weak (Second-Order) Stationarity

A process is weakly stationary (or covariance stationary) if:

(i) $\mathbb{E}[X_t] = \mu$ is constant, (ii) $\text{Var}(X_t) < \infty$, (iii) $\text{Cov}(X_t, X_{t+h}) = \gamma(h)$ depends only on the lag $h$.

The autocovariance function (ACVF) is $\gamma(h) = \text{Cov}(X_t, X_{t+h})$, and the autocorrelation function (ACF) is:

$$\rho(h) = \frac{\gamma(h)}{\gamma(0)} = \frac{\text{Cov}(X_t, X_{t+h})}{\text{Var}(X_t)}$$

The partial autocorrelation function (PACF) at lag $h$ measures the correlation between $X_t$ and $X_{t+h}$ after removing the linear effect of $X_{t+1}, \ldots, X_{t+h-1}$. Formally, the PACF$\phi_{hh}$ is the last coefficient in the best linear predictor of$X_{t+h}$ from $X_t, \ldots, X_{t+h-1}$. The ACF and PACF together serve as the primary diagnostic tools for model identification: an AR($p$) process has PACF that cuts off after lag $p$, while an MA($q$) process has ACF that cuts off after lag $q$.

Key Property: Positive Semi-Definiteness

A function $\gamma: \mathbb{Z} \to \mathbb{R}$ is a valid autocovariance function if and only if it is even ($\gamma(h) = \gamma(-h)$) and positive semi-definite:$\sum_{i=1}^n \sum_{j=1}^n a_i a_j \gamma(t_i - t_j) \geq 0$ for all$n, a_1, \ldots, a_n \in \mathbb{R}$ and $t_1, \ldots, t_n \in \mathbb{Z}$.

1.2 Autoregressive, Moving Average, and ARMA Models

The building blocks of linear time series models are the autoregressive (AR) and moving average (MA) components.

Definition: AR(p) Process

An autoregressive process of order $p$ satisfies:

$$X_t = \phi_1 X_{t-1} + \phi_2 X_{t-2} + \cdots + \phi_p X_{t-p} + \varepsilon_t$$

where $\varepsilon_t \sim \text{WN}(0, \sigma^2)$ is white noise. Using the backshift operator $B$, this is $\phi(B) X_t = \varepsilon_t$ where$\phi(z) = 1 - \phi_1 z - \cdots - \phi_p z^p$. The process is causal (stationary) if all roots of $\phi(z) = 0$ lie outside the unit circle.

Definition: MA(q) Process

A moving average process of order $q$ is:

$$X_t = \varepsilon_t + \theta_1 \varepsilon_{t-1} + \cdots + \theta_q \varepsilon_{t-q} = \theta(B)\varepsilon_t$$

The MA($q$) process is always stationary. It is invertible if all roots of $\theta(z) = 0$ lie outside the unit circle, enabling a unique AR($\infty$) representation.

Definition: ARMA(p, q) Process

The general linear model combines both components:

$$\phi(B) X_t = \theta(B) \varepsilon_t$$

The ARMA($p,q$) is causal if $\phi(z) \neq 0$ for $|z| \leq 1$and invertible if $\theta(z) \neq 0$ for $|z| \leq 1$.

The Yule-Walker equations provide a direct link between the AR parameters and the autocovariance function. For an AR($p$) process:

$$\begin{pmatrix} \gamma(0) & \gamma(1) & \cdots & \gamma(p-1) \\ \gamma(1) & \gamma(0) & \cdots & \gamma(p-2) \\ \vdots & \vdots & \ddots & \vdots \\ \gamma(p-1) & \gamma(p-2) & \cdots & \gamma(0) \end{pmatrix} \begin{pmatrix} \phi_1 \\ \phi_2 \\ \vdots \\ \phi_p \end{pmatrix} = \begin{pmatrix} \gamma(1) \\ \gamma(2) \\ \vdots \\ \gamma(p) \end{pmatrix}$$

These equations can be solved efficiently via the Levinson-Durbin recursion in$O(p^2)$ operations, which simultaneously computes the PACF at all lags up to $p$.

1.3 ARIMA and Seasonal Models (Box-Jenkins)

Many real-world time series exhibit trends and non-stationarity. The ARIMA framework handles this by differencing. An ARIMA($p, d, q$) model applies$d$ differences before fitting an ARMA($p, q$):

$$\phi(B)(1 - B)^d X_t = \theta(B)\varepsilon_t$$

The Box-Jenkins methodology proceeds in three iterative stages:

1. Identification: Examine ACF/PACF of the (differenced) series to determine tentative orders $p$ and $q$. Unit root tests (ADF, KPSS) determine $d$.

2. Estimation: Estimate parameters via maximum likelihood or conditional least squares. The exact likelihood for Gaussian ARMA is computed via the innovations algorithm or Kalman filter.

3. Diagnostics: Check residuals for white noise using the Ljung-Box test: $Q = n(n+2) \sum_{k=1}^{m} \hat{\rho}_k^2 / (n-k)$, which is asymptotically $\chi^2(m - p - q)$.

For data with seasonal patterns of period $s$, the seasonal ARIMA (SARIMA) model is written as ARIMA$(p,d,q) \times (P,D,Q)_s$:

$$\phi(B)\Phi(B^s)(1-B)^d(1-B^s)^D X_t = \theta(B)\Theta(B^s)\varepsilon_t$$

Here $\Phi$ and $\Theta$ are the seasonal AR and MA polynomials. The seasonal differencing operator $(1 - B^s)^D$ removes seasonal non-stationarity. Information criteria (AIC, BIC) are commonly used for model selection among candidate orders.

1.4 Spectral Analysis

The frequency domain provides a complementary view of time series. The fundamental result is Herglotz's theorem: a function $\gamma(h)$ is a valid autocovariance function if and only if it can be represented as:

$$\gamma(h) = \int_{-\pi}^{\pi} e^{i\omega h} \, dF(\omega)$$

where $F$ is a bounded, non-decreasing function called the spectral distribution function. If $F$ is absolutely continuous, its density$f(\omega) = dF/d\omega$ is the power spectral density (PSD):

$$f(\omega) = \frac{1}{2\pi} \sum_{h=-\infty}^{\infty} \gamma(h) e^{-i\omega h}, \qquad \omega \in [-\pi, \pi]$$

The Periodogram

The sample analogue of the PSD is the periodogram:

$$I(\omega_j) = \frac{1}{n}\left|\sum_{t=1}^{n} X_t e^{-i\omega_j t}\right|^2$$

evaluated at Fourier frequencies $\omega_j = 2\pi j / n$. The periodogram is an asymptotically unbiased but inconsistent estimator of $f(\omega)$. Smoothing via Welch's method or multitaper estimates yields consistent spectral estimates.

For an ARMA($p,q$) process, the spectral density takes the rational form:

$$f(\omega) = \frac{\sigma^2}{2\pi} \cdot \frac{|\theta(e^{-i\omega})|^2}{|\phi(e^{-i\omega})|^2}$$

Peaks in the spectral density correspond to dominant periodicities in the data. The spectral density of white noise is flat at $\sigma^2 / (2\pi)$, reflecting equal power at all frequencies.

1.5 State Space Models and the Kalman Filter

State space models provide a unifying framework that encompasses ARMA models, structural time series models, and dynamic factor models. The linear Gaussian state space model is:

State Space Representation

$$\alpha_{t+1} = T_t \alpha_t + R_t \eta_t, \qquad \eta_t \sim N(0, Q_t) \quad \text{(state equation)}$$
$$y_t = Z_t \alpha_t + \varepsilon_t, \qquad \varepsilon_t \sim N(0, H_t) \quad \text{(observation equation)}$$

Here $\alpha_t$ is the unobserved state vector, $y_t$ is the observation, and $T_t, R_t, Z_t$ are system matrices.

The Kalman filter recursively computes the optimal (minimum mean squared error) estimate of the state given observations up to time $t$:

Kalman Filter Recursion

Prediction step:

$$\hat{\alpha}_{t|t-1} = T_t \hat{\alpha}_{t-1|t-1}, \qquad P_{t|t-1} = T_t P_{t-1|t-1} T_t' + R_t Q_t R_t'$$

Update step:

$$v_t = y_t - Z_t \hat{\alpha}_{t|t-1}, \qquad F_t = Z_t P_{t|t-1} Z_t' + H_t$$
$$K_t = P_{t|t-1} Z_t' F_t^{-1} \qquad \text{(Kalman gain)}$$
$$\hat{\alpha}_{t|t} = \hat{\alpha}_{t|t-1} + K_t v_t, \qquad P_{t|t} = (I - K_t Z_t) P_{t|t-1}$$

The Kalman filter also provides the prediction error decomposition of the log-likelihood: $\log L = -\frac{n}{2}\log(2\pi) - \frac{1}{2}\sum_{t=1}^n \left(\log|F_t| + v_t' F_t^{-1} v_t\right)$, enabling maximum likelihood estimation of unknown system parameters. The Kalman smoother extends the filter to compute$\hat{\alpha}_{t|n}$ using all observations, via a backward recursion.

1.6 Computational Lab

We simulate AR and MA processes, compute ACF/PACF, estimate the power spectral density, and implement a Kalman filter for local level tracking.

Time Series: AR/MA Simulation, Spectral Analysis, and Kalman Filter

Python
script.py154 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server

1.7 Summary and Key Takeaways

Stationarity

Weak stationarity (constant mean, lag-dependent autocovariance) is the foundational assumption enabling consistent estimation of ACF and PACF, the primary model identification tools.

ARMA Models

AR($p$) models have PACF cutoff at lag $p$; MA($q$) models have ACF cutoff at lag $q$. ARMA combines both for parsimonious modeling of complex autocorrelation structures.

Box-Jenkins Methodology

The iterative identify-estimate-diagnose cycle, extended to SARIMA for seasonal data, remains the standard approach for applied time series modeling.

Spectral Analysis

The power spectral density decomposes variance by frequency. The periodogram is asymptotically unbiased but requires smoothing for consistency.

Kalman Filter

The Kalman filter is the optimal recursive estimator for linear Gaussian state space models, providing both filtered estimates and the prediction error decomposition of the likelihood.

Rate this chapter: