Wednesday, May 30, 2012

Correcting the package on R-forge

Writing a blog did help, it forced me to look at R-forge and discover that logopt was not building correctly. After installing back all necessary tools, I have (almost) recreated the original environment and was able to solve the problem, committing the first change in a long time.  Hopefully R-forge will have a valid build tomorrow.

One of the reasons I stopped working on logopt was a disk crash, in which I lost some files used in building the package.  Obviously the source files committed on the server were safe (an other reason to open source your code), but I lost some local files used to build the vignette and currently I cannot build the vignette anymore, even if I recovered the source code.  This will be one pending task after finishing the planned sequence of write-ups on Universal Portfolios.

Sunday, May 27, 2012

Universal portfolio, part 1

Thomas M. Cover was a well known Stanford professor working in the field of information theory.  He studied portfolio theory from an information theory standpoint, in a tradition started by John L. Kelly, Jr in A New Interpretation of Information Rate, Bell System Technical Journal 35: 917–926, 1956.  A large number of his portfolio theory articles are available on line.

Universal Portfolios. Mathematical Finance, 1(1): 1-29, January 1991 is the most interesting for me:

  • It is highly didactic and relatively easy to understand.
  • It includes a number of interesting graphs, contrary to many articles that restrict themselves to numeric tables.
  • It presents a portfolio approach that is guaranteed to work "reasonably well" under all conditions.
What not to like?  Reading this article led to some R code that eventually became the seed for logopt.

But what does "reasonably well"?  In Cover own words
We exhibit an algorithm for portfolio selection that asymptotically outperforms the best stock in the market.
This seems sensational, and is also slightly misleading as I'll discuss later on.

Constant rebalanced portfolio (CRP)

In Cover's words again,
"Universal Portfolios," Cover [1991] introduces a portfolio that does as well to first order in the exponent as the best constant rebalanced portfolio
A constant rebalanced portfolio buys and sells shares so that the ratio of each stock in the portfolio is a constant.  Intrinsically this corresponds to sell winners to buy losers.  The evolution of the value of a constant rebalanced portfolio is easy to describe mathematically, and this is why Cover is able to derive a portfolio selection algorithm that is guaranteed to track (in a mathematical sense) the best possible constant rebalanced portfolio.

Saturday, May 26, 2012

logopt is a R package that I have neglected for too long a time for a variety of reasons.  Logopt comes from log optimal portfolio, a part of the more general portfolio theory.  This blog is an attempt at reviving it through an increase in exposure, with these goals:

  • Clean up the existing code and discuss its implementation
  • Present applications of the code, generally by recreating the results of academic articles
  • Write new code
The base idea will be "don't break the chain", post and commit code on a regular base, in small chunks.  The first set of posts will discuss the initial motivation for logopt. a seminal article by Thomas M. Cover. Universal Portfolios. Mathematical Finance, 1(1): 1-29, January 1991.