Back to Blog

Shepherd's volatility: a brief introduction

Posted by

Sheperds Volatility

Introduction

Why do markets sometimes experience wild price swings while remaining calm at other times? The answer lies in volatility, one of the most important concepts in trading.

Simply put, volatility is the propensity of a variable to vary over time. A volatile variable is one that tends to move a lot. It is important to understand that volatility is not an observable variable like market price or volume. Consequently, it may only ever be estimated.

The standard definition of volatility is the square root of the variance. Variance is defined as:

σ2=1nt=1n(rtrˉ)2\sigma^{2} = \frac{1}{n}\sum_{t=1}^{n}(r_{t}-\bar{r})^{2}

where, for our purpose, rtr_{t} are the logarithmic returns at time t, n is the number of observations and rˉ\bar{r} is the mean logarithmic return.

For the remaining of this blog I will use the expressions 'returns' and 'logarithmic returns' interchangeably. That is, for my purpose, returns are logarithmic returns (for more on financial returns see our "A word on financial returns" blog).

There are alternative volatility estimators and ours is an ARCH (AutoRegressive Conditional Heteroscedasticity) type model that estimates the 1 day return volatility forecast for a given market. We named it Shepherd's volatility.

Heteroscedasticity refers to a set of random variables, sampled from the same population, which do not have the same finite variance. If a set of random variables have the same finite variance they are said to be homoscedastic.

In the contex of time series analysis we can think of a heteroscedastic series as basically one with a variance that is not constant in time.

Think of a road trip. Some parts of the journey are smooth (low variance), while others are bumpy with sudden turns (high variance). In financial markets, price fluctuations behave in a similar way - sometimes calm, sometimes highly volatile.

ARCH models help traders and risk managers forecast periods of high and low volatility, which can impact everything from option pricing to risk management.

Autoregressive conditional heteroscedasticity models

ARCH models were first introduced by Robert Engle, in 1982, in a paper called "Autoregressive Conditional Heteroscedasticity with Estimates of the Variance of United Kingdom Inflation", published in Econometrica, Volume 50, Issue 4, pages 987-1008 (for the original paper click Here).

Engle defines an ARCH process as a zero mean, serially uncorrelated process with a non constant variance conditional on the past, but constant unconditional variances. Heteroscidasticity of order q can be expressed mathematically as follows:

σt2=α0+i=1qαiϵti2\sigma^{2}_{t} = \alpha_{0}+\sum_{i=1}^{q}\alpha_{i}\epsilon^{2}_{t-i},

where ϵt=σtZt\epsilon_{t} = \sigma_{t}\Zeta_{t}, the model parameters, αi\alpha_{i}, are greater or equal to zero and Zt\Zeta_{t} is a random variable (white noise).

ARCH models in finance

Classical finance assumes that prices of financial markets follow some from of random process and as such are not predicable. Prices can be expressed, for instance, as a the sum of an initial price p0p_{0} plus the sum of logarithmic returns:

ln(pt)=ln(p0)+i=1tri\ln(p_{t}) = \ln(p_{0}) + \sum_{i=1}^{t}{r_{i}},

where ptp_{t} is the price at time t and ri=ln(pi)ln(pi1)r_{i}=\ln(p_{i})-\ln(p_{i-1}) is the return from time i-1 to i.

If the assumption that market prices follow a random process is correct then the returns are a random variable. If we now assume that the returns' variance is not constant in time and replace ϵt\epsilon_{t} by rtr_{t} in the ARCH model equations, we get our variance model.

Putting it in words, the variance, according to the ARCH model, is a function of q past squared returns. In practice, we can view the model as a weighted sum of q past squared returns plus the independent term α0\alpha_{0}.

The volatility is then equal to the square root of the variance σt=σt2\sigma_{t} = \sqrt{\sigma^{2}_{t}}.

Bitcoin example

The first step before we can use an ARCH to model a time series' variance is to determine if, in fact, the series' variance is or not constant in time. There are a number of statistical tests, like the Breusch-Pagan test, to test for Heteroscedasticity. Here I will just present a couple of graphics for visual inspection.

I will plot two graphs comparing two stochastic processes statistics (i) the Bitcoin logarithmic returns from 2013-04-29 to 2025-03-09, with mean and standard deviation equal to 0.15% and 3.85% respectively, and (ii) a normally distributed random variable with same mean, standard deviation and length.

The first graph shows the expanding variance (that is the variance calculated with 2 returns, then 3 returns, 4 returns, etc) from 2014-01-01 as the first part of the series is quite noisy due to the small sample size.

Expanding Var

As can be seen in the previous figure, while the random normal expanding variance converges quickly to 15 and stays there, the expanding variance of the Bitcoin's returns varies considerably over time. It is also interesting to note that Bitcoin's variance has been diminishing with time.

The second plot shows the Bitcoin's squared returns together with the square of the random normal variable from the beginning of the series.

Squared returns

The previous figure shows that the Bitcoin's squared returns are more disperse and, at times, more extreme than the normal random variable squared. The Bitcoin's squared returns are also characterized by clusters of high values, which is typical of conditional heteroscedasticity.

The two plots seem to indicate that, indeed, the Bitcoin's return's variance is heteroscedastic. The next plot shows the Sheperd's ARCH model estimates for Bitcoin.

Shepherds volatility

We can observe that, while Bitcoin's logarithmic returns volatility has decreased over time there are periods of higher and lower volatility.

A good volatility model should bring the distribution of the volatility adjusted returns closer to the normal distribution. There are, of course, proper statistical test for the equality of distributions, like the Kolmogorov-Smirnov test. In this blog, once again, I will just rely on visual inspection.

The next plot shows the kernel density estimates for (i) Bitcoin's standardized logarithmic returns (the returns divided by its standard deviation), (ii) Bitcoin's volatility adjusted logarithmic returns and (iii) standardized random normal (based on the sample I generated, for fairness).

Expanding Var

It is possible to see in the kernel density estimates plot that, indeed, the volatility adjusted returns are closer to a normal distribution although still different from it.

The main statistics for each one of the series are displayed in the following table, confirming that the volatility adjusted returns are better behaved than the standardized returns.

NameStandardized ReturnsVolatility Adjusted ReturnsStandardized Random Normal
Mean0.040.050.04
Minimum-11.26-4.17-3.40
Maximum7.454.034.24
Standard Deviation1.000.941.00
Skewness-0.50-0.060.02
Kurtosis9.011.720.01

Final remarks

  • Understanding volatility is crucial for traders. A strong volatility model can improve risk management, enhance portfolio decisions, and refine trading strategies.
  • A time series with time varying variance is said to be heteroscedastic.
  • ARCH models are very common in finance to model time varying volatility and volatility clustering.
  • A good volatility model should bring the distribution of the volatility adjusted returns close to a normal distribution.
  • Trading involves risks, and readers are solely responsible for their trading decisions.

Want deeper insights into risk and trading strategies? Subscribe to Trading Shepherd today and stay ahead of market volatility!"