# Are R^2s Useful In Finance? Hypothesis-Driven Development In Reverse

**R – QuantStrat TradeR**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This post will shed light on the values of R^2s behind two rather simplistic strategies — the simple 10 month SMA, and its relative, the 10 month momentum (which is simply a difference of SMAs, as Alpha Architect showed in their book DIY Financial Advisor.

Not too long ago, a friend of mine named Josh asked me a question regarding R^2s in finance. He’s finishing up his PhD in statistics at Stanford, so when people like that ask me questions, I’d like to answer them. His assertion is that in some instances, models that have less than perfect predictive power (EG R^2s of .4, for instance), can still deliver very promising predictions, and that if someone were to have a financial model that was able to explain 40% of the variance of returns, they could happily retire with that model making them very wealthy. Indeed, .4 is a very optimistic outlook (to put it lightly), as this post will show.

In order to illustrate this example, I took two “staple” strategies — buy SPY when its closing monthly price is above its ten month simple moving average, and when its ten month momentum (basically the difference of a ten month moving average and its lag) is positive. While these models are simplistic, they are ubiquitously talked about, and many momentum strategies are an improvement upon these baseline, “out-of-the-box” strategies.

Here’s the code to do that:

require(xts) require(quantmod) require(PerformanceAnalytics) require(TTR) getSymbols('SPY', from = '1990-01-01', src = 'yahoo') adjustedPrices <- Ad(SPY) monthlyAdj <- to.monthly(adjustedPrices, OHLC=TRUE) spySMA <- SMA(Cl(monthlyAdj), 10) spyROC <- ROC(Cl(monthlyAdj), 10) spyRets <- Return.calculate(Cl(monthlyAdj)) smaRatio <- Cl(monthlyAdj)/spySMA - 1 smaSig <- smaRatio > 0 rocSig <- spyROC > 0 smaRets <- lag(smaSig) * spyRets rocRets <- lag(rocSig) * spyRets

And here are the results:

strats <- na.omit(cbind(smaRets, rocRets, spyRets)) colnames(strats) <- c("SMA10", "MOM10", "BuyHold") charts.PerformanceSummary(strats, main = "strategies") rbind(table.AnnualizedReturns(strats), maxDrawdown(strats), CalmarRatio(strats))

SMA10 MOM10 BuyHold Annualized Return 0.0975000 0.1039000 0.0893000 Annualized Std Dev 0.1043000 0.1080000 0.1479000 Annualized Sharpe (Rf=0%) 0.9346000 0.9616000 0.6035000 Worst Drawdown 0.1663487 0.1656176 0.5078482 Calmar Ratio 0.5860332 0.6270657 0.1757849

In short, the SMA10 and the 10-month momentum (aka ROC 10 aka MOM10) both handily outperform the buy and hold, not only in absolute returns, but especially in risk-adjusted returns (Sharpe and Calmar ratios). Again, simplistic analysis, and many models get much more sophisticated than this, but once again, simple, illustrative example using two strategies that outperform a benchmark (over the long term, anyway).

Now, the question is, what was the R^2 of these models? To answer this, I took a rolling five-year window that essentially asked: how well did these quantities (the ratio between the closing price and the moving average – 1, or the ten month momentum) predict the next month’s returns? That is, what proportion of the variance is explained through the monthly returns regressed against the previous month’s signals in numerical form (perhaps not the best framing, as the signal is binary as opposed to continuous which is what is being regressed, but let’s set that aside, again, for the sake of illustration).

Here’s the code to generate the answer.

predictorsAndPredicted <- na.omit(cbind(lag(smaRatio), lag(spyROC), spyRets)) R2s <- list() for(i in 1:(nrow(predictorsAndPredicted)-59)) { #rolling five-year regression subset <- predictorsAndPredicted[i:(i+59),] smaLM <- lm(subset[,3]~subset[,1]) smaR2 <- summary(smaLM)$r.squared rocLM <- lm(subset[,3]~subset[,2]) rocR2 <- summary(rocLM)$r.squared R2row <- xts(cbind(smaR2, rocR2), order.by=last(index(subset))) R2s[[i]] <- R2row } R2s <- do.call(rbind, R2s) par(mfrow=c(1,1)) colnames(R2s) <- c("SMA", "Momentum") chart.TimeSeries(R2s, main = "R2s", legend.loc = 'topleft')

And the answer, in pictorial form:

In short, even in the best case scenarios, namely, crises which provide momentum/trend-following/call it what you will its raison d’etre, that is, its risk management appeal, the proportion of variance explained by the actual signal quantities was very small. In the best of times, around 20%. But then again, think about what the R^2 value actually is–it’s the percentage of variance explained by a predictor. If a small set of signals (let alone one) was able to explain the majority of the change in the returns of the S&P 500, or even a not-insignificant portion, such a person would stand to become very wealthy. More to the point, given that two strategies that handily outperform the market have R^2s that are exceptionally low for extended periods of time, it goes to show that holding the R^2 up as some form of statistical holy grail certainly is incorrect in the general sense, and anyone who does so either is painting with too broad a brush, is creating disingenuous arguments, or should simply attempt to understand another field which may not work the way their intuition tells them.

Thanks for reading.

**leave a comment**for the author, please follow the link and comment on their blog:

**R – QuantStrat TradeR**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.