Predictor(s)/Factor(s) Selection

Before getting in the post main subject, I want to mention a couple things. First, the TAA system talked about before on the blog is still in the works, a busy schedule and work commitment made it difficult for me to polish and publish it as soon as I wanted. Secondly, I apologize for the New Year’s hiatus; I will be back to regular posting in the coming days.

Back to the subject at hand; predictor selection. For usual readers of the blog, machine learning will not strike as an unusual topic for the blog. I really enjoy using statistical learning models for my research and trading, and talked about it a fair bit in earlier posts. However, reviewing the blog history recently, I noticed that I overlooked this very important topic.

The same way we must be careful what predictor(s) we use when using linear regression or, for that matter, any forecasting model we need to pay close attention to our input when using learning models (GIGO: garbage in = garbage out).

Using a “kitchen sink” approach and using as many predictors as one can think of is generally not the way to go. A large number of predictors often bring a high level of noise which usually makes it very hard to identify reliable patterns in the data for the models. On the other hand, with very few predictors, it is unlikely that there will be a lot of high probability patterns to profit from. In theory we are trying to minimize the number of predictors for a given accuracy level.

In practice, we usually go from what the theory suggests or discretionary observation to determine what should be included. The quantification of this process is often called Exploratory Factor Analysis (EFA); basically looking at the covariance matrix of our predictors and perform an eigenvalue decomposition. Doing this we aim to determine the number of factors influencing our response (dependant) variable, and the strength of this influence. This technique is useful to better understand the relationships between a predictor and the response variable and determine what predictors are most important when classifying. This type of covariance matrix decomposition is supposed to help us refine our predictor selection and hopefully improve classification performance; this process will be the object of the next few posts.



Season’s Greetings

During this holiday period, I want to thank you all very much for the support you have showed this nascent blog in 2010. The good discussions I have had with reader in the comment section or via email made every minute of the adventure worth it. The good feedback I received exceeded every expectations I ever had for the blog and I hope that 2011 will be just as prosperous for the Quantum Financier blog.

Now to you that take time during this time of festivities to read this post, I wish the best for the holiday period and a very successful year trading and evolving with the markets in 2011.



Market Rewind’s Sentiment Spreads Remix

In this post, I want to build on a good discussion in the comment section of this post: An Intermarket Ensemble Model for the S&P500 Using Market Rewind’s “Sentiment Spreads”. One of ETF Prophet’s contributors and the initial thinker for the spreads, Mr. Pietsch commented on CSS’s use of the sentiment spreads to predict the S&P 500. The part that spiked my interest was the very last question: what can you tell us about improving performance yet again with weak learner methodologies? While originally directed to Mr. Varadi, I felt compelled to try the idea.

The setup layed out in the post linked above is a good candidate for a support vector machine prediction model. You can think of the process as mapping the information contained in the spreads in relation to the ETF tracking the S&P 500. This approach, a weak form of ensemble learning is the next level after single indicator/variable model. Conceptually, one can think of market movements as the aggregation of a high (very) quantity of information and data. Trying to process the market and generate signals using a single raw filter/signal/strategy has a small chance to succeed for a long time without adaptation. Using multi-variables adaptive models/strategies tends to increase the odds in our favour. I would argue that two of the most important variables to take in consideration are price action and inter market effects. Most technical indicator covers the price action angle. These sentiment spreads are a simple way to introduce the other very important part into a quantitative strategy. For now, I will only take these into consideration, but I plan to expand on this and show how we can combine price action and intermarket effects to our best advantage. The following results are from using a \nu-svm classification model trained on the last 100 days of spread. Note that the sample is very small since I wanted to take all seven spreads together, it will be interesting to see how it plays out with more data to our disposition and to test it using intraday data.


Market Neutral Strategy Portfolio

In continuation with last post on market neutrality, this post will look into obtaining market neutrality for a portfolio of strategy. As mentioned in last post, investors can trade many strategies with conflicting signals. For this particular example, imagine an investor that trades two strategies; a RSI2 and the 50-200 moving average crossover on the S&P 500. You can imagine that the signals from these strategies are going to be conflicting. The RSI2 is a really short-term strategy with a high turnover, while the so termed “golden cross” is a polar opposite very slow moving low frequency strategy. Also assume this investor allocate 50% of his capital to both strategy.

Now in this particular experiment, we have that portfolio of strategies and want to short or long some SPY in order to remain market neutral. To accomplish this we will use the commonly used simple linear regression and the slightly more robust quantile regression.

Simply put, we are simply using the portfolio (dependant) and market (independent) returns series to obtain the prescribed hedge ratio approximated by the regression coefficient. Now everyone is likely familiar with the linear regression so I will skip the intro. However the quantile regression is not as mainstream. It simply estimates the tau(\tau)-th conditional quantile regression function, and give the expected value based on the current quantile (tau) of the predictor variables. The premise for using quantile regression is that we expect the regression coefficients to vary depending on the level of the predictor variable. Note that in this experiment I used the linear quantile regression but there exists a non-linear version of it.

The results below are obtained using a 60 days lookback period for the hedge ratio calculation. They represent the equity curves of the portfolio traded with the market neutral long/short hedge as prescribed by the regression coefficient. A note of caution here, doing this will reduce returns however, it also reduces volatility.

I think this result is interesting in a couple of ways. But first I want to look if market neutrality is effectively obtained. As explained in last post, we often say we are market neutral if our beta is zero. Readers that have experimented with this concept know that the beta is never going to be strictly zero, but will oscillate around it. To test whether or not my goal was accomplished I used a simple t-test for the 60 day rolling mean of the observed beta. Alternatively, I could have used a more robust bootstrap test but I wanted to keep things simple. The t-test confirmed that the observed beta was effectively not different from zero and that we obtained theoretical market neutrality with both methods.

To conclude, I was happy the result confirmed my expectation with quantile regression which tested slightly better. I think there is value in the quantile regression when considering market neutrality as an objective for a strategy or a portfolio of strategies. The dynamic linear modelling approach is left to the interested reader.


Market Neutrality

Market neutrality is one of those buzz words thrown around quite a lot in finance; several hedge funds claim their strategies as being market neutral and use it as their main marketing tool. Some quantitative strategies are also oriented towards that goal; pairs trading is a prime example, but one can also include segments of statistical arbitrage in that broad area.

This begs the question why market neutral? To answer this question we must first discuss what market neutrality means. Consider the daily return for a stock i denoted R_i. We can decompose the returns between the market related (systematic) portion F and the stock specific (idiosyncratic) portion \Theta, yielding the following equation:

R_i = \beta_i F + \Theta_i

Which is nothing more than an ordinary least squares regression model decomposing the return of stock i into a systematic component \beta_i F and an idiosyncratic (uncorrelated) component \Theta_i. The market neutrality is obtained by eliminating the systematic portion of the returns, equivalent to say:

\beta_i F = 0


R_i = \Theta_i

Effectively, getting rid of the market exposure and only exposing ourselves to the portion of the return based on stock i specific profile, hence market neutrality. Now back to the initial question: why market neutral? Simply put; we want to make a bet on a security without at the same time betting on the direction of the market. In a relative value strategy like pairs trading where we are betting on the outperformance of securities relative to each other, regardless of where the market goes, market neutrality takes all its sense.

However market neutrality is not only considered in relative value strategies. Imagine an investor trading a portfolio of strategies. The market exposure of this particular investor can be thought as the capital weighted average of the individual strategy betas:

\beta_p = \frac {Q_j}{\sum Q_j} \beta_j

Where Q_j is the dollar amount invested in strategy j.

Keeping in mind the first equation we can also decompose the return of the portfolio in a similar fashion, composed of a systematic and idiosyncratic (strategy ensemble specific) component. In an attempt to obtain market neutrality, one could short (buy) market futures or the corresponding ETF in order to satisfy the second equation, effectively neutralizing the portfolio returns’ exposure to the market.

While this approach does not necessarily improve returns, it has the benefit of potentially better sheltering one against market storms by reducing exposure. Targeting a market neutral approach also has the benefit producing uncorrelated returns. A recent post by Marketsci explain that most investors don’t seem to look for absolute returns, but if you find yourselves in the category that would prefer absolute to relative returns, taking a look at market neutrality may be worth your time. I personally like market neutral strategies and if interest warrants, I could dive deeper into different techniques to obtain market neutrality that I find more reliable than ordinary least squares, like quantile regression.


Why I do Things This Way

I must confess a few things. I started my journey in the investment world as a self-proclaimed value investor. I didn’t know any better and I figured; if it worked for Warren Buffet, it ought to work for me. So I read and read on the subject and a little later I was being introduced to financial theory in school; time vale of money, benefits of diversification and all that jazz. At that point I felt like the planets aligned, making money and the market was easy, we only had to consider companies as a series of future cash flows. I then learned to do fundamental valuation: discounted cash flow models, comparables analysis, financial ratios regression et. al. However it never really did it for me, I was always left with questions unanswered.

Looking for other more attractive venues for me, I was always hearing tales of those mythical investors that could predict the future with a single look at a chart. Looking forward to gain this level of perception, I started looking into visual chart analysis. At first I must say I was baffled by what appeared to be doodles on the chart. I remember that at some point early on someone was trying to persuade me that if my chart was forming a tea cup I found myself a pattern to trade on. I must admit I was perplexed. Nonetheless I stuck through and passed the stage of chart reader and graduated to the indicator stage. Then things started to look more appealing to me, I particularly liked how each indicator would put a specific aspect of a stock price series to the foreground and reducing the noise. However I couldn’t seem to find a way to use these indicators to develop a way to make money. Decidedly reaching the $1M mark before 25 years old was going to be more complicated than I had forecasted when I was younger.

Then one day I came across the blogs on my blogroll; I was hooked. The method used in these blogs just made all the puzzle pieces fit together. They wouldn’t discredit any method per se but would question the methods, the underlying assumptions, and would use an outside the box thinking approach to answer question left unanswered. Rather than being strictly technical or fundamental, they would use quantitative methods to analyse the market and rigorously evaluate phenomenons. This no fad, down to earth and based on the scientific approach was exactly was I was looking for all this time without knowing it. While I am nowhere near the $1M mark, I have grown from an absolute approach trader to a seeing the shades of grey. Instead of looking for the Holy Grail strategy or approach, I now strive to constantly get better and get answers to my questions.

If you are a reader of my blog, I also assume you follow these blogs, and the one true great thing I hope you get away from it is not that new strategy published that scores a 40% annualized return in the backtest, or that awesome new indicator that outperforms this and that. Above all else, I hope that what you get from our blogosphere community is the desire to investigate and to constantly improve your trading. And that my friends, is the only way to succeed; and no fundamental or technical school of thoughts will ever give you that if you just blindly follow it without questioning the underlying principles.


Rotation System à la Quantum Financier

Rotation systems have generated a lot of virtual ink lately see CSS Analytics here, Engineering Returns here, then at MarketSci here for a few examples. I have recently been playing around with the concept but with a very different approach. I figured it might be interesting for readers to hear another approach to a similar problem.

Rotation systems are often based on two very simple concepts: momentum (relative strength) effect and negative correlation. The goal of such models is usually to allocate capital to securities trending on the upside. By selecting securities that are show negatively correlated behaviour we expect the securities to complement each other depending on the regime. For example one could include in the basket of available securities stocks and fixed incomes ETFs with the expectation to be long bond when stocks are not performing and vice-versa. This kind of model basically surfs the beta with the momentum of securities. This approach demands certain considerations when creating the model, and depending on the investor, various degrees of fancy maths are going to be used. When looking at creating such systems, we need to determine the following amongst others:

1. What securities are available and how are they selected?
The negative correlation amongst assets is a desirable feature here. We possibly also could include ETFs with different degrees of leverage to aggressively add beta when the time is right. Then we can select them based on heuristic, macroeconomic relationship, data mining etc.

2. How is momentum measured and ranked?
It could be using a simple normalized difference between prices of different time frames or a rate-of-change indicator. The RSI , DVO or TSI indicators are also good candidates. Alternatively you could fit a least square model and evaluate slope and residuals. You could also do some kind of factor decomposition and create a factor model to forecast momentum.

3. How do we allocate capital across securities?
A simple equal cash position could be used or we could use volatility to adjust the weight amongst securities. Mean-variance optimization with certain tweaks to it would perhaps make a good candidate.

4. How often do we recalibrate the strategy?
Most TAA systems recalibrate monthly and some rotation systems trade on a weekly time frame. The trick is to minimize the transaction cost while still capitalizing on the uptrend of selected securities and mitigating the drawdown. The appeal of such systems is usually their risk adjusted performance and we would not want to compromise it.

5. Do we consider alternative/innovative metrics in the system?
Michael at Marketsci recently talked about taking correlation during market shocks into considerations. This type of innovative approach seemed to work quite well for him, and really here sky is the limit. We only have to balance complexity and quality.

Without spoiling the next post, I can say that my rotation system will be very different from anything discussed so far on the blogosphere (as far as I am aware). Instead of using historical relative strength we will see how we can use machine learning classification and select securities using the forecast. I will also try to incorporate new metrics to help with system performance.