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
No comments:
Post a Comment