Time Series, lesson 2
Volatility clusters
Calm and wild stretches, and how to measure volatility.
Two stocks can have the same average return and very different risk: one moves half a percent on a normal day, the other 3%. This lesson measures that size and shows how it changes over time. You need returns, from the last lesson, and what a standard deviation is.
By the end, you can:
Part 1. The size of a typical move
Measure volatility from a list of daily returns.
Daily returns hover around a small average. What sets one stock apart from another is how far they stray from it. Statistics already has a measure for that: the standard deviation.
Example 1.1
Five days of returns
A stock's returns over five days were +1%, −2%, +0.5%, +1.5% and −1%. How big is a typical day's move?
- Find the average(1 − 2 + 0.5 + 1.5 − 1) / 5 = 0%
Here it's exactly zero, which keeps the next step simple.
- Square each distance from it1, 4, 0.25, 2.25, 1
In %². Squaring makes a fall count as much as a rise, and big moves count most.
- Average the squares over n − 18.5 / 4 = 2.125
That's the variance. Dividing by n − 1 makes up for measuring from an average taken from the same five days.
- Take the square root√2.125 = 1.46%
Back to percent: the daily volatility.
Answer1.46% a day.
Squaring, averaging and taking the root gives a typical distance from the average. Big days weigh more than in a plain average of the sizes, which here is 1.2%. Before the root, the −2% day counts four times as much as a 1% day.
Volatility
Volatility is the standard deviation of returns: how far a return typically lands from the average. It's written σ, "sigma". Read the formula as "the square root of the squared distances from the average, added up and divided by n − 1".
σ = √( Σ (rᵢ − r̄)² / (n − 1) )
Over months of data, the average daily return is tiny next to the moves, so desks often treat it as zero: square the returns, average them over n, take the root. With 20 or more days the answer barely changes. And volatility says nothing about direction. It measures size only.
Your turn
Four daily returns: +2%, −2%, +1% and −1%. What's the volatility?
Part 2. From a day to a year
Scale a daily volatility to any number of days with the square root of time.
Volatility is usually quoted per year, so stocks, funds and options compare on one scale. A year has about 252 trading days. Turning a daily figure into a yearly one takes one fact: the variances of independent days add up.
Example 2.1
A year from a day
A stock's daily volatility is 1.46%, and its days are independent. What's its volatility over a year of 252 trading days?
- Start from the daily varianceσ² = 2.125
In %², from the five days in part 1. Variances of independent days add up. Volatilities don't.
- Add up a year of days252 × 2.125 = 535.5
A year's log return is the sum of 252 daily ones, so its variance is the sum of 252 daily variances.
- Take the square root√535.5 = 23.1%
The same as 1.46% × √252, and √252 is about 15.9.
AnswerAbout 23.1% a year.
Volatility grows with the square root of time because ups and downs partly cancel. Over 4 days the spread is √4 = 2 times a day's, not 4 times. Over 252 days it's about 15.9 times.
The square-root-of-time rule
If days are independent, the volatility over T days is the daily volatility times √T. Turned into a yearly figure this way, a volatility is annualised.
σ over T days = σ a day × √T
Two traps. Multiplying by 252 instead of √252 turns 1.46% a day into 368% a year. And the rule needs independent days. If moves tend to continue, a week spreads more than √5 days' worth, and if they snap back, less. "Random walk or not" turns that into a test.
Your turn
A stock's daily volatility is 2%. If days are independent, what's its volatility over 4 days?
Part 3. Volatility comes in clusters
Spot volatility clustering, and say what it means for tomorrow's risk.
One number for a whole year suggests every day is drawn with the same spread. Look at a year of a practice stock day by day and that's plainly not so: months of calm, then a storm.
Example 3.1
Big days after big days
In that year, 10 of the 252 days moved more than 3%, up or down. How often was the day after a big day big as well? Compare it with the same days shuffled.
- Find how common big days are10 / 252 = 4.0%
With no clustering, the day after a big day would be big about this often too.
- Check the day after each one4 / 10 = 40%
Four of the ten big days were followed by another.
- Compare the two40% / 4.0% = 10
A big day made the next day ten times as likely to be big.
- Shuffle the days and count again0 / 10 = 0%
Same moves, same volatility, a new order: the bunches are gone.
AnswerAfter a big day, another big day was ten times as likely.
Volatility isn't fixed. It drifts through calm spells and stormy ones that last for weeks. A big day is a sign you're in a storm, and storms don't end overnight. So the size of yesterday's move says something about the size of today's.
Volatility clustering
Big moves tend to follow big moves, of either sign, and small moves tend to follow small ones. The direction of tomorrow's move stays hard to guess. Its size doesn't.
Clustering is about size, not direction. In the storm above, falls and rises came in turns: +5.3% then −3.2%, and −3.4% then +6.5%. So after a big fall, don't expect a bounce or another fall. Expect a wide range.
Your turn
Over 800 days, 40 days moved more than 3%. Of the 40 days right after them, 12 moved more than 3% too. How much more likely is a big day right after a big one?
Part 4. Volatility over a recent window
Measure volatility over a rolling window, and choose its length.
Since volatility drifts, a figure from five years of data describes an average year, not this week. Desks measure it over the last few weeks instead, and recompute it every day as the window moves on.
Example 4.1
A big day leaves the window
You measure volatility over the last 20 days, taking the average return as zero. Nineteen of the days moved 1%, up or down, and one fell 6%. What's your estimate? What is it on the day the 6% fall leaves the window, if that day moves 1%?
- Square and add the 20 days19 × 1 + 36 = 55
In %². The one big day supplies almost two thirds of the total.
- Average and take the root√(55 / 20) = 1.66%
With the average taken as zero, divide by n.
- Swap the big day for a 1% day√(20 / 20) = 1.00%
Nothing unusual happened that day, and the estimate fell by 40%.
Answer1.66%, falling to 1.00% the day the big move drops out.
In a plain window every day counts fully until it leaves, then not at all. So one event moves the estimate twice: once when the big day arrives, and again 20 days later, on a day when nothing happened.
Rolling volatility
Rolling volatility is volatility measured over the last w days and recomputed every day as the window moves forward. w is the window's length.
The length is a trade. A short window reacts fast but jumps around, because a handful of days can't pin a spread down. A long one is smooth but late: it keeps a storm in its estimate for months after the storm ends. "Volatility models" lets old days fade out instead.
Your turn
You use a 60-day window. A −8% day happened 60 days ago, and today it drops out of the window. What happens to your estimate?
Where you'll meet it
Expect quick ones: annualise a daily volatility, scale it to a week, and say why it's √252 and not 252. Then the judgement calls: when the square-root rule fails, what a big down day means for tomorrow's risk, and how long a window you'd use, and why.
Rama Cont's 2001 survey lists volatility clustering among the stylised facts found across a wide range of instruments, markets and periods. Benoit Mandelbrot had described it in 1963, studying speculative prices: large changes tend to be followed by large changes, of either sign. So risk desks estimate volatility from recent data and update it every day.
import numpy as np
rng = np.random.default_rng(339)
r, var = np.zeros(252), 0.0001
for t in range(252): # volatility that builds after big days, then fades
r[t] = np.sqrt(var) * rng.standard_normal()
var = 0.000002 + 0.10 * r[t] ** 2 + 0.88 * var
def big_after_big(x): # big days, and big days right after a big day
big = np.abs(x) > 0.03
return int(big.sum()), int((big[:-1] & big[1:]).sum())
vol = r.std(ddof=1)
print(f"{vol:.2%} a day, {vol * np.sqrt(252):.1%} a year")
print(f"first 180 days {r[:180].std(ddof=1):.2%}, last 40 {r[-40:].std(ddof=1):.2%}")
print("as it happened", big_after_big(r), "shuffled", big_after_big(rng.permutation(r)))
# Output:
# 1.18% a day, 18.8% a year
# first 180 days 0.69%, last 40 2.46%
# as it happened (10, 4) shuffled (10, 0)Check yourself
Three questions from across the lesson. Try each one before you look back.
1
Yesterday a stock fell 4%, one of its biggest moves this year. What's the best guess for today?
2
A stock's volatility is quoted as 32% a year. About how big is a typical daily move?
3
Over a 10-day window, eight days were flat, one rose 3% and one fell 3%. Taking the average return as zero, what's the volatility?
What to remember
1The size of a typical move
Volatility is the standard deviation of returns: +1%, −2%, +0.5%, +1.5% and −1% give 1.46% a day.
2From a day to a year
If days are independent, volatility grows with the square root of time: 1.46% a day is 1.46% × √252 ≈ 23.1% a year.
3Volatility comes in clusters
Volatility clusters: in the practice stock, a big day made the next day ten times as likely to be big, in either direction.
4Volatility over a recent window
A rolling window counts each day fully until it leaves, so one −6% day lifts a 20-day estimate from 1.00% to 1.66% and drops it 20 days later.
Time Series overviewSpotted a mistake? Tell us.