Universal portfolio, part 9

July 25, 2012

(This article was first published on logopt: a journey in R, finance and open source, and kindly contributed to R-bloggers)

Part 8 was discussing the distribution of the absolute wealth of the Universal Portfolio across all possible tuples of length 2, 3 and 4.

However, comparing the absolute wealth against some reference, especially against simple portfolio selection algorithm provides a better view of the exact performance of the Universal algorithm.  Because we want to compute and compute multiple references, the code uses functions to be more generic.  The code remains terse (88 lines, including comments) and could be even terser.

Writing the code in this fashion shows again the strength of R, some specific aspects used here:

  • Passing functions as parameters of other functions
  • Using frames to access information outside the function scope, including assigning new values.
  • Use of … to write variadic functions (I am still learning that, the current code works but is not elegant)
  • Use of ::: to access non exported functions from a package
The code recalculates the value of Universal final wealth across all 4-tuples and thus takes one day to run, be warned.

The first graph shows the final wealth of Universal versus the final wealth of the best stock in the tuple. Contrary to the absolute wealth, the relative wealth decreases as the number of stocks in the tuple increases and is also generally significantly less than 1.  The red curve shows that for about 70% of the 4-tuples, Universal final wealth is below the wealth of the best stock in the tuple.

Obviously, it is impossible to know in advance which stock will have the best final wealth, so the comparison is slightly unfair.  The next two comparisons however are against two of the simplest causal selection algorithms:

  • Equally weighted buy and hold, UBH for short, U for uniform
  • Equally weighted Constant Rebalanced Portfolio, usually UCRP for Uniform CRP.  This one is interesting as Universal itself is based on a weighted combination of all CRP.
As BH is by construction worse than the best stock, we expect BH to fare better and indeed it does.  First Universal is generally better than BH, and second the relative performance increases as the number  of stocks in the tuple increase.  In general, Universal is much better than UBH.  The cumulative distribution does still shows a rather long and thin tail.
Unfortunately this does not carry to UCRP, UCRP happens to be a very good performer, and a very tough reference to beat for any portfolio selection algorithm.
Against UCRP:
  • Universal generally loses to UCRP (around 90% of the time) and sometimes pretty badly
  • Increasing the tuple size increases the relative performance when UCRP is better than Universal and decreases the performance when the opposite is true.
Interestingly, the textual output shows that the composition of the best absolute or relative Universal portfolios differ significantly for the comparison against UCRP.
Max final wealth 78.4742 for stocks: comme kinar
Max final wealth 111.6039 for stocks: comme kinar meico
Max final wealth 138.5075 for stocks: comme espey kinar meico
Max final relative wealth 4.3379 for stocks: iroqu kinar
Max final relative wealth 5.6186 for stocks: espey iroqu kinar
Max final relative wealth 5.2758 for stocks: coke espey iroqu kinar
Max final relative wealth 5.9302 for stocks: iroqu kinar
Max final relative wealth 8.6374 for stocks: espey iroqu kinar
Max final relative wealth 8.8390 for stocks: espey iroqu kinar meico
Max final relative wealth 1.3043 for stocks: dupont morris
Max final relative wealth 1.1980 for stocks: dupont morris sears
Max final relative wealth 1.1330 for stocks: dupont morris schlum sears

To leave a comment for the author, please follow the link and comment on their blog: logopt: a journey in R, finance and open source.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training



CRC R books series

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)