Pages

Saturday, June 30, 2012

R is fun

As mentioned in Universal portfolio, part 6, the wealth reported in Table 8.4 ofUniversal Portfolios could not be reproduced. An other observation is that the random weight vectors reported in Table 8.4 are shown in descending lexicographic order, except for the last one, suggesting possibly that there is an error in the original table.

R code allows to perform a simple experiment, take subsets of the full set of weights and check if we can reproduce the reported wealth. Explicitly we'll try all subsets that exclude from 1 to 7 values in the original set. This shows the expressive power of R, and how fast modern computers operate. The whole search only takes a few line of codes and execute very fast even if this entails computing the mean of 280,599 different subsets.

As it turns out, two different subsets with 18 elements match the reported wealth, a surprising result. No other subsets match. The code below must be appended after the code used in Universal portfolio, part 6.