Tuesday, August 10, 2010

Conditioning Systems on Regime Variables

Here is a brief and simple example of switching systems based upon regime type (sometimes called gating).

I've brought up the idea of conditioning systems based upon regimes many times in past posts. Some texts call this filtering, although I prefer to use the term conditional gating. The simple idea is to turn on a certain system during certain conditions and either: switching systems, or simply tracking the underlying series during alternate conditions. In this case the gating condition is regime, which in turn is, is High or Low Volatility as measured by the VIX.  Although I'm not divulging the details of the underlying system itself, I've seen enough discussions in public domain to feel that other traders have picked up on the ideas demonstrated here.

 Fig 1. Terminal Wealth vs. VIX threshold

The animation below shows the system results during each step of the conditioning variable, the VIX. Notice the dramatic improvement at the value of 23. Also, notice as mentioned in earlier posts how the optimal switching point of 23 is the most robust value, since even if the OOS results are to the left or right of the optimal switching point, they will be the best local values over a wide range of dependency. The astute observer might have noticed that this system is simply tracking buy&hold during low vix regimes, while switching on system V, during the high regimes. It is evident that the terminal wealth simply tracks buy & hold after a certain value of VIX, since it is always locked on to tracking mode under a certain threshold.

The system is only shown in sample, however, I've found it to be pretty successful OOS as well.

Video 1. Stepping the Equity Curve system through linear VIX range.


  1. Regarding conditioning on volatility I wonder if you have any input on the choice to include volatility in the trading system model itself versus using it as a conditioning variable. In our models we have often used a volatility measure (realized or VIX) to adjust decision parameter values using current volatility level. This has worked OK, but not exceptional, for us so maybe is would be better to have a number of different systems and use conditioning instead? This choice is obvious for volatility, but can also be valid for trend data depending on the system model.

  2. I've shown an earlier example with using volatility as an attribute or factor itself to the system (J48 learner). However, doing so doesn't allow the system to isolate the regime factor itself, instead it weighs all of the attributes and attempts to come up with the optimal weights or decisions given all of the aggregate information all of the time, whereas gated conditioning completely isolates that regime and allows your learner to focus on the specific regime behavior only. It's an easy condition for you to add and compare as an always included attribute vs. gating condition.

    You could also try to just take the raw data and slice only data values under/over some vol measure, and see how well your system learns or performs on that data as a starting point. You can just use tracking underlying data for the remaining data to make the simple comparison.

  3. Thank you for your answer. I agree that isolating the regime variable could be very helpful. It can help reduce fitting problems since we can remove some parameters from the model. Hopefully it could help improve performance of the individual systems as well. Slicing the data is a good idea as long as you have enough data.

  4. Nice post. I have likewise found that lookback on samples from the same regime work much better than including regime as a parameter in ML based strategies.

    I'm curious about your experience with the following:

    - do you see any gain with more than 2 regimes
    - do you use any other analysis other than VIX level in your regime switching

  5. Hi tr8der, Always good to hear your feedback.

    1) I haven't really pursued focusing on more than 2 regimes that much; although in some cases, I can see how it might have merit, one of the things to take into consideration is that the regime(s) should be chosen long enough to have some confidence in continued persistence over over a good length of time. For example, by moving to three regimes based on pure volatility, you would likely have lots of whipsawing and switching going on during the 2nd to 3rd regimes (assuming they are above say 20 level).

    2) With respect to pure price data, we can use different ways to measure volatility (although some may be superfluous). But I've found it to be one of the better variables to segment price behavior (one other possible factor aside from the magnitude of VIX is the direction, which has more information i.e. is VIX above the threshold rising or falling?).

    As an aside, I know of many traders who normalize to volatility which is an alternate way to tackle the vol regime dependencies without actually segmenting them.

  6. This is the best quant blog I have ever read. Please keep up the great work! Love it!

  7. IT,

    I have just come across your blog. I noticed the video - which to my crude mind looks like a parameter in a model being "optimised" - what am I really looking at? - could you put it in simpler terms for me?


  8. Hi Moon,
    That's one way to view it. I would prefer to call it a sensitivity sweep, in which we are observing the sensitivity of the system to a conditioning variable (or parameter if you like), which is the VIX value.

    Just think about it as developing and running a system that is dependent on data segments sliced above or below a VIX threshold. When it is not above or below the threshold, you can simply track the actual instrument. By using this method, considerable performance can be achieved over developing the conditions over all values of VIX.

    hope that helps,

  9. IT,

    Are the results above from having a moving optmisation window. i.e you are learning as you go along and apply results of parameter optimisation to next bit - or are you optimising over the whole period? Sorry to ask, but I am a little unused to some of the terms you use - probably it is clearly stated already...

  10. Hi xmoon,

    No Problem. I am optimizing based upon that portion of the overall time series data that meets a certain criteria. Imagine it as you have data from 2000 to 2009 for a certain instrument, and you wish to optimize a system on that data. The idea here is to take only those segments which correspond to volatility (VIX in this case) above or below a certain value. You might find that only data from 2000-2001 and 2008-2009 meet this criteria for example-- VIX>25. So you only optimize on those periods of data, and simply track the index (buy and hold) during the other periods. Finding the VIX threshold which is optimal to isolate (in this case 25) can also be regarded as an optimization variable. Does that help?


    P.S. It is looking at an entire body of data with the expectation that the improvement will continue into the future. As with any system, however, you want to try to verify with other validation methods such as walk forward and real life data. As with any system, you want to try to gauge if and when the behavior is performing as you expect it to based upon past history and have some alternate plan in case it does not.