Thursday, May 31, 2012

Conditional Drawdown Exploration

After reading Strub, Issam S., Trade Sizing Techniques for Drawdown and Tail Risk Control (May 21, 2012), I thought I should try to tie this with 2 other good R pieces on Conditional Drawdown:


In Strub’s paper, he uses conditional drawdown (CDaR) and conditional VaR (CVaR) to calculate the position size on directional (breakout determined) long/short currency positions.  The results were interesting enough to attempt to replicate with slight changes.  For this post, I will use CDaR to determine the position size on a long-only Mebane Faber 10-month moving average strategy.  We will start with an efficient frontier comparison and then abandon the frontier for a systematic approach.

(The blue text represents the added explanation in response to a comment)

If we look below at the frontier plots of return versus each measure of risk—the most common standard deviation, CDaR (conditional drawdown), and CVaR (conditional variance at risk)—we see that the frontiers are not noticeably different.  Visually, the most different and in a bad way, is the red CVaR line in the top left frontier plot.  The red CVaR line offers less return for each unit of standard deviation than the other two frontier lines, but the underperformance is not apparent when we use CDaR or CVaR on our x-axis as our measure of risk.

From TimelyPortfolio

Like the frontier plots above, the transition maps show only slightly different efficient allocations for each potential unit of risk.  At the lower end of the risk axis (left on the chart), we can see the biggest differences between allocations.

From TimelyPortfolio

The lack of noticeably different results seems consistent with well-known issues of mean-variance optimization.  These issues are described very well in this Morningstar piece.

“It is well known that mean-variance optimization is very sensitive to the estimates of returns, standard deviations, and correlations (see Michaud [1989] and Best and Grauer [1991]). Of these three inputs, returns are by far the most important and, unfortunately, the least stable. Chopra and Ziemba [1993] estimated that at a moderate risk tolerance level, mean-variance optimization is 11 times more sensitive to estimation error in returns relative to estimation error in risk (variance) and mean-variance optimization is two times more sensitive to estimation error in risk (variance) relative to estimation error in covariances (which also applies to correlations). Richard Michaud coined the phrase “the Markowitz optimization enigma” to describe the problem of input sensitivity and the highly concentrated asset allocations that result (see Michaud [1989]).

Input sensitivity indicates that the model’s output (the asset allocations) changes significantly due to small changes in the input (the capital market assumptions). Estimation error refers to the fact that in a forward-looking context the inputs are forecasts, and as such, are likely to be less than perfect (i.e. they contain errors). Putting these two issues together enables an uninformed practitioner to do more harm than good.”

For one more look at the lack of significant difference, let’s look at the cumulative returns of the 25th allocation from each efficient frontier.

From TimelyPortfolio

Even though the frontiers for the entire period are not significantly different, we can still use these more sophisticated risk measures in a different way to determine position size.  As a simple example similar to the example provided in Strub, let’s say we would like to pursue a Mebane Faber style 10-month moving average style long only position in each of the 3 currencies.  We would also like to limit the CDaR of each position to be 5%, so if we are fully allocated the sum of the 3 CDaR will be 15%. We will try to achieve this by using the 12 month rolling CDaR as our expected CDaR in the next month. Here is the chart of the 12 month rolling CDaR.

From TimelyPortfolio

If we just allocated 100% of the portfolio for each currency that exceeded its 10-month moving average, the results would look like this. Our maximum leverage across the portfolio would be 300%.

From TimelyPortfolio

However, if we would like to allocate more than 100% in quiet times and constrain our CDaR in volatile times, we can adjust our allocation by the 12 month rolling CDaR. As an example, if the New Zealand Dollar has a 15% CDaR for the last 12 months and we want 5% CDaR, we could allocate 33% or 15%historical/5%target to the New Zealand Dollar. This could result in a near infinite position size when CDaR is small, so we could also say that we want our maximum allocation to a single currency to be 200% or 600% at a portfolio level. The cumulative return chart would look like this.

From TimelyPortfolio
From TimelyPortfolio

I think it very unlikely that this would be a final allocation mechanism, and I certainly would not be comfortable with this, but I hope it offers some instructive building blocks upon which you can build an allocation system.

R code from GIST:

Wednesday, May 30, 2012

In Tuscaloosa Today

Any readers in Tuscaloosa?  I would love to meet up.

As a side note, I was delighted to find a summary of all the fine research being done at the University of Alabama.  I look forward to reading some of the papers, and hopefully benefitting from the research:

“In the study, published in the
December-February issue of Academy
of Management Learning and Education,
the authors found that scholarly
research at business schools appears
to add as much as 21 percent to the
MBA students’ future salaries, or about
$24,000 a year. The paper is titled
“Does Business School research add
Economic Value for Students?”


Friday, May 25, 2012

Trend Following Factors from Hsieh and Fung

The beauty of R and academic replication is that on the Friday before Memorial Day weekend I can read an academic paper and do some analysis all before breakfast.  In this case, the paper is

Hsieh, David A. and Fung, William, The Risk in Hedge Fund Strategies: Theory and Evidence from Trend Followers. The Review of Financial Studies, Vol. 14, No. 2, Summer 2001 .
Available at author’s site at Duke University: PDF file.

with data courtesy of the authors available at

Let’s get the factors into R and run some very introductory analysis on the Edhec data from PerformanceAnalytics.  The factors as defined by the authors are:

Trend Following Risk Factors from Fung and Hsieh, RFS (2001)
PTFSBD: Return of PTFS Bond lookback straddle
PTFSFX: Return of PTFS Currency Lookback Straddle
PTFSCOM:Return of PTFS Commodity Lookback Straddle
PTFSIR: Return of PTFS Short Term Interest Rate Lookback Straddle
PTFSSTK:Return of PTFS Stock Index Lookback Straddle

From TimelyPortfolio
From TimelyPortfolio

What a nice way to ease into the weekend. Now for the hard part--thinking about how I might use this.

R code from GIST:

Thursday, May 24, 2012

Quick dprint Experiment

As a quick dprint experiment, I thought I would try to do a quarterly return table that might potentially fit in knitR Performance Report 3 (really with knitr) and dprint.  Although I do not think I will use it in the final report, I do think it is a nice example of the very powerful dprint package.  If you do not see the embed below, please go to the link

R code from GIST:

Wednesday, May 23, 2012

knitR Performance Report 3 (really with knitr) and dprint

please see knitr Performance Report–Attempt 3, knitr Performance Report-Attempt 2 and knitr Performance Report-Attempt 1

alstated’s asked a very good question in his comment on knitr Performance Report–Attempt 3, and I’m not sure I could have answered well until I endured some frustrations with Sweave.  I actually did not use knitr for that report, and I struggled with many of the issues that knitr addresses.  knitr’s power comes in its extra ability to control output with additional chunk options described in, so no more wide, textblock, etc. latex commands.

A very prominent R Finance contributor also alerted me to the dprint (be aware in pre-Alpha) package from Carl Brickner presented at userR! 2010 and also at .  To use, you will have to manually install with the command:

install.packages("dprint", repos="")

For the final pdf, use the knit2pdf command from knitr:


I was delighted with the result and probably will abandon the Sweave-direct option.  Thanks to Carl for dprint and Yihui for knitr.  If you do not see the embedded pdf below, please get directly through

R code from GIST:

Tuesday, May 22, 2012

knitr Performance Report–Attempt 3

please see knitr Performance Report-Attempt 2 and knitr Performance Report-Attempt 1

Since the time of my last reporting post, RStudio, knitr, and Sweave have worked extremely hard to make document creation easier by becoming even more streamlined and cooperative (New Version of RStudio (v0.96)).  Thanks so much for these extremely helpful and generous contributors.

Over the years, I have developed an outline for client reports that I think applies in most situations in the money management world.  This also fits for performance reporting and marketing, except the transaction history section would either be eliminated or replaced by a section highlighting trades or ideas that have been used in the past.

From TimelyPortfolio

I thought I would have a completed product before displaying progress, but I just could not wait.  I started working on the Return section.  Please let me know what you think as your comments will guide the rest of the report.  If you are viewing in a RSS reader, you might need to view through this link, since the embed might not work.

R code from GIST:

Wednesday, May 16, 2012

CFA 2012 #cfa12 Twitter Analysis

Inspired by the bloggers isomorphismes and OUseful.Info, I thought it would be fun to analyze Twitter use of #cfa12 during the CFA Institute 65th Annual Conference in Chicago last week.  At last year’s conference, there was virtually no tweeting, so I was amazed at the exponential growth in tweeting this year and also at the number of lit screens during each session.

I’m not sure if I should be proud or embarrassed at being ranked as the #2 most prolific tweeter.

From TimelyPortfolio

I think this is an ugly chart, but I thought I would include as another example.

From TimelyPortfolio

By time, tweeting activity looks like this.  I really struggled with trying to facet tweet activity by day with the hour of the day as the x-axis.  If anyone accomplishes this, I would love to see it.

From TimelyPortfolio

Overall, I think the conference was extremely well done.

R code in GIST:

Tuesday, May 15, 2012

Skew of Bonds

As the researchpuzzler highlights in “a bad bet”, US bonds were a popular subject at the CFA Institute Annual Conference.  While US Bonds have been in an amazing 30 year run (see previous posts Lattice Explore Bonds, Bond Market as a Casino Game Part 1, Calmar Ratio 1.37 over the past 20 years), I think many positive skew-chasing market participants are not aware of the frequency of negative skew in bond returns.  As a public service, I thought I should issue a negative skew alert.

From TimelyPortfolio

R code from GIST: