Publications by Zach Mayer

Recession forecasting II: Assessing Hussman’s Accuracy

22.08.2011

In my last post on recessions, I implemented John Hussman’s Recession Warning Composite in R. In this post I will examine how well this index performs and discuss how we might improve it. If you would like to follow along at home, be sure to run the code from the last post, before running anything from this post. First of all, le...

2215 sym 8 img

Graphically analyzing variable interactions in R

23.08.2011

I studied Ecology as an undergraduate, which meant I spent a lot of time gathering and analyzing field data. One of the basic tools we used to look for relationships in a large set of variables was correlation and scatterplot matrices. Each of these requires a single line of code in R: The ‘pairs’ function in R contains a lot o...

2563 sym 14 img

Because it’s Friday: Spurious correlation edition

26.08.2011

If the Flight of the Concords taught me anything, it’s that you can’t trust Australians. This morning I was poking around the DataMarket site, when I noticed something suspicious about Australian sheep production: I decided to investigate further: just what are the Australians doing with all those poor sheep? How might this nef...

1791 sym 10 img

25+ more ways to bring data into R

26.08.2011

The rdatamarket post on the Revolutions blog and this post on Decision Stats reminded me about my list of Data APIs/feeds available as packages in R on Cross-Validated (which is a great site that you all should use).  Many of these packages are from Omega Hat, which is an awesome site. This is the most comprehensive list I’m awa...

2009 sym 8 img

Backtesting a Simple Stock Trading Strategy

13.09.2011

Note: This post is NOT financial advice!  This is just a fun way to explore some of the capabilities R has for importing and manipulating data.   I recently read a post on ETF Prophet that explored an interesting stock trading strategy in Excel.  The strategy is simple: Find the high point of the stock over the last 200 days, and count the nu...

3569 sym 16 img

Correlations among US Stocks: Is it really time to fire your adviser?

15.09.2011

Note: This post is NOT financial advice!  This is just a fun way to explore some of the capabilities R has for importing and manipulating data. The Financial Times says it’s time to “Fire your Adviser” because correlations among US stocks are at their highest levels since the financial crisis.  Unfortunately, they only provide data goin...

1981 sym 12 img

Backtesting Part 2: Splits, Dividends, Trading Costs and Log Plots

16.09.2011

Note: This post is NOT financial advice!  This is just a fun way to explore some of the capabilities R has for importing and manipulating data.   In my last post, I demonstrated how to backtest a simple momentum-based stock trading strategy in R.  However, there were a few issues with my implementation: I ignored splits, dividends and transac...

2582 sym 22 img

Recession forecasting III: A Better Naive Forecast

20.09.2011

In Recession Forecasting Part II, I compared the accuracy of Hussman’s recession forecasts to the accuracy of a naive forecast that assumed the current state of the recession variable would continue next month. An anonymous commentator pointed out a great error in the naive forecast, which is that the BACKDATES their recession ...

2240 sym 8 img

Backtesting a Simple Stock Trading Strategy: Part 3

17.10.2011

Note: This post is NOT financial advice!  This is just a fun way to explore some of the capabilities R has for importing and manipulating data.   In a previous post, I examined a simple stock trading strategy: Find the high point over the last 200 days, and buy the stock if it’s been less than 100 days since that high.  Otherwise, have no p...

4103 sym 10 img

Backtesting Part 4: random strategies

21.10.2011

Note: This post is NOT financial advice!  This is just a fun way to explore some of the capabilities R has for importing and manipulating data.   In part 2, we found that our 200-day high, hold 100 days strategy yielded average annual returns on the S&P 500 index of 7% in a backtest going back to 1950.  That’s pretty good, but it’s entire...

1737 sym 10 img