Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. Wikipedia defines Parrondo’s paradox in game theory as

A combination of losing strategies becomes a winning strategy.

Please have a look at this wonderful little video by my colleague Professor Humberto Barreto from DePauw University, Indiana, based on a now-defunct app from Alexander Bogomolny of the well-known maths site “Cut the Knot”. It illustrates the general idea of Parrondo’s paradox in about 2 minutes:

Now, imagine that we could do something similar in finance: combine two losing investments into a winner! My colleague Professor Michael Stutzer from the University of Colorado published a fascinating paper which does just that: The Paradox of Diversification. We will reproduce the analytical results of the paper by simulation with real market data. You will see how super easy and intuitive this can be done in R!

In the paper Stutzer uses actual data of the stock market and builds a simple binomial tree model with it. Binomial trees are something like the workhorse of quantitative finance (mainly in the area of option pricing). They trace the potential price evolution in discreet up- and down-steps for n periods:

We can easily translate that into an R function which simulates a sample path for given values of `u`, `d` and `n`:

```binomial_tree <- function(u, d, n = 30) {
prod(sample(c(1+u, 1-d), n, replace = TRUE))
}
```

As can be seen in Note 1 of the paper (p. 8) market conditions of 6% expected real return and 40% volatility translate into u = 0.46 and d = 0.34 (p is assumed to be 0.5, i.e. up and down movements with those parameters are deemed to be equally probable).

Let us simulate 10,000 sample paths for 30 years and calculate the average return. It can be argued that the median return is the right measure here because we are more interested in the real return of an average outcome than in a hypothetical mixture of all possible outcomes (which would be the arithmetic mean):

```median(replicate(1e4, binomial_tree(u = 0.46, d = 0.34)))
##  0.5733923
```

The median return of the stock market is negative (-43% as the tree always starts at 1!). With its ups and downs, it would represent the green (“flashing”) game B in the above video. Game A (“regular”) would be Treasury Bills (a so-called “risk-free” asset) with a real return rate of -10 basis points (BPS), i.e. -0.001% (negative real return because of inflation!).

We now combine both negative investment strategies by putting 50% of our money in each. At the beginning of each year we will rebalance the portfolio, so that the initial ratio is restored. We adapt u and d accordingly, rebalance the portfolio at the beginning of each of the 30 years and again simulate 10,000 sample paths:

```median(replicate(1e4, binomial_tree(u = (0.46-0.001)/2, d = (0.34+0.001)/2)))
##  1.343303
```

Indeed, we got a huge surplus of over 34% this time! Diversification maintained by rebalancing (a.k.a. “rebalancing premium” or “volatility pumping”) is Parrondo’s paradox in action!