Top Banner
BlackArbs LLC Brian Christopher, CFA April 25, 2017
28

Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Jan 24, 2018

Download

Education

QuantInsti
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

BlackArbs LLCBrian Christopher, CFA

April 25, 2017

Page 2: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Brian ChristopherQuantitative researcher, Python developer, CFA charterholder, and founder of Blackarbs LLC, a quantitative research firm.

Six years ago he learned to code using Python for the purpose of creatingalgorithmic trading strategies. Four years ago he decided to self publish hisresearch with a focus on practical, reproducible application.

Now he continues his open research initiatives for a growing community oftraders, researchers, developers, engineers, architects and practitionersacross various industries.

He attained a BSc in Economics from Northeastern University in Boston,MA and received the Chartered Financial Analyst (CFA) designation in 2016.

About the Speaker

2

Page 3: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Return prediction is difficult.

In Time Series Analysis (TSA) we observe multiple phenomenathat violate the rules of stationarity (non-linear processes,volatility clustering, autocorrelation, etc.)

Traditional TSA techniques don’t generalize well for assetreturn prediction but may be useful in volatility prediction(ARIMA, ARCH, GARCH)

The Problem with Traditional Time Series Analysis(Defining the Problem)

3

Page 4: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Traditional Issues with Asset Return Prediction

4

Blackarbs credit: SeanAbu.com

Page 5: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

What Can We Do?

5

We need a model that doesn’t require stationary data.

We need a model that can approximate non-linear distributions.

Page 6: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Are mixture models a solution?

6

Mixture models build on several established concepts.

Markov models - Sequences where future statedepends only upon current state aka memorylessprocesses.

Hidden Markov models – The true state is unobserved(hidden) but there are observable factors that give usinformation about the true state.

Expectation-Maximization (E-M) – Class of algorithmsthat iterates between computing class parameters andevaluating the likelihood of the data given thoseparameters.

Page 7: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

What are mixture models and how do they work?

7

We know that time series exhibit temporary periods wherethe expected means and variances are stable through time.These periods or regimes can be likened to hidden states.

If we can better estimate an asset's most likely regime orhidden state, including the associated means and variances,then our predictive models become more adaptable and willlikely improve.

If that's the case, then all we need are observable variableswhose behavior allows us to infer the true hidden state(s).

Page 8: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

What are mixture models and how do they work?Summary

8

Think of an asset’s returns as a sequence of states or“regimes”.

Each regime has its own descriptive statistics including meanand volatility.

Examples include “low-vol” vs “high-vol” regimes.

The model assumes that over time, the asset’s returns willtransition between regimes based on probability.

Mixture models try to estimate the sequence of regimes,each regime’s descriptive attributes, and the transitionprobabilities between regimes.

The most well known is the Gaussian Mixture Model (GMM).

Page 9: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

What are mixture models and how do they work?

9

GMM assumes each regime (aka component, class, state) isgenerated by a Gaussian process with discoverableparameters.

GMM uses E-M under the hood alternating betweenestimating the regime parameters (mean, variance) andlikelihood that those parameters could generate the data,until convergence or another stopping criteria is met.

Page 10: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Can GMMs model non-stationary data sets?

10

Using SPY return data from Yahoo Finance I fit the GMM with3 components representing low-volatility, neutral, and high-volatility regimes.

Page 11: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Can GMMs model non-stationary data sets?

11

Notice the 2th hidden state or “regime” has a negative meanreturn, and the largest variance, which represents our high-vol regime. The 1th hidden state looks like our low-volregime, and the 0th hidden state is somewhere in between.

The GMM accounts for non-stationarity by design. It chopsthe data into regimes and provides us with an estimate of themean and variance for each one.

Page 12: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Can GMMs approximate nonlinear data distributions?

12

Short answer: Yes

The top image shows theGMM trying to fit 2Gaussians to the data withpredictably bad results.

The bottom image showsthe GMM trying to fit 16Gaussians to the data withmore success.

You can approx. manycomplex shapes withenough Gaussiancomponents but you riskoverfitting.

Page 13: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Strategy Design

13

Now that we have determined that GMMs can overcome the weaknesses of the TSA models, we can design a trading strategy to test its application:

The strategy uses a total of 4 factors to estimate thesequence of regimes and their parameters.

• The asset’s returns (Yahoo Finance)

• TEDRATE (FRED)

• T10Y2Y (FRED)

• T10Y3M (FRED)

Page 14: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Strategy Design

14

The strategy works like so.

Feed market data to the GMM.

Call predict method to extract model estimate of last regime“label”.

Once we have the “label” we can get the model estimate ofthe mean and variance for that regime.

We feed the parameter estimates to the JohnsonSUdistribution and draw N samples to construct our 99%confidence intervals (CIs).

Any returns that fall outside the estimated CIs are defined asoutliers and assumed to mean revert. This strategy assumesa “buy” of the etf for M number of steps (days) after theoutlier event of a return falling below the lower CI.

Page 15: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

15

For a single ETF with a set of parameters, for the walk-forward period, we can plot the model accuracy as well as an“equity” plot.

Below is an example output for SPY:

Page 16: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

16

To really dive in we have to analyze the aggregated results. Byorganizing the data properly...

We can evaluate each ETF individually across lookbacks, stepsor ks

We can evaluate the ETFs collectively across lookbacks, stepsor ks

We’ll look at a few examples in the following slides...

Page 17: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

17

We can see that across lookbacks SPY, QQQ, TLT have positivemedian returns per event. EFA and EEM have more symmetricdistributions.

Page 18: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

18

We can see a similar distribution pattern here using thesum_ratio statistic. The sum_ratio statistic is the sum of returns> 0 divided by the sum of returns < 0. Values greater than 1 areconsidered a “success”.

Page 19: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

19

In this example we evaluate the median return for each ETF bylookback and across steps. Again we see SPY, QQQ, and TLTdominating. EFA is also mostly > 0 across steps.

Page 20: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

20

In this plot we see the sum_ratio metric is > 1 across multipledimensions for SPY, QQQ, TLT, and EEM. GLD’s sum_ratiodepends on lookback. EFA is weak, and EEM suffers fromexposure at 21 steps.

Page 21: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

21

Here we can evaluate the median returns across k (# ofcomponents). Again we see broad success across k for SPY,QQQ, TLT, and surprisingly EFA. GLD and EEM are more variedand dependent on lookback.

Page 22: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

22

Here we can evaluate the median returns across k (# ofcomponents). Again we see broad success across k for SPY,QQQ, TLT, and surprisingly EFA. GLD and EEM are more variedand dependent on lookback.

Page 23: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Evaluate the Strategy

23

Here we see a similar pattern among the ETFs with thesum_ratio for SPY, QQQ, TLT are > 1 across multipledimensions. EEM and GLD show similar variability based onlookback but with passable performance overall.

Page 24: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Conclusions

24

The secret sauce for GMM accuracy when predicting the return distribution is choosing the proper sampling distribution (JohnsonSU vs. Normal)

US based ETFs showed consistently positive results across many parameter combinations.

There was more variability with GLD, EFA, and EEM depending on metric evaluated, steps (exposure), and k which warrants an expanded study.

Must note that there is a risk that these results are simply the result of being long the US market post 2009!

Page 25: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Further Areas to Explore

25

GMM with large cross section of single-issuer stocks.

GMM testing with multiple time frames (intraday, weekly, monthly).

GMM as basis for volatility strategy (testing volatility trends post outlier event.

Are the outlier events themselves randomly distributed? Or are they clustered?

GMM as a basis for multi-asset class strategy (combinations of equity, options, futures)

Page 26: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Resources

26

* Introduction to Hidden Markov Models with Python, Networkxand Sklearn - http://blkarb.se/2l6Lndw

* Intro to Expectation-Maximization, K-Means, Gaussian Mixture Models with Python, Sklearn - http://blkarb.se/2n1A7kn

* Python Data Science Handbook by Jake Vanderplas -https://github.com/jakevdp/PythonDataScienceHandbook

* Blackarbs blog – Blackarbs.com/blog

* Blackarbs Github -https://github.com/BlackArbsCEO/Mixture_Models

Page 27: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

Contact

27

* Website: Blackarbs.com

* Twitter: @blackarbsCEO

* Linkedin: www.linkedin.com/in/bcrblackarbs/

* Email: [email protected]

Page 28: Can we use Mixture Models to Predict Market Bottoms? by Brian Christopher - 25th April 2017

SINGAPORE

30 Cecil Street, #19-08,

Prudential Tower,

Singapore – 049712

Phone: +65-9057-8301

INDIA

A-309, Boomerang,

Chandivali Farm Road, Powai,

Mumbai - 400 072

Phone: +91-22-61691400

Learn Automated Trading

Join EPAT™The Executive Programme in

Algorithmic Trading

Enquire Now!