Friday, April 13, 2012

Mebane Faber Tactical Asset Allocation in R

In 2006 Mebane Faber published a great piece of research detailing an asset allocation system that was both very easy to understand and implement, as well as carrying very respectable risk adjusted returns.

The details are available in his paper A Quantitative Approach to Tactical Asset Allocation and were further expanded on in his book The Ivy Portfolio both of which are must reads.

The short version is to use diversified asset classes, long only, and only long when the price is above the 10 month simple moving average (approx 200 day). The assets he tests are U.S. Stocks, International Stocks, U.S. Government Bonds, Commodities and Real Estate, accessible via ETFs.

A rotational extension can also be added by investing only in the top 1-3 asset classes showing some degree of relative strength, which is defined as the average of 3, 6 and 12 month returns. They must also be over the 10 month SMA to be candidates.

The system updates monthly at the end of the month, it is about as hands off as you can get for active management.

There is an ETF for those so inclined, GTAA, but I am experimenting with a put selling implementation, which I might start tracking here month to month. I wrote a small R script using quantmod to display the relevant information for given symbols, which should be available here: Tactical Asset Allocation R script

The output looks like this:


  Sym         R3m         R6m        R12m  Close     AvgRet OverMA
4 VNQ  0.09295631  0.22412597  0.08488552  63.65 0.13398927   TRUE
1 VTI  0.11671109  0.22466699  0.05037598  72.26 0.13058469   TRUE
2 VEU  0.10908623  0.13282091 -0.10915250  44.22 0.04425155   TRUE
5 DBC  0.07048208  0.11194076 -0.05767911  28.80 0.04158124   TRUE
3 IEF -0.02193049 -0.01718305  0.10473673 103.28 0.02187440   TRUE


Let me know if you have any comments or find any bugs. 

4 comments:

  1. Hi Pete,
    Very nice job.
    I am not very familiar with R language. How would change your code to get these results on adjusted data (for dividends, splits...)?
    Raphael

    ReplyDelete
    Replies
    1. hey there!

      throughout the script you can see various calls to Cl() which gives the close prices for the given series. If you change them to Ad() it will use the adjusted close prices. See the help page help(Cl) for more info.

      Delete
  2. Thanks for the fix Pete.
    Here are the results of the original code vs the mod :

    non adjusted data
    Sym R3m R6m R12m Close AvgRet OverMA
    1 VTI 0.099667485 0.09463106 0.11368448 80.96 0.102661009 TRUE
    4 VNQ 0.069418313 0.08211253 0.10263883 70.53 0.084723222 TRUE
    2 VEU 0.013245227 0.07616757 0.04725984 46.36 0.045557546 TRUE
    3 IEF -0.001396453 -0.01038007 0.03855762 107.34 0.008927031 FALSE
    5 DBC -0.017063402 -0.04894708 -0.05312245 27.31 -0.039710978 FALSE

    adjsuted data

    1 VTI 0.104180931 0.106514013 0.13550963 80.96 0.11540153 TRUE
    4 VNQ 0.077046115 0.101853589 0.13862832 70.53 0.10584267 TRUE
    2 VEU 0.016310028 0.091177231 0.08036631 46.36 0.06261786 TRUE
    3 IEF 0.001026742 -0.002608778 0.05552987 107.19 0.01798261 TRUE
    5 DBC -0.017063402 -0.048947080 -0.05312245 27.31 -0.03971098 FALSE


    Running the two versions give slightly different results on average returns. In practice in that case it does not make any difference if you keep the top 2 ETFs. But including dividends might make a difference in other cases. Look for example at IEF that is either above or below its MA. Don't you think it's better to run this strategy on adjusted data?

    Have you done backtests in R on this portfolio? Do you know how it performed during 2008?
    You wrote this post a year ago. Did you track the live performance since then?

    ReplyDelete
    Replies
    1. Hey

      Yes in general you should account for dividends and return on cash when you have no positions, neither of which I do in this example. I'm not sure off the top of my head if the moving average calculation should be done on the adjusted prices or not.

      I haven't done any backtests because there were some exhaustive tests done by Mebane Faber in his paper and book. He tracks the strategy here http://www.mebanefaber.com/timing-model/ which has a link to the original paper, I think he updated it post 2008 as well. He also has an ETF for it GTAA http://finance.yahoo.com/q/bc?s=GTAA&t=2y&l=on&z=l&q=l&c=

      You could also take a look at his faq page for some discussion around the practicalities of reproducing his exact results http://www.mebanefaber.com/faq/

      Delete