The Architects of Uncertainty: White Noise, Random Walks, and Moving Averages

No of Post Views:

108 hits

Financial Econometrics: Part 13

Prerequisites: Basics of Stationarity and ACF/PACF

Introduction: From Description to Simulation

In our last article, we established the “rules of the road” for Time Series Analysis. We learned that raw stock prices are often non-stationary (they wander unpredictably) and that we must transform them; usually via Log Returns to create a stationary series that behaves consistently over time.

But once we have a stationary series, what do we do with it?

We need to build a mathematical model that mimics the data’s behavior. If we can write down an equation that generates data looking exactly like our stock returns, we have “solved” the series. We can then use that equation to forecast future risks and opportunities.

In this article, we will construct the three foundational pillars of time series modeling:

  • White Noise: The sound of pure randomness.
  • The Random Walk: The “drunkard’s walk” that defines most financial markets.
  • The Moving Average (MA) Model: The first model that gives “structure” to the noise.

Part 1: The Sound of Silence (White Noise)

Before we can model patterns, we must define what it looks like when there are no patterns. In Time Series Analysis, this perfect state of randomness is called White Noise.

White Noise is the “blank canvas” of econometrics. It is the ideal error term. When you build a forecasting model (like a regression), your goal is to extract all the signal (trends, seasonality, correlations) until the only thing left in your residuals is White Noise. If your residuals are not White Noise, you have missed something.

The Definition

A sequence of random variables \(\epsilon_t\) is called White Noise (WN) if it satisfies three conditions:

  1. Zero Mean: \(E[\epsilon_t] = 0\). On average, the errors cancel out.
  2. Constant Variance: \(Var(\epsilon_t) = \sigma^2\). The volatility doesn’t explode or vanish over time.
  3. No Autocorrelation: \(Cov(\epsilon_t, \epsilon_{t-k}) = 0\) for all \(k \neq 0\). Knowing the value of the error yesterday tells you absolutely nothing about the error today.

If the distribution of \(\epsilon_t\) is also Normal (Gaussian), we call it Gaussian White Noise (GWN):

\(\epsilon_t \sim i.i.d. N(0, \sigma^2)\)

Note: “i.i.d.” stands for Independent and Identically Distributed.

Why “White”?

The term comes from physics and signal processing. Just as “white light” contains all visible frequencies of light with equal intensity, “white noise” contains a mixture of all frequencies with equal power. It is static. It is the sound of a TV tuned to a dead channel.

Part 2: The Drunkard’s Walk (Random Walk Models)

Now, let’s take our White Noise and do something dangerous with it. Let’s accumulate it.

Imagine a person leaving a bar. They take a step forward. Then, they flip a coin. If it’s heads, they take a step to the left; tails, a step to the right. This is a Random Walk. It is the most fundamental model in finance because it describes (to a frustrating degree) how asset prices move.

The Pure Random Walk

Mathematically, a Random Walk states that today’s price (\(Y_t\)) is simply yesterday’s price (\(Y_{t-1}\)) plus a random shock (White Noise, \(\epsilon_t\)).

$$Y_t = Y_{t-1} + \epsilon_t$$

If we expand this backwards, we see that the current price is just the sum of all past shocks starting from time zero (\(Y_0\)):

$$Y_t = Y_0 + \sum_{i=1}^{t} \epsilon_i$$

The Random Walk with Drift

Stocks generally go up over the long run (due to inflation and economic growth). A pure Random Walk doesn’t capture this; it just wanders aimlessly. To make it realistic, we add a constant $delta$ (delta), known as the Drift.

$$Y_t = \delta + Y_{t-1} + \epsilon_t$$

  • If \(\delta > 0\), the series will trend upward over time, but with jagged, unpredictable steps.
  • This looks remarkably like a stock chart.

The Stationarity Trap

Is a Random Walk stationary? No.

Recall from previous article that stationarity requires constant variance. Let’s look at the variance of a Random Walk:

$$Var(Y_t) = Var(\sum_{i=1}^{t} \epsilon_i) = \sum_{i=1}^{t} Var(\epsilon_i) = \sum_{i=1}^{t} \sigma^2 = t \cdot \sigma^2$$

The variance depends on t (time). As time goes on, the variance grows linearly. The further into the future you look, the less uncertain you are about where the drunkard is. He could be a mile away or right next to you. This infinite expansion of variance is why we cannot forecast raw stock prices 10 years out with high precision.

The Fix: Differencing

How do we fix a Random Walk? We use the Difference Operator ($Delta$) we learned in last article.

$$\Delta Y_t = Y_t – Y_{t-1} = (Y_{t-1} + \epsilon_t) – Y_{t-1} = \epsilon_t$$

By taking the first difference of a Random Walk, we are left with pure White Noise (\(epsilon_t\)). White Noise is stationary. This is the mathematical proof of why we model returns (differences), not prices.

Part 3: Removing Trends – Two Schools of Thought

When you see a trend in your data, you have two ways to remove it to achieve stationarity. This distinction is subtle but critical for modeling.

Method 1: Deterministic Trend (Regression)

You assume the trend is a perfect, predictable line, like a clock. You model it as:

$$Y_t = \beta_0 + \beta_1 \cdot t + \epsilon_t$$

Here, time (t) is just a variable like any other. If you subtract the line (\(\beta_0 + \beta_1 t\)), you get stationary residuals. This assumes the trend never changes its slope or direction randomly.

Method 2: Stochastic Trend (Differencing)

You assume the trend itself is “shifty.” The slope changes; the direction wanders. This is the Random Walk with Drift model.

$$Y_t – Y_{t-1} = \delta + \epsilon_t$$

Here, we don’t fit a straight line. We just look at the changes.

Tip: In finance, always prefer Method 2 (Differencing). Financial trends are rarely deterministic. A recession or a tech boom can change the slope of the trend instantly. Differencing adapts to these structural breaks naturally; regression lines do not.

Part 4: The Ripple Effect – Moving Average (MA) Models

We have White Noise (pure chaos) and Random Walk (accumulated chaos). Now let’s look at our first structured model: the Moving Average (MA) Process.

Warning: Do not confuse this with the “Moving Average” (SMA/EMA) used in technical analysis charts (like the 200-day moving average). They are related mathematically but used very differently.

  • Technical Analysis MA: Smoothes out past data to show a trend.
  • Econometric MA Model: Describes how shocks (errors) persist over time.

The Intuition: The Hangover

Imagine a company releases a bad earnings report (a negative shock, \(\epsilon_{t-1}\)).

  1. Day 1: The stock drops massively.
  2. Day 2: The news is old, but the market is still “jittery.” The price might be slightly depressed or volatile because of yesterday’s shock, even if there is no new news today.
  3. Day 3: The market forgets. The shock has dissipated.

This is an MA(1) process. The value of \(Y_t\) depends on the shock today (\(\epsilon_t\)) and the shock yesterday (\(\epsilon_{t-1}\)).

The Equation (MA(q))

A Moving Average model of order q, denoted as MA(q), is written as:

$$Y_t = \mu + \epsilon_t + \theta_1 \epsilon_{t-1} + \theta_2 \epsilon_{t-2} + \dots + \theta_q \epsilon_{t-q}$$

  • \(\mu\): The long-term mean of the series.
  • \(\epsilon_t\): The current white noise shock.
  • \(\theta_1 \dots \theta_q\): The coefficients. These determine how much “memory” the shocks have.
    • If \(theta_1 = 0.5\), half of yesterday’s shock carries over to today.
    • If \(theta_1 = -0.5\), yesterday’s shock reverses (mean reversion) today.

Properties of MA(1)

Let’s analyze the simplest version: \(Y_t = \mu + \epsilon_t + \theta_1 \epsilon_{t-1}\).

  1. Expectation (Mean): \(E[Y_t] = \mu\). It is stationary around a mean.
  2. Variance: \(Var(Y_t) = (1 + \theta_1^2)\sigma^2\). The variance is constant (Stationary!).
  3. ACF (The Fingerprint):
    1. Lag 1: There is a correlation because both \(Y_t\) and \(Y_{t-1}\) share the term \(\epsilon_{t-1}\).
    2. Lag 2: \(Y_t\) depends on \(\epsilon_t, \epsilon_{t-1}\). \(Y_{t-2}\) depends on \(\epsilon_{t-2}, \epsilon_{t-3}\). They share nothing. The correlation is zero.

Rule of Thumb: If you look at an ACF plot and see a sharp “cutoff” after lag q (i.e., the bars go significant, significant, then typically zero), you are likely looking at an MA(q) process.

Part 5: Practical Lab – Simulating Chaos

We will now use Python to simulate these processes. Understanding simulations is vital—if you know what the “ideal” chart looks like, you can recognize it in real data.

We will simulate White Noise and a Random Walk, and then try to fit an MA model to our Google stock data.

Step 1: Simulating White Noise and Random Walks

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

sns.set(style="whitegrid")

# Set random seed for reproducibility
np.random.seed(42)

# 1. Simulate White Noise
# 1000 days of random shocks (mean=0, std=1)
white_noise = np.random.normal(loc=0, scale=1, size=1000)

# 2. Simulate Random Walk
# Cumulative sum of white noise
random_walk = np.cumsum(white_noise)

# 3. Simulate Random Walk with Drift
# Add a small constant drift (e.g., 0.1) to every step
drift = 0.1
random_walk_drift = np.cumsum(white_noise + drift)

# Plotting
plt.figure(figsize=(14, 8))

# Plot White Noise
plt.subplot(2, 1, 1)
plt.plot(white_noise, color='cornflowerblue', linewidth=1)
plt.title('White Noise (Stationary)', fontsize=14)
plt.ylabel('Value')

# Plot Random Walks
plt.subplot(2, 1, 2)
plt.plot(random_walk, label='Pure Random Walk', color='gray', linestyle='--')
plt.plot(random_walk_drift, label='Random Walk with Drift (δ=0.1)', color='firebrick')
plt.title('Random Walk vs. Random Walk with Drift (Non-Stationary)', fontsize=14)
plt.ylabel('Value')
plt.legend()

plt.tight_layout()
plt.show()
Graph depicting White Noise (stationary) on the top and a comparison of Pure Random Walk versus Random Walk with Drift (non-stationary) on the bottom.

Interpretation:

  • Notice how the White Noise stays bound within a horizontal band (like -3 to 3).
  • The Random Walk, however, wanders off.
  • The “Drift” version looks exactly like a strong Bull Market chart.

Step 2: Fitting an MA Model to Google Data

Now we return to our real-world dataset (data2.csv). In last article, we saw that Google’s Log Returns looked stationary. Let’s see if an MA(1) model fits them well.

We will use the statsmodels library. Note that in modern Python stats, we often use ARIMA but set the AR and I parts to zero to get an MA model. An MA(1) is effectively ARIMA(0, 0, 1).

import pandas as pd
import numpy as np
from statsmodels.tsa.arima.model import ARIMA
import warnings

# Suppress warnings for cleaner output
warnings.filterwarnings("ignore")

# Load Data (Assuming data2.csv is in the working directory)
df = pd.read_csv('data2.csv')
df['Date'] = pd.to_datetime(df['Date'])
df.set_index('Date', inplace=True)

# Calculate Log Returns
df['Log_Ret'] = np.log(df['GOOGLE']).diff().dropna()

# --- Fitting an MA(1) Model ---
# Order = (p, d, q)
# p = 0 (AutoRegressive part - we will cover this next article)
# d = 0 (Integration/Differencing - we already differenced manually via log returns)
# q = 1 (Moving Average part)

model_ma1 = ARIMA(df['Log_Ret'], order=(0, 0, 1))
results_ma1 = model_ma1.fit()

# Display the summary of the model
print(results_ma1.summary()
A table displaying SARIMAX results for an ARIMA(0, 1, 1) model, showing coefficients for const and ma.l1, along with statistical metrics such as log likelihood, AIC, BIC, and various diagnostic tests.

Analysis of Output:

Look for the ‘ma.L1’ coefficient in the summary table.

  1. P-value (P>|z|): It is < 0.05. The MA term is statistically significant.
  2. Coefficient (coef): It’s negative, it suggests slight mean reversion (a jump up is followed by a slight correction).
  3. Log Likelihood / AIC: These are scores. We use them to compare models (lower AIC is better).

Interpretation of the Results

When you run the code, you find that the MA(1) coefficient for Google returns is small or even insignificant. This is common for large-cap stocks! According to the Efficient Market Hypothesis, past shocks should be absorbed instantly, leaving no “hangover” for tomorrow.

If the MA term is significant, it implies market inefficiency; information is taking time to process, or there is overreaction/underreaction occurring in the market.

Conclusion

We have now moved from static descriptions to dynamic processes.

  • White Noise gave us a target for our residuals.
  • Random Walks explained why prices drift and why uncertainty grows with time.
  • MA Models gave us a way to model the persistence of external shocks.

However, the MA model has a limitation: it assumes the current value depends only on errors (shocks). But what if the current value depends on the previous value itself? What if high prices today lead to high prices tomorrow not because of a shock, but because of momentum?

For that, we need the Autoregressive (AR) model. That will be the subject of our next article, where we will finally combine AR and MA to create the legendary ARIMA model.

Stay tuned.


Leave a Reply

Discover more from SimplifiedZone

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from SimplifiedZone

Subscribe now to keep reading and get access to the full archive.

Continue reading