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.

Chapter 7 — Randomness and Dependence

In earlier chapters, we explored financial returns, smoothing methods, and trading indicators. We now begin developing the core ideas of time series analysis more formally.

A central insight of time series analysis is that observations collected over time are often dependent. What happens today may be related to what happened yesterday, last week, or even many periods ago.

This chapter introduces:

These ideas form the conceptual foundation for later chapters on stationarity, ARIMA models, forecasting, and cointegration.


Learning Objectives

By the end of this chapter, you should be able to:


7.1 What Is a Time Series?

Examples include:

A time series can be written as:

Xt={x1,x2,,xT}X_t = \{x_1, x_2, \dots, x_T\}

where:

For example:


7.2 Stochastic Processes

A time series is usually viewed as a realization of a stochastic process.

We observe only one realization of the process:

x1,x2,,xTx_1, x_2, \dots, x_T

but we imagine that these observations are generated by an underlying probabilistic mechanism.


7.3 Randomness and Dependence

In statistics, we often study random variables independently. In time series analysis, however, the timing of observations matters.

Two key questions arise:

  1. How random is the process?

  2. How dependent are observations over time?

Example: Daily Stock Returns

Daily returns appear highly random:

But even highly random processes may still exhibit:


7.4 White Noise

The simplest stochastic process is white noise.

Thus:

We often write:

wtwn(0,σw2)w_t \sim wn(0,\sigma_w^2)

7.5 Simulating White Noise

import numpy as np
import matplotlib.pyplot as plt

np.random.seed(10101)

wn = np.random.normal(0, 2, 500)

plt.figure(figsize=(10,4))
plt.plot(wn, lw=1)
plt.title("Simulated White Noise")
plt.xlabel("Time")
plt.ylabel("$w_t$")

plt.savefig("figs/ch7/wn.png", dpi=300, bbox_inches="tight")
plt.close()   # replace with plt.show()
White Noise

7.6 Gaussian White Noise

If white noise is normally distributed, we call it Gaussian white noise.

wtN(0,σw2)w_t \sim N(0,\sigma_w^2)

Gaussian white noise is widely used in theoretical models because it is mathematically convenient.


7.7 Covariance and Correlation

To study dependence across time, we first review covariance and correlation.

Variance

Var(X)=E[(XμX)2]Var(X) = E[(X - \mu_X)^2]

Covariance

Cov(X,Y)=E[(XμX)(YμY)]Cov(X,Y) = E[(X-\mu_X)(Y-\mu_Y)]

Correlation

Corr(X,Y)=Cov(X,Y)Var(X)Var(Y)Corr(X,Y) = \frac{Cov(X,Y)} {\sqrt{Var(X)}\sqrt{Var(Y)}}

7.8 Dependence Across Time

In time series analysis, we are interested in relationships such as:

Cov(Xt,Xt1)Cov(X_t, X_{t-1})
Cov(Xt,Xt2)Cov(X_t, X_{t-2})

and more generally:

Cov(Xt,Xth)Cov(X_t, X_{t-h})

where hh is called the lag.


7.9 Persistence

Some time series exhibit strong persistence.

Examples:

In persistent series:


7.10 Random Walks

One of the most important models in time series analysis is the random walk.

Interpretation

Each new observation equals:


7.11 Simulating a Random Walk

np.random.seed(123)

w = np.random.normal(0, 1, 500)
x = np.cumsum(w)

plt.figure(figsize=(10,4))
plt.plot(x, lw=1)
plt.title("Simulated Random Walk")
plt.xlabel("Time")
plt.ylabel("$x_t$")

plt.savefig("figs/ch7/rw.png", dpi=300, bbox_inches="tight")
plt.close()   # replace with plt.show()
Random Walk

7.12 White Noise vs Random Walk

FeatureWhite NoiseRandom Walk
Mean revertingYesNo
PersistentNoYes
Variance constantYesNo
Predictable structureNoneStrong persistence

7.13 Why Random Walks Matter

Random walks play a central role in economics and finance.

Examples include:

Financial Interpretation

If stock prices follow a random walk:

This idea is closely related to the efficient market hypothesis.


7.14 Looking Ahead

In this chapter, we introduced:

These ideas naturally lead to the concept of stationarity, which we study in the next chapter.

Key Takeaways

Concept Check

Basic

  1. What is a stochastic process?

  2. What is white noise?

  3. What is a random walk?


Intuition

  1. Why are observations in a time series typically not independent?

  2. What does it mean for a series to exhibit persistence?

  3. Why is white noise considered unpredictable?


Intermediate

  1. What is serial dependence?

  2. What is a lag in time series analysis?

  3. Why can a random walk look like it has a trend even if it does not?


Finance Insight

  1. Why might stock prices behave like a random walk?

  2. What does this imply about the ability to predict future prices?


Challenge

  1. Suppose a series looks smooth and trending.


Interpretation & Practice

  1. Consider a white noise series.

    • What pattern would you expect to see in a plot?

    • Why is it difficult to forecast?


  1. Consider a random walk.

    • Why does it appear to drift over time?

    • What role do past shocks play?


  1. A series shows strong persistence.

    • What does this imply about the effect of shocks?

    • How might this affect forecasting?


  1. A plot shows large swings but no clear pattern.

    • Is this more likely white noise or a random walk?

    • Why?


  1. A time series appears to trend upward.

    • What are two possible explanations?

    • Why must we be careful in interpreting this?


Behavioral Insight

  1. A trader believes that an upward trend will continue.

    • What assumption are they making about dependence?

    • Why might this be misleading?


Challenge

  1. Suppose you simulate two series:

    • Series A: white noise

    • Series B: random walk

    • Which one is easier to predict?

    • Why?


Numerical Practice

White Noise vs Random Walk

  1. Suppose you observe the following values:

    Series A:
    2, −1, 1, −2, 0, 1

    Series B:
    2, 1, 2, 0, 0, 1

    • Which series looks more like white noise?

    • Which looks more persistent?


Step-by-Step Random Walk

  1. Suppose a random walk is defined as:

[ x_t = x_{t-1} + w_t ]

with:



  1. What do you notice about how shocks affect the series?


Variance Intuition

  1. Consider two processes:



Persistence

  1. Suppose a shock of +5 occurs in:



Challenge

  1. Suppose you observe a series that behaves like a random walk.