Market simulation model thoughts

October 22, 2017
modelling

I created the market simulation model because I needed a fast and painless way to obtain reasonable market values as an input into my larger hybrid financial model.

The hybrid financial model attempts to predict actual BMO P&L (e.g. revenues) using modern data science techniques including machine learning and artificial intelligence and takes as an input various drivers, including the equity markets. The more accurate the input variables, the more meaningful the model predictions are.

How it works

The idea behind the model is that while equity market prices do not appear to have any appreciable boundaries, market returns do. The likelihood of the TSX dropping to 0 by the next day is extremely unlikely, and similarly the likelihood of the TSX increasing 5,000% is also extremely unlikely.

Now, if those two values are extremely unlikely, then what are some more likely values?

TSX behaviour

Let’s first visualize the historical TSX prices and returns:

Using the normal probability distribution as a model

My first attempt to model the returns is to use the popular normal distribution. To use the normal distribution, we only need two parameters:

  1. Location
  2. Scale

We can obtain those parameters from the historical behaviour of the TSX itself. The location is the mean (or average) return of the TSX, and the scale is the variance of those returns.

Let’s see how the normal distribution compares to the actual returns:

I’d say the normal distribution does an adequate job, but there are clearly sections where there are differences between the normal model and the actual return.

Using the generalized lambda probability distribution as a model

Recent literature has suggested that the generalized lambda distribution (GLD) may be a better model to model equity market returns. The GLD has four parameters in total and is therefore able to vary its shape to a greater degree than the normal distribution.

The GLD’s four parameters are:

  1. Location
  2. Scale
  3. Skewness
  4. Kurtosis

Similar to the normal distribution, the values of the two additional parameters can be obtained from the actual returns.

Let’s see how the GLD compares to the normal model and to actual returns:

The GLD was able to capture the slight skew to the right as well as the slightly fatter tails, which the normal distribution missed.

The market simulation model uses the GLD as the underlying model to simulate new market values from.

S&P 500 behaviour

The same process can be repeated for the S&P 500. The actual returns, normal model, and the GLD model is presented below:

RNN vs. Dense neural networks for time-series

June 27, 2018
R modelling

Auto neural networks vs. Manual Keras neural model

June 11, 2018
R modelling

"Drop the Mic" machine learning (part 2)

January 10, 2018
R modelling fun