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.

QF

December 27, 2010 08:09

I am a bit confused what your are doing here. Is this simply a classification model where your training input is up day (1 or -1) on spreads? Is there any transformation on spreads? Also, do you weight positions in any way by estimated probabilities?

Good luck with everything.

• December 27, 2010 11:34

Hey Rey,

There is no transformation on the spread, the svm function in R ranks them internally. The targets during the learning periods are a 1,-1 classification. And no, I do not rank the positions by training accuracy, though if I was to trade the model, I certainly would.

Regards,

QF

December 31, 2010 02:35

Which package do you use to generate all of the statistics on the trade. I’ve been trying to work with blotter, but I think there are problems with the latest version. Would you be willing to share which tools you use? Thanks.

• December 31, 2010 10:13

Most of it is PerformanceAnalytics, but some are trickier and I have to loop through the signals and generate the transactions (same as blotter, but less elegant). I think quantstrat is coming out equipped to handle those, and if I am not mistaken the tradeStats (not sure there) function should give you a lot of them in the near future.

Best,

January 1, 2011 18:59

Great looking tables !

Are the table graphics actually produced in R or are you generating the statistics and then copying and pasting them into some other software tool (like Excel) ?

• January 1, 2011 19:42

Hi Eric,

Everything is produced in R and exported to an excel file after for final formating, column width and conditional color formating, etc.

Cheers

4. June 21, 2012 10:11

QF,

Love the blog. I’m having trouble understanding the arithmetic behind the sentiments. I can’t quite reproduce the first 5 sentiment chart on http://cssanalytics.wordpress.com/2010/09/19/creating-an-ensemble-intermarket-spy-model-with-etf-rewinds-sentiment-spreads/. I can easily get favorable results, but I’d like to understand exactly how it works.

Example:

Consumer Sentiment XLY-XLP
All prices are closing prices.

Rxly = ln(XLY(t)/XLY(t-1))
Rxlp = ln(XLP(t)/XLP(t-1))
ConsumerSentiment: Rxly-Rxlp

This seems wrong.

Or:

ConsumerSentiment: ln( XLY(t)/XLP(t) ) / ln( XLY(t-1)/XLP(t-1) )