Monday, May 16, 2011

Omega as Optimizer

During Jan Straatman’s presentation, I tweeted

Jan Straatman #cfa2011 In real life no normal distributions so use omega function to optimize actual returns

After the presentation, I asked Jan his second choice for optimization after Omega, and he responded nothing.  He added that he greatly dislikes optimization and avoids any optimization unless it is absolutely necessary.   Even though I share his dislike for optimization and avoid its temptations, I thought playing with Omega in R might offer a nice example of this very useful function.

A very basic use of Omega might allow a Relative Strength style strategy for building an equity portfolio.  For those unfamiliar with the Hussman Strategic Growth Fund (HSGFX), it offers an absolute return style equity strategy (see blog posts his own drummer and The Timing Value of John Hussman’s Market Climate Assessments).  Feel free to play with other funds or indicies, but I thought we could build a nice basic portfolio with HSGFX and the S&P 500 just by investing in the investment with the higher Omega as long as the Omega exceeds 1.5.

The portfolio looks like this.

From TimelyPortfolio
From TimelyPortfolio

Some working papers on SSRN regarding Omega are

Jan no longer posts his work on SSRN, but here are some of his older working papers  Also, here is a nice article from the Financial Times.

R code:



#define start and end dates
#Hussman starts 2000 but I use 1990 in case you want to look at other funds
end<- format(Sys.Date(),"%Y-%m-%d") # yyyy-mm-dd

# Pull adjusted tckr index data from Yahoo! Finance
getSymbols(tckr, from=start, to=end, adjust=TRUE)

# move from daily to weekly
GSPC<-to.weekly(GSPC, indexAt='endof')[,4]
HSGFX<-to.weekly(HSGFX, indexAt='endof')[,4]

# convert price data to return data for analysis with PerformanceAnalytics

# merge the two series

#some charts if you want to see them

#merge the 25-week rolling Omega for the two investements
#lag the data by 1

#get return for the investment with higher Omega
#use 0 if Omega does not exceed 1.5
ret<-ifelse(signal[,1] > signal[,2] & signal[,1]>1.5,RetToAnalyze[,1],ifelse(signal[,2]>1.5,RetToAnalyze[,2],0))

#combine investment returns and the omega generated Portfolio
charts.PerformanceSummary(returnComparison, main="HSGFX and SP500 versus Omega Generated Portfolio",

#downside risk comparison
ggplot(downsideTable, stat="identity", aes(x=Statistic,y=Value,fill=Portfolio)) + geom_bar(position="dodge") + coord_flip()

No comments:

Post a Comment