It is instructive now to compare the performance (in-sample vs out-of-sample):
# compute returns of all portfolios
ret_all <- xts(X_lin %*% w_all[, c("GMVP", "Markowitz MVP", "EWP", "RPP (naive)")],
order.by = index(X_lin))
ret_all_trn <- ret_all[1:T_trn, ]
ret_all_tst <- ret_all[-c(1:T_trn), ]
# performance in-sample
t(table.AnnualizedReturns(ret_all_trn))
R>> Annualized Return Annualized Std Dev Annualized Sharpe (Rf=0%)
R>> GMVP 0.0447 0.1762 0.2538
R>> Markowitz MVP 0.1200 0.1968 0.6100
R>> EWP -0.1172 0.2574 -0.4553
R>> RPP (naive) -0.0180 0.1884 -0.0955
# performance out-of-sample
t(table.AnnualizedReturns(ret_all_tst))
R>> Annualized Return Annualized Std Dev Annualized Sharpe (Rf=0%)
R>> GMVP 0.3285 0.1516 2.1672
R>> Markowitz MVP 0.2709 0.1445 1.8752
R>> EWP 0.7153 0.2246 3.1841
R>> RPP (naive) 0.5699 0.1874 3.0412
We can see that the in-sample the Markowitz MVP has the best Sharpe ratio and the RPP is quite bad. However, when it come to out-of-sample performance, the EWP and RPP are much better.
Let us plot the cumulative PnL over time (recall that it looks deceptive to the untrained eye):
{ chart.CumReturns(ret_all, main = "Cum PnL of different portfolios",
wealth.index = TRUE, legend.loc = "topleft", colorset = rainbow8equal)
addEventLines(xts("training", index(X_lin[T_trn])), srt=90, pos=2, lwd = 2, col = "darkblue") }
The drawdown, on the other hand, clearly shows the superior performance of the RPP:
{ chart.Drawdown(ret_all, main = "Drawdown of different portfolios",
legend.loc = "bottomleft", colorset = rainbow6equal)
addEventLines(xts("training", index(X_lin[T_trn])), srt=90, pos=2, lwd = 2, col = "darkblue") }
We can see that the drawdown of the Markowitz MVP and EWP are the worst, while the GMVP and RPP are the safest.