13.08.2022 Views

advanced-algorithmic-trading

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6

Bayesian Stochastic Volatility Model

In this chapter all of the Bayesian statistical theory discussed thus far will be utilised to build

a Bayesian stochastic volatility model. Such a model allows estimation of current and

historical volatility levels of asset returns. Within quantitative trading this is useful from the

perspective of risk management as it provides a "risk filter" mechanism for trade signals.

A Bayesian stochastic volatility model provides a full posterior probability distribution of

volatility at each time point t, as opposed to a single "point estimate" often provided by other

models. This posterior encapsulates the uncertainty in the parameters and can be used to obtain

credible intervals (analogous to confidence intervals) and other statistics about the volatility.

This chapter is heavily influenced by two main sources. The first is a paper written by Hoffman

and Gelman[53], which introduced a highly efficient form of Markov Chain Monte Carlo, known

as the No-U-Turn Sampler (NUTS). The outline of NUTS is beyond the scope of the book. For

a detailed reference, refer to the paper.

The paper describes a Bayesian formulation of a stochastic volatility model, the sampling

of which is carried out using the presented NUTS technique. The presented model is the main

inspiration for the model in this chapter. The second source is the Python PyMC3 library[10]

tutorial article by Salvatier, Fonnesbeck and Wiecki[89] on applying such a model within the

PyMC3 MCMC library.

This chapter will closely follow these two sources but will provide a fully functional end-to-end

script that can be used to estimate volatility for daily equities returns.

6.1 Stochastic Volatility

A stochastic volatility model consists of an underlying generative process for the volatility of

asset returns, which is then used to provide a time-varying variance in the model for the asset

returns distribution itself.

They are used to account for the empirical fact that volatility in financial markets tends to

cluster together. An example of which is the period of excess volatility that occured in the 2008

financial crisis. In time series analysis this "volatility clustering" is known as heteroskedasticity.

Another stochastic volatility model, known as GARCH, will be considered later in the book.

Readers who have also read the C++ For Quantitative Finance ebook by QuantStart will

be aware of the continuous Heston stochastic volatility model. This is specified via a pair of

59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!