Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lecture 4 Notes - Characteristics of Time Series

Today

Covariance of linear combinations of random variables

If we have random variables U=j=1majXjU=\displaystyle\sum_{j=1}^m a_j X_j and V=k=1rbkYkV=\displaystyle\sum_{k=1}^r b_k Y_k that are linear combinations of (finite variance) random variables Xj{X_j} and Yk{Y_k}, then the covariance of these is:

cov(U,V)=j=1mk=1rajbkcov(Xj,Yk)\operatorname{cov}(U,V) = \displaystyle\sum_{j=1}^m \displaystyle\sum_{k=1}^r a_j b_k \operatorname{cov}(X_j, Y_k)

Autocovariance of a random walk

Recall that a random walk (with or without drift) is:

xt=δt+i=1twix_t = \delta t + \displaystyle\sum_{i=1}^t w_i

The wtw_t are uncorrelated random variables.

γ(s,t)=cov(xs,xt)=cov(δs+i=1swi,δt+i=1twi)=σ2min(s,t)\begin{aligned} \gamma(s,t) &= \operatorname{cov}(x_s, x_t) \\ &= \operatorname{cov}(\delta s + \displaystyle\sum_{i=1}^s w_i, \delta t + \displaystyle\sum_{i=1}^t w_i)\\ &= \sigma^2 \min(s,t) \end{aligned}

In this case, the autocovariance does depend on the particular ss and tt chosen.

What if we want a bounded measure?

Autocorrelation function

We can calculate the autocorrelation function (ACF) as:

ρ(s,t)=γ(s,t)γ(s,s)γ(t,t)\rho(s,t) = \frac{\gamma(s,t)}{\sqrt{\gamma(s,s)\gamma(t,t)}}

This measures the linear predictability of the time series at time tt (xtx_t) using xsx_s. The Cauchy-Schwarz inequality states that:

cov(x,y)Var(x)Var(y)\operatorname{cov}(x,y) \leq \sqrt{\operatorname{Var}(x)\operatorname{Var}(y)}

We can also extend this to looking at the linear predictability of one time series to another, by extending into the concepts of cross-covariance and cross-correlation.

Cross-covariance

Between two time series xtx_t and yty_t:

γxy(s,t)=cov(xs,yt)=E[(xsμxs)(ytμyt)]\gamma_xy(s,t) = \operatorname{cov}(x_s,y_t) = \mathbb{E}[(x_s-\mu_{xs})(y_t-\mu_{yt})]

This tells us how the values in yy relate to the values in xx over time.

Let’s think about a simple example:

yt=xt2y_t = x_{t-2}

What is γxy(k)\gamma_{xy}(k) (for lag kk)? At what lag is γxy\gamma_{xy} maximized?

We can also have the normalized version:

Cross-correlation

ρxy(s,t)=γxy(s,t)γx(s,s)γy(t,t)\rho_{xy}(s,t) = \frac{\gamma_xy(s,t)}{\sqrt{\gamma_x(s,s)\gamma_y(t,t)}}

This is bounded such that 1ρ(s,t)1-1 \leq \rho(s,t) \leq 1

Stationarity

Recall that for a moving average, the autocovariance γv(s,t)\gamma_v(s,t) depends only on the time separation between ss and tt (also called the lag). This is important because this implies the concept of stationarity.

A strictly stationary time series is one where every collection of values has identical probabilistic behavior to the time-shifted set:

{xt,xt2,,xtk}=d{xt1+h,xt2+h,,xtk+h}\{x_t, x_{t_2}, \dots, x_{t_k}\} \overset{d}{=} \{x_{t_1+h}, x_{t_2+h}, \dots, x_{t_k+h}\}

(that is, same mean, variance, higher-order moments for all tt). Examples: iid process

This is not true for most applications and is too strict of a definition. So instead, we will introduce the concept of weak stationarity. In your book this is just called “stationary” as short hand.

Weakly stationary

A weakly stationary time series xtx_t is a finite variance process where:

This is convenient because we can then estimate things about time series where we don’t have multiple repeated observations (and thus we can’t actually estimate the variability for a given time sample directly). In a stationary time series, the mean function is independent of time, so we have:

μt=μ\mu_t = \mu

We can also simplify the autocovariance function so that it is only dependent on the time shift / lag. For example, if s=t+hs=t+h, hh is the lag between ss and tt. We then have:

γ(t+h,t)=cov(xt+h,xt)=cov(xh,x0)=γ(h,0)=γ(h)\gamma(t+h, t) = \operatorname{cov}(x_{t+h}, x_t)=\operatorname{cov}(x_h,x_0) = \gamma(h,0) = \gamma(h)

The autocovariance of a (weakly) stationary time series is thus:

γ(h)=cov(xt+h,xt)=E[(xt+hμ)(xtμ)]\gamma(h) = \operatorname{cov}(x_{t+h}, x_t) = \mathbb{E}[(x_{t+h}-\mu)(x_t-\mu)]

Estimating covariance of a single time series

Much of the time we don’t have multiple samples of our time series, so we can’t estimate μt\mu_t separately for each tt. If we assume stationarity, μt=μ\mu_t = \mu, so we can use the sample mean instead of μt\mu_t:

γ^(h)=1nt=1nh(xt+hxˉ)(xtxˉ)\hat{\gamma}(h) = \frac{1}{n}\displaystyle\sum_{t=1}^{n-h}(x_{t+h}-\bar{x})(x_t-\bar{x}),

where xˉ=1nt=1nxt\bar{x} = \frac{1}{n}\sum_{t=1}^n x_t is the sample mean. Also, γ^(h)=γ^(h)\hat{\gamma}(-h) = \hat{\gamma}(h) for h=0,1,,n1h=0,1,\dots,n-1.

This is nice because we can always calculate the sample autocovariance. However, whether it is interpretable or meaningful will depend on whether the stationarity assumption is approximately true.

Estimating relationships between two time series

We can use cross-correlation to estimate relationships between two series xtx_t and yty_t. For signals that are jointly weakly stationary:

ρ^xy(h)=γxy^(h)γx^(0)γy^(0)\hat{\rho}_{xy}(h) = \frac{\hat{\gamma_{xy}}(h)}{\sqrt{\hat{\gamma_x}(0)\hat{\gamma_y}(0)}}

Here is an example of the autocorrelation functions for the Southern Oscillation Index, fish recruitment, and their relationship (cross-correlation function):

SOI and fish recruitmentSample ACFs and CCFs of Southern Oscillation Index and fish recruitment

Next time: