Monday, February 13, 2012

Ideas from a psychologist

I have just finished reading Daniel Kahneman's bestseller "Thinking, Fast and Slow", and found it full of inspirations important for traders. This is no surprise, of course, since Kahneman won the 2002 Nobel prize in economics for his work on decision theory. Here are some of the notables:

1) Simple sum is often better than a linear regression fit. Remember my constant mantra that "simpler is better" when building trading models? I have always advocated linear regression over nonlinear models, but Kahneman went a step further. He said that in social science modeling (which of course includes financial markets modeling), assigning equal weights to the predictive factors is often superior to weighting them using multivariate linear regressors when applied to out-of-sample data.

2) Overconfidence in corporate acquisitions. Managers of acquiring companies often believe that they are better than the managers of acquirees. This overconfidence has several causes: there is an illusion of control which overemphasizes the role of skill and neglects the role of luck, and there is a focus on what one knows and a neglect of what one does not, etc. The market already knows this: the stock of the acquirer usually suffers a sell-off upon announcement of the acquisition, because the result of any acquisition is more often bad than good, but the question is whether it has sufficiently discounted this phenomenon. Would shorting the stock of an acquirer at the completion of an acquisition and holding the short position for, say, 5 years, hedging this position with SPY, be profitable?

3) Premortem. After designing a trading strategy, it is always useful to write a brief imaginary history of how it has become an unmitigated financial disaster for you a few years from now. This will likely reveal scenarios that you have not previously thought of, and triggering additional risk management measures.

4) Risk seeking in the face of losses. Suppose you are running a strategy that has a fixed holding period. Have you ever extended this holding period when the position is losing, in the hope that the position will recoup some of its losses? I have, and the result was double the loss I would have suffered had I exited on time. Apparently this is a very common suboptimal behavioral bias: this is why many defendants with a weak legal case often risk continued litigations instead of accepting an unfavorable settlement.

5) Why do we often demand Sharpe ratio  >=2? Psychological experiments have shown that people find the pain of losing $1 can only be compensated by the pleasure of winning $2. So if we equate standard deviation as the average drawdown of a strategy, then we need to have twice the average return!

Many businesses have profited from arbitraging the difference between rational decisions and biased decisions that people commonly made. (For e.g. lottery franchises benefit from people overweighting the probability of winning, sellers of extended warranties benefit from buyers' risk-aversion.) I wonder if there are still opportunities left for rational traders to take advantage of the biased decisions of irrational traders?

48 comments:

  1. Your last point is very interesting. Is it possible that that's the *only* source of real trading opportunities - and always has been? Even when a trading seems seems to be taking advantage of random fluctuations, perhaps the only fluctuations that are actually profitable are those which were caused by some traders acting on their irrational biases.

    ReplyDelete
  2. I think you first point is especially relevant. In-sample testing is pretty much worthless in any domain, particularly finance.

    ReplyDelete
  3. Ernie, it is refreshing to read that you really emphasize simplicity. My experience also strongly favors simple models/signals. I believe too many are lured into complex solutions, believing "the harder-the better". Overfitting is easy to do.

    My models simply consists of equal-weighted signals and OLS regressions. Not very fancy econometrics but they produce results!

    ReplyDelete
  4. Forgive me If I go off on a bit of a tangent. I am a self taught amateur (playing with my own money) and this blog is as close as I come to being plugged into a quaint community. I tend to reinvent a lot of wheels… I haven’t seen or read much about creating synthetic stock data to run through our backtest models. By synthetic I mean randomly generated data that has the same statistical properties as some underlying real stock data. The essential utility of such data is that it is not predictable by design. Using daily data as an example, what happens tomorrow, has nothing to do with what happend today, so any model that attempts to sort some signal from the noise should fail. If you run such data through a backtest model and it produces a gain (as they often will) you know that it is a false gain, AKA data snooping, overfitting, or what I call optimization bias. Since you can create an infinite amount of such data you can average out the noise and characterize things very precisely. For example, if you want to know how your model reacts to long term trends in the analysis data set, you can really nail it down. Likewise you can precisely answer questions like, what happens if I optimize in an up trend and then find myself trading in a down trend? My favorite use is to characterize my “strategic edge”. If, for example, I have a model based on 500 stocks and a years worth of daily data, and I measure its performance in terms of total return, draw down, sharp ratio, or whatever, then I load that model with multiple synthetic data sets having the same, stock by stock, long term trend, the difference in performance between the real data and the synthetic data is my strategic edge. Given enough data, I can calculate this quite accurately. I can also use the randomly generated data to create “alternate realities” and gain some idea of how variable my future returns might be, which finally gives me a way to know if my trading reality is just lucky/unlucky or a good/bad strategy. All this ties back to the original post in relation to the simplicity of models and the danger of overfitting. It is so very hard to know when you are making progress or just fooling yourself without tools of this sort. So has anyone done any work in this area?

    ReplyDelete
  5. R.D.
    I congratulate you on your thoroughness in running your strategy through simulations. I haven't done this myself, because I seldom optimize my models beyond picking a couple of sensible parameters. Do you find your approach to be better than just testing your model on a rolling out-of-sample dataset?
    Ernie

    ReplyDelete
  6. Ernie,

    I hesitate to say that simulation with synthetic data is “better”. In theory it should be, but in practice, how would I prove such a thing? I don’t have dozens of models with years of simulations and corresponding real life data to compare. I will say that simple out-of-sample testing strikes me as a very poor solution, that is still vastly better than not doing out-of-sample testing, Even in-sample testing often shows a few months where a model will do well, and then several months where it is treading water. If you extend that into out-of-sample testing there is no way to know whether you are looking at a good or bad “micro regime” or perhaps your model just doesn’t work very well. It seems in real life, there is never enough data to really know much. At best, you get a sense of what might be true. I think most of us, including myself, are forced to give in to “fast thinking” and put some money at risk. That leads to all manor of self induced mind games, like the strategy that isn’t working very well, but “I just fixed it and now I expect it will do much better…” or “I just hit a string of bad luck…” or “I don’t see the need of more analysis, I already know it works, and now I just want to make some money”. I keep striving for solid proof of a good strategy. Synthetic data is as close as I have come to proof, but the devil, as always, is in the details.

    My models are all self optimizing, what I think you would call “parameterless”. They have parameters, but I don’t set them, they set themselves based on what works best for historical data. I have done rolling out-of-sample testing but it is really tedious. Synthetic data is actually much faster and easier. I also work in Excel, not the best tool perhaps, but the one I know. Computer power is a constant limitation. Anything that eases that limitation is a good thing.

    ReplyDelete
  7. Everyone,

    Buy "Thinking, Fast and Slow" ! Fantastic book. For trading and for life. I just need to read this book twice to better understand my choices.

    R.D.,

    I didn't try what you did but I doubt that its much more powerful than out of sample results. I think the limitation will come from the generation of the data. How do you choose the parameter which generate your data ? These parameters has to be deduced from the data. Maybe you get confidence interval of your P&L given your data parameters ? Or you can measure the impact of new parameters on your P&L ?

    I believe the main limitation of p&l on out of sample data is that the relationship observed on the data are not stable. Do anyone has a way of measuring the instability of a model/trade ?

    ReplyDelete
  8. Ken, Yes, the parameters of the synthetic data are derived from real stock data. For example, the percentage change from one days close to the next forms a distribution with a mean, standard deviation, and a shape which is approximately Gausian. The mean is the average change per day, and directly relates to the long term trend over the analysis period. It is fairly simple to create an equation in Excel using the RAND() function that produces approximately the same mean, standard deviation and distribution shape. The somewhat surprising thing is that this equation sometimes produces time sequences that are vastly different from the original real stock data. If for example, the real stock had a long term trend of -5% over the data analysis period, the synthetic data equation will sometimes product data with a trend of 50%, or -50%. These are the alternate realities of which I spoke.

    Yes, I get the confidence interval (standard deviation) of my P&L (or my Sharp Ratio, etc.) by running synthetic data through my models. The alternate future realities are based on actual past reality. Obviously the future can and will be different from the past, not only in the specifics, but also in the general statistics. Sooner or later some exogenous event will drive some major change, but in the mean time the past is the best window we have for seeing the future.

    Yes, I can modify the parameters that generate my synthetic data and observe the result on my models. For example, I can create data with any long term trend I like and characterize the performance of my models in a bull or bear market. I can also see what happens when I am optimized for a bull market and then find myself trading in a bear market, etc.

    In theory, this technique gives you the “way to measure the instability of a model/trade” that you requested. Simply run your models with the many alternate realities that the synthetic data equations generate and characterize the variability of the results (P&L, Sharp Ratio, draw down, etc.).

    ReplyDelete
  9. Ken, Yes, the parameters of the synthetic data are derived from real stock data. For example, the percentage change from one days close to the next forms a distribution with a mean, standard deviation, and a shape which is approximately Gausian. The mean is the average change per day, and directly relates to the long term trend over the analysis period. It is fairly simple to create an equation in Excel using the RAND() function that produces approximately the same mean, standard deviation and distribution shape. The somewhat surprising thing is that this equation sometimes produces time sequences that are vastly different from the original real stock data. If for example, the real stock had a long term trend of -5% over the data analysis period, the synthetic data equation will sometimes product data with a trend of 50%, or -50%. These are the alternate realities of which I spoke.



    Yes, I get the confidence interval (standard deviation) of my P&L (or my Sharp Ratio, etc.) by running synthetic data through my models. The alternate future realities are based on actual past reality. Obviously the future can and will be different from the past, not only in the specifics, but also in the general statistics. Sooner or later some exogenous event will drive some major change, but in the mean time the past is the best window we have for seeing the future.



    Yes, I can modify the parameters that generate my synthetic data and observe the result on my models. For example, I can create data with any long term trend I like and characterize the performance of my models in a bull or bear market. I can also see what happens when I am optimized for a bull market and then find myself trading in a bear market, etc.



    In theory, this technique gives you the “way to measure the instability of a model/trade” that you requested. Simply run your models with the many alternate realities that the synthetic data equations generate and characterize the variability of the results (P&L, Sharp Ratio, draw down, etc.).

    ReplyDelete
  10. It's great to see you making a success out of quantitative trading. What returns have you been making annually taking into account all your trades?

    ReplyDelete
  11. Hi Anon,
    My personal return was over 90% in 2011.
    Ernie

    ReplyDelete
  12. Hi Ernie,
    Thanks for the great book and blog. I am working as a Quantitative research associate and have been looking for starting my own algorithmic trading. After getting dejected as everyone told me that algorithmic trading is not possible for retail traders, your book came as a great reference. I am planning to start trading in India on NSE and as I’ve already suffered a lot of losses in directional trades during my college days, want to explore hedged strategies now (beta neutral, dollar neutral strategies or employing derivatives only). As stock borrowing is not possible I’ll have to trade mostly in futures if I want to carry over my short positions.
    I have planned a strategy with Nifty Futures and Options and looks to be profit making generally, but what bothers me is if it is so simple why others didn’t recognize it. Currently Nifty is trading at 5564 and the March Futures are trading at 5625. Nifty 5600 and 5400 Put options are trading at 153 and 86.7. Nifty 5700 call option is trading at 131.15 If I go long on Nifty March Futures and 5600 Put and go short on Nifty 5400 Put and 5700 Call, my net premium inflow is 65. Buy this hedged strategy I cap my profits to a max increase in Nifty to 5700 but hedge my self against any downfall. Is there anything that I am missing in this strategy, or is it that simple that all the techno traders missed it.
    I know, it would be asking for too much, but would you suggest any strategies that I should consider especially for the India Markets?

    Bhavik

    ReplyDelete
  13. I am a huge fan of Kahneman's myself. His ideas can be applied to anything that can be statistically tested- including the statistical test itself.

    I only trade options but Khaneman's ideas on options trading are even more relevant- especially since I do sell options.

    I've been an avid reader of your site for a long time and your posts are just wonderful to read.

    Keep the posts coming Dr. Chan and congrats on a very successful year.

    ReplyDelete
  14. Hi Bhavik,
    I am not familiar with the Indian market, so I can just make some general comments: just because a strategy looks obvious doesn't mean that it won't work. Probably others are trading it, just that the irrational traders outnumber the rational ones so the opportunity is still there!
    If you are not sure, why not paper trade your strategy for a while? Or trade in small size?
    Ernie

    ReplyDelete
  15. Thanks Erinie, will try trading with small amount to see if it really works:)

    ReplyDelete
  16. Dear All,

    This post is not related to "Ideas from a psychologist" but I didn't find a better place.

    I d like to open a subject on operational risk. I trade for one year and I hope I will begin to trade for my family/friends soon. I feel very anxious on making a big blunder by miss-executing a trade.

    Let's make a list of some operational risks (if you have more ideas) :
    - Trading the wrong quantities
    - Executing only one leg in spread generating an unexpected huge directional risk
    - Trading near the future expiry and being kicked out by your broker
    - Hedging FX risk in the wrong way
    - Missing that a trade has been executed
    - Loosing your internet connection
    - Loosing consciousness without anyone to exit your trades
    etc..


    Do you have any idea to limit these operationals risks ?
    How do you manage these risks ?

    Thanks,

    ReplyDelete
  17. Bhavik,

    It profits if market stays anywhere above 5363. Max Profit is if Nifty moves to 5700(anything higher does not yield any additional profits).

    Pic of the profitability. White line represents profit

    http://twitpic.com/8m1v4z

    ReplyDelete
  18. Ken,
    Let me address a few of the operational risks you raised:

    1) Trading the wrong quantities.

    In IB, you can set the maximum order size for each type of securities.

    2) Executing only one leg in spread generating an unexpected huge directional risk.

    You can run a second program that monitors whether the positions are always hedged. If not, send a text message to you.

    3) Trading near the future expiry and being kicked out by your broker

    IB will warn you several days before futures expiration date. You can also program the expiration date into your strategy to automate rollover.

    4) Hedging FX risk in the wrong way

    Not sure what it means exactly?

    5) Missing that a trade has been executed.

    You can monitor positions in addition to trade executions.

    6) Loosing your internet connection

    Host your program at a data center that has a up-time guarantee.

    7) Loosing consciousness without anyone to exit your trades

    Shouldn't liquidation be automated by your program?

    Ernie

    ReplyDelete
  19. Hi Dr. Chan, I just downloaded the IB API just to test it out with the IB paper trading account that I have. Like I said before I only do options but I'm sure I could use the API for something.

    Should I go with java or should I try to implement a MATLAB interface? The latter is my preference but seems daunting because it seems like I'd have to have my own classes in place to call as handles from within MATLAB?

    Can you point me to a cheap open source codebase that has something developed for Matlab to IB? I wanna learn how they go about doing so.

    I'll be applying for jobs soon so it'll be handy to have a "use a self developed IB API interface for my own trading strategies" in my resume.

    ReplyDelete
  20. Babu,
    You can certainly use the IB API to trade options.

    You can search for a free IB API on Matlab's file exchange. E.g. someone there mentioned leptokurtosis.com

    Ernie

    ReplyDelete
  21. Prashanth: Thanks for the profitability pic. What software do you use to plot this?

    ReplyDelete
  22. Thanks for a great blog.

    I am currently working on a pairs trading strategy across many different pairs. How do you decide the optimal portfolio weight for each pair??

    Thanks,
    Paul

    ReplyDelete
  23. Paul,
    You can use the Kelly allocation method described in example 6.3 of my book.
    Ernie

    ReplyDelete
  24. Hi Ernest,

    Possibly this isnt the right thread to ask but I hope you can answer,

    When looking at pairs trading, why do we look at the spread instead of the ratio?

    If you look in a graph, ratios tend to deliver a better picture of how mean reverting a pair is. If you look at a spread, the spread might be 5 today, increase to 50 in a year but the ratio might still be the same, ie Price A = 10, Price B = 5 in Year 1, Price A = 100, Price B = 50 in Year 2. In both cases the ratio is 2.


    Regards,
    Henry

    ReplyDelete
  25. Thanks Ernie.

    I looked at your derivation in the appendix in Chapter 6 of your book.

    The Kelly weight is basically the portfolio weight stemming from a simple mean-variance optimization for an investor with logarithmic utility (risk aversion=1).

    Is this correct? Does the Kelly formula only hold for logarithmic investors?

    Thanks, Paul

    ReplyDelete
  26. Paul,
    Yes, under the assumption of normal distribution of returns, the Kelly formula agrees with the mean-variance formula for allocations. However, no utility curve was assumed in the Kelly derivation, and if you don't assume normal distribution, the result will be different. It is best if you go to Ed Thorp's website to look at the original paper if you are interested in the theoretical foundation.
    Ernie

    ReplyDelete
  27. Hi Henry,
    Trading ratios implicitly assumes that log(price1)-log(price2) is stationary. But the most general stationary (cointegrating) relationship between 2 price series is price1-hedgeRatio*price2. So I prefer to run the cointegrating test on the difference instead of ratio.

    If the spread goes from 1 to 50, but never mean-revert back to 1, then the pair won't be considered cointegrating, and is not a suitable candidate for pair trading on a long time frame. But it might still be a good candidate for short-term mean reversion. So for some pairs which are not strictly cointegrating, trading ratios may yield as good (or better) results than trading the spread.

    Ernie

    ReplyDelete
  28. Quality post and comments, as always.

    When it comes to "simpler is better" - I would add another aspect.

    When trading the FX market, momentum strategies are preferred over mean reversion (this was also mentioned in an earlier post here).

    I think in this case, a signal-generating algo based on e.g. a simple MA crossover that has a positive mathematical expectancy is a way to go, if you have a proper money management strategy in place (correct bet sizing, cutting losses early and magnifying winners).

    One can try to optimize the signal-generating algo but that is all done on histo data whilst we are trying to take advantage of future price movements.

    I think the point is to win more when you are winning than what you loose when you are loosing and probably fine tuning the money management strategy can help.

    How do you see this aspect? Appreciate if you can point me to any post on this blog, book or whatever that deals with this topic.

    Cheers,
    Drew

    ReplyDelete
  29. Drew,
    I am not sure that momentum strategy is necessarily better than mean-reverting strategies in the FX market, except for the ease of managing risk in momentum trading.

    With regard to momentum strategy, I agree that we should not have a profit cap in general, so that is in agreement with your point about "winning more" when one is winning, but one should have a stop loss, so that limits your losses when losing.

    In terms of money management, I believe we can't do much better than Kelly formula, or if you want to limit drawdown, then practice CPPI. Both concepts are discussed on this blog (please use my search box to find them).

    Ernie

    ReplyDelete
  30. Hi Ernest,

    Must say an interesting blog indeed. Must say you are an inspiration to someone like me.

    I, myself had run equity pairs trades in Asia. Although you seem to employ full quantitative methods,
    I was doing it on both qualitative and quantitative. Qualitative to check the fundamentals are strong. Quantitative on the trading side.

    Asia has lots of opportunities in pairs trading with the prevalent holding company structures, groups like "keiretsu" and "chaebol" in Japan and Korea respectively, and also how certain countries try to promote a certain sectors. Ie car industry in Japan, semiconductor in Taiwan and etc.

    I have just started to blog on merger arbitrage deals in Asia Pacific.

    www.mergerarbinasia.blogspot.com

    Check if out if you are interested.
    I have linked you in my page as your site has proved to be a very good source of knowledge for beginners and professionals. I have also ordered your book. Been thinking of starting trading on my own capital but I guess transaction cost has always been a big worry for me. (not much capital)

    Thank you.

    ReplyDelete
  31. Hi Ex-Hedge fund,
    Thank you for your insight about M&A in Asia, and link to your blog.

    Have you observed whether the acquirer of companies suffer a long-term (5 year?) under-performance relative to the index, as measured by the closing price after the announcement?

    Ernie

    ReplyDelete
  32. Hi Ernest,

    Anecdotally, for deals in Asia, I generally do not observe this under performance in smaller and mid sized deals. In some cases, I have even witnessed a company going through 3 takeovers in 2 years and outperform the market.

    However, I do notice, well not on a 5 year period, more like 2-3 years, for most big cap company taking over another big cap/mid cap, the share price of the acquirer tends to underperform the market. This might be due to the fact that they are required to pay a bigger premium for these established companies and to get management support of the target company.

    But these are just from my observations, don't have numbers to back them. Probably some other factors might have caused the underperformance/outperformance ie was it a vertical/horizontal takeover, the type of industry, macroeconomic environment. I believe the macroeconomic environment plays a huge factor as in 2006, I witnessed an huge amount of deals involved in bidding wars thus payoff was good for risk arb traders. But when things sour up in 2007, these companies( the acquirers) were punished by paying such high multiples for them.

    On another note, I ll keep in mind your original question and try to compile some numbers from my previous risk arb book

    ReplyDelete
  33. Hi Ernie,

    You mentioned somewhere that you dont usually estimate the mean term in OLS regressions when finding the optimal hedge ratio.

    But excluding the intercept leads usually to a drastically different beta coefficient, i.e. a different hedge ratio.

    Have I understood this correct or am I confused?

    Thanks for an interesting blog,
    Jamie

    ReplyDelete
  34. Hi Jamie,
    Sure, if you assume the intercept is zero, you will get a slightly different hedge ratio. But I maintain that this hedge ratio is better (more robust estimate) because the lower dimension of the parameter space.
    Ernie

    ReplyDelete
  35. Thanks for your answer Earnie.

    But the beta coefficient is usually highly statistically significant in both cases (with or without intercept), and that's what matters for the hedge ratio. One can then ignore the intercept when computing the residual since we are standardizing it anyway in a pairs trade.

    The beta with and without intercepts are just different objects.

    Have you found that omitting the intercept outperforms strategies including the intercept?

    /Jamie

    ReplyDelete
  36. Jamie:
    Yes, hedge ratio without intercept generally outperforms one with an intercept.
    Ernie

    ReplyDelete
  37. Ok, so that's interesting since leaving out the intercept implies a quite grave model misspecification.

    Also, the intercept is typically highly significant when regressing prices onto prices (as opposed to using returns which implies more noise).

    Anyway, I'll see if I can do some work on why such a (mis-specified) model outperforms.

    Thanks,
    Jamie

    ReplyDelete
  38. Hi Ernie,

    I am working on some pair trading ideas. I tend to use closing prices in my research.

    Is there any point in moving to intraday returns when backtesting? Do regression coefficients or speed of mean reversion change materially when using for example 1-minute returns?

    /Zach

    ReplyDelete
  39. Hi Zach,
    No, there is no benefit in using intraday prices for regression fit. However, if you are trading pairs intraday, then of course you need to use intraday prices for backtesting.
    Ernie

    ReplyDelete
  40. OK, got it. Would you say the potential for large Sharpe ratios is greater when pairs trading intraday? I am thinking more independent bets with faster mean reversion yields better risk-return tradeoff.

    /Zach

    ReplyDelete
  41. Zach,
    Sure, if you can find intraday trading opportunities, they typically have higher Sharpe due to the reason you mentioned.
    Ernie

    ReplyDelete
  42. Ernie,

    Great blog. I bought your book and enjoy this site.

    You mentioned you had a personal return over 90% in 2011. Outstanding.

    I was wondering if you could share general details.

    Based on my reading, I think you like mean reversion over momentum strategies. In general, how much of the return was from mean reversion vs momentum (or any other strategy)?

    You also write a lot about pair trading. In general, how much was from pair trading strategies?

    Thank you and great job!

    ReplyDelete
  43. Anon,
    Thanks.
    Most of that return is from running a mean-reverting strategy on FX.
    Ernie

    ReplyDelete
  44. Hi Ernest

    You mentioned most of your 2011 return is from running a mean-reverting strategy on FX. Are you employing the similar strategy taught from your book, which currency pairs performs the best?

    Thx

    ReplyDelete
  45. Hi Anon,
    The basic techniques are similar. But of course, the devil is in the details!
    Ernie

    ReplyDelete
  46. Hi Ernie -

    Which mean-reverting strategy in your book are you referring to? Pages 61 to 65? This would be similar to Amir Khandani and Andrew Lo's but on FX pairs?

    Appreciate the feedback.
    Shal

    ReplyDelete
  47. Hi Shal,
    No, I was referring the Bollinger band strategy on GDX vs GLD.
    Ernie

    ReplyDelete