After portfolio optimization using Markowitz Mean-Variance,we will now optimize our equity portfolio for KSE-30(Pakistan Stock Exchange) using robust portfolios and covariance estimations.
Mean-variance portfolios constructed using the sample mean and covariance matrix of asset returns often perform poorly out-of-sample due to estimation errors in the mean vector and covariance matrix. As a consequence, minimum-variance portfolios may yield unstable weights that fluctuate substantially over time. This loss of stability may also lead to extreme portfolio weights and dramatic swings in weights with only minor changes in expected returns or the covariance matrix. Consequentially, we observe frequent re-balancing and excessive transaction costs.
To achieve better stability properties compared to traditional minimum variance portfolios, we try to reduce the estimation error using robust methods to compute the mean and/or covariance matrix of the set of financial assets. Two different approaches are implemented: robust mean and covariance estimators, and the shrinkage estimator.
If the number of time series records is small and the number of considered assets increases, then the sample estimator of covariance becomes more and more unstable. Specifically, it is possible to provide estimators that improve considerably upon the maximum likelihood estimate in terms of mean-squared error. Moreover, when the number of records is smaller than the number of assets, the empirical estimate of the covariance matrix becomes singular.
The minimum covariance determinant, MCD, estimator of location and scatter looks for the h > n/2 observations out of n data records whose classical covariance matrix has the lowest possible determinant. The raw MCD estimate of location is then the average of these h points, whereas the raw MCD estimate of scatter is their covariance matrix, multiplied by a consistency factor and a finite sample correction factor (to make it consistent with the normal model and unbiased for small sample sizes).
Therefore output for MCD robustified portfolio with long-only constraint is as following
To plot the frontier with 20 points, the frontier plot is as following
Efficient frontier of a long-only constrained mean-variance portfolio with robust MCD covariance estimates: The plot above includes the efficient frontier, the tangency line and tangency point for a zero risk-free rate, the equal weights portfolio, EWP, all single assets risk vs. return points. The line of Sharpe ratios is also shown, with its maximum coinciding with the tangency portfolio point. The range of the Sharpe ratio is printed on the right hand side axis of the plot.
To display the weights, risk attributions and covariance risk budgets for the MCD robustified portfolio in the left-hand column and the same plots for the sample covariance MV portfolio in the right-hand column of a figure:
The above grid of plots shows the Weights plot for MCD robustified and COV MV portfolios. Weights along the efficient frontier of a long-only constrained mean-variance portfolio with robust MCD (left) and sample (right) covariance estimates: The graphs from top to bottom show the weights, the weighted returns or in other words the performance attribution, and the covariance risk budgets, which are a measure for the risk attribution. The upper axis labels the target risk, and the lower labels the target return. The thick vertical line separates the efficient frontier from the minimum variance locus. The risk axis thus increases in value to both sides of the separator line. The legend to the right links the assets names to colour of the bars.
Rousseeuw & Leroy (1987) proposed a very robust alternative to classical estimates of mean vectors and covariance matrices, the Minimum Volume Ellipsoid, MVE. Samples from a multivariate normal distribution form ellipsoid-shaped ‘clouds’ of data points. The MVE corresponds to the smallest point cloud containing at least half of the observations, the uncontaminated portion of the data. These ‘clean’ observations are used for preliminary estimates of the mean vector and the covariance matrix. Using these estimates, the program computes a robust Mahalanobis distance for every observation vector in the sample. Observations for which the robust Mahalanobis distances exceed the 97.5% significance level for the chi-square distribution are flagged as probable outliers.
The MVE robustified efficient frontier is as following
##
## Title:
## MV Portfolio Frontier
## Estimator: fastMveEstimator
## Solver: solveRquadprog
## Optimize: minRisk
## Constraints: LongOnly
## Portfolio Points: 4 of 4
##
## Portfolio Weights:
## DGKC ENGRO FCCL FFBL FFC HBL HCAR HUBC JSCL KAPCO
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.4829 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.2901 0.0086 0.0000 0.0000 0.0970 0.1104
## 3 0.0000 0.0000 0.0000 0.0638 0.1069 0.0000 0.0366 0.2223 0.0000 0.3151
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000
## KEL LUCK MARI MCB MLCF NBP NML OGDC PAEL PIOC
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.2977 0.0000 0.0000 0.0000 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.0000 0.1243 0.0000 0.0000 0.0000 0.0000
## 3 0.0000 0.0788 0.0000 0.0000 0.0000 0.0000 0.0000 0.0850 0.0000 0.0000
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## POL PPL PSO PTC SEARL TRG UBL
## 1 0.0000 0.1864 0.0000 0.0330 0.0000 0.0000 0.0000
## 2 0.0000 0.3198 0.0000 0.0498 0.0000 0.0000 0.0000
## 3 0.0000 0.0000 0.0000 0.0000 0.0774 0.0000 0.0139
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
##
## Covariance Risk Budgets:
## DGKC ENGRO FCCL FFBL FFC HBL HCAR HUBC JSCL KAPCO
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.7860 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.2876 0.0055 0.0000 0.0000 0.1709 0.0493
## 3 0.0000 0.0000 0.0000 0.0607 0.1069 0.0000 0.0357 0.2485 0.0000 0.3039
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000
## KEL LUCK MARI MCB MLCF NBP NML OGDC PAEL PIOC
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.1508 0.0000 0.0000 0.0000 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.0000 0.1268 0.0000 0.0000 0.0000 0.0000
## 3 0.0000 0.0876 0.0000 0.0000 0.0000 0.0000 0.0000 0.0764 0.0000 0.0000
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## POL PPL PSO PTC SEARL TRG UBL
## 1 0.0000 0.0525 0.0000 0.0107 0.0000 0.0000 0.0000
## 2 0.0000 0.3197 0.0000 0.0401 0.0000 0.0000 0.0000
## 3 0.0000 0.0000 0.0000 0.0000 0.0680 0.0000 0.0123
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
##
## Target Returns and Risks:
## mean mu Cov Sigma CVaR VaR
## 1 -0.0784 -0.0784 2.5121 1.6891 5.6249 3.5847
## 2 -0.0151 -0.0151 1.3611 0.8578 3.6747 1.9764
## 3 0.0482 0.0482 1.0754 0.6922 2.7650 1.5121
## 4 0.1115 0.1115 2.6869 2.2475 5.7461 4.4269
##
## Description:
## Fri Jan 13 19:01:32 2017 by user: azam.yahya
For the frontier plot, we recompute the robustified frontier on 20 points.
Efficient frontier of a long-only constrained mean-variance portfolio with robust MVE covariance estimates: The plot includes the efficient frontier, the tangency line and tangency point for a zero risk-free rate, the equal weights portfolio, EWP, all single assets risk vs. return points. The line of Sharpe ratios is also shown, with its maximum coinciding with the tangency portfolio point. The range of the Sharpe ratio is printed on the right hand side axis of the plot.
For this sessiontoo, we will plot the weights and the performance and risk attribution plots
Weights along the above efficient frontier of a long-only constrained mean-variance portfolio with robust MVE (left) and MCD (right) covariance estimates: The graphs from top to bottom show the weights, the weighted returns or in other words the performance attribution, and the covariance risk budgets which are a measure for the risk attribution. The upper axis labels the target risk, and the lower labels the target return. The thick vertical line separates the efficient frontier from the minimum variance locus. The risk axis thus increases in value to both sides of the separator line. The legend to the right links the assets names to colour of the bars. Note that the comparison of weights between the MVE and MCD with sample covariance estimates shows a much better diversification of the portfolio weights and also leads to a better diversification of the covariance risk budgets.
The Orthogonalized Gnanadesikan-Kettenring (OGK) estimator computes the orthogonalized pairwise covariance matrix estimate described in Maronna & Zamar (2002). The pairwise proposal goes back to Gnanadesikan & Kettenring (1972).
Our OGK portfolio is as following
##
## Title:
## MV Portfolio Frontier
## Estimator: fastCovOGKEstimator
## Solver: solveRquadprog
## Optimize: minRisk
## Constraints: LongOnly
## Portfolio Points: 4 of 4
##
## Portfolio Weights:
## DGKC ENGRO FCCL FFBL FFC HBL HCAR HUBC JSCL KAPCO
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.4874 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.2816 0.0476 0.0000 0.0000 0.1073 0.1265
## 3 0.0000 0.0000 0.0000 0.0749 0.1078 0.0210 0.0347 0.1622 0.0000 0.2810
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000
## KEL LUCK MARI MCB MLCF NBP NML OGDC PAEL PIOC
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.2480 0.0000 0.0000 0.0000 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.0000 0.1077 0.0000 0.0000 0.0000 0.0000
## 3 0.0021 0.1088 0.0048 0.0000 0.0000 0.0000 0.0000 0.0939 0.0000 0.0000
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## POL PPL PSO PTC SEARL TRG UBL
## 1 0.0000 0.1973 0.0000 0.0673 0.0000 0.0000 0.0000
## 2 0.0000 0.2648 0.0000 0.0645 0.0000 0.0000 0.0000
## 3 0.0000 0.0000 0.0000 0.0000 0.0873 0.0000 0.0215
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
##
## Covariance Risk Budgets:
## DGKC ENGRO FCCL FFBL FFC HBL HCAR HUBC JSCL KAPCO
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.8021 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.2821 0.0340 0.0000 0.0000 0.2059 0.0594
## 3 0.0000 0.0000 0.0000 0.0757 0.1109 0.0179 0.0353 0.1675 0.0000 0.2599
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000
## KEL LUCK MARI MCB MLCF NBP NML OGDC PAEL PIOC
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.1185 0.0000 0.0000 0.0000 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.0000 0.1104 0.0000 0.0000 0.0000 0.0000
## 3 0.0021 0.1335 0.0043 0.0000 0.0000 0.0000 0.0000 0.0893 0.0000 0.0000
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## POL PPL PSO PTC SEARL TRG UBL
## 1 0.0000 0.0565 0.0000 0.0229 0.0000 0.0000 0.0000
## 2 0.0000 0.2531 0.0000 0.0550 0.0000 0.0000 0.0000
## 3 0.0000 0.0000 0.0000 0.0000 0.0829 0.0000 0.0207
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
##
## Target Returns and Risks:
## mean mu Cov Sigma CVaR VaR
## 1 -0.0784 -0.0784 2.5056 1.7169 5.5554 3.5153
## 2 -0.0151 -0.0151 1.3417 0.8489 3.5912 2.0472
## 3 0.0482 0.0482 1.0702 0.7036 2.7558 1.5442
## 4 0.1115 0.1115 2.6869 2.5268 5.7461 4.4269
##
## Description:
## Fri Jan 13 19:01:33 2017 by user: azam.yahya
The frontier plot is as following
The above plot is the Efficient frontier of a long-only constrained mean-variance portfolio with robust OGK covariance estimates: The plot includes the efficient frontier, the tangency line and tangency point for a zero risk-free rate, the equal weights portfolio, EWP, all single assets risk vs. return points. The line of Sharpe ratios is also shown, with its maximum coinciding with the tangency portfolio point. The range of the Sharpe ratio is printed on the right hand side axis of the plot.
The weights, and the performance and risk attributions are shown in the left-hand column as shown below
The above plot shows Weights along the efficient frontier of a long-only constrained mean-variance portfolio with robust OGK (left) and MCD (right) covariance estimates: The graphs from top to bottom show the weights, the weighted returns or in other words the performance attribution, and the covariance risk budgets which are a measure for the risk attribution. The upper axis labels the target risk, and the lower labels the target return. The thick vertical line separates the efficient frontier from the minimum variance locus. The risk axis thus increases in value to both sides of the separator line. The legend to the right links the assets names to colour of the bars. Note that both estimators result in a similar behaviour concerning the diversification of the weights. A remark, for larger data sets of assets the OGK estimator becomes favourable since it is more computation efficient.
A simple version of a shrinkage estimator of the covariance matrix is constructed as follows. We consider a convex combination of the empirical estimator with some suitable chosen target, e.g., the diagonal matrix. Subsequently, the mixing parameter is selected to maximize the expected accuracy of the shrinked estimator. This can be done by cross-validation, or by using an analytic estimate of the shrinkage intensity. The resulting regularized estimator can be shown to outperform the maximum likelihood estimator for small samples. For large samples, the shrinkage intensity will reduce to zero, therefore in this case the shrinkage estimator will be identical to the empirical estimator. Apart from increased efficiency, the shrinkage estimate has the additional advantage that it is always positive definite and well conditioned, (Schäfer & Strimmer, 2005).
The shrink portfolio is as following
##
## Title:
## MV Portfolio Frontier
## Estimator: shrinkEstimator
## Solver: solveRquadprog
## Optimize: minRisk
## Constraints: LongOnly
## Portfolio Points: 4 of 4
##
## Portfolio Weights:
## DGKC ENGRO FCCL FFBL FFC HBL HCAR HUBC JSCL KAPCO
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.4823 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.1412 0.0513 0.0000 0.0000 0.1174 0.2282
## 3 0.0000 0.0000 0.0000 0.0568 0.0564 0.0390 0.0567 0.1653 0.0000 0.2997
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000
## KEL LUCK MARI MCB MLCF NBP NML OGDC PAEL PIOC
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.2308 0.0000 0.0000 0.0000 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.0000 0.1205 0.0000 0.0000 0.0027 0.0000
## 3 0.0000 0.0555 0.0217 0.0000 0.0000 0.0000 0.0000 0.1015 0.0090 0.0082
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## POL PPL PSO PTC SEARL TRG UBL
## 1 0.0000 0.1290 0.0000 0.1579 0.0000 0.0000 0.0000
## 2 0.0000 0.2042 0.0000 0.1345 0.0000 0.0000 0.0000
## 3 0.0000 0.0000 0.0000 0.0000 0.0998 0.0000 0.0305
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
##
## Covariance Risk Budgets:
## DGKC ENGRO FCCL FFBL FFC HBL HCAR HUBC JSCL KAPCO
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.7961 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.1153 0.0395 0.0000 0.0000 0.2515 0.1300
## 3 0.0000 0.0000 0.0000 0.0551 0.0499 0.0351 0.0666 0.1733 0.0000 0.2858
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000
## KEL LUCK MARI MCB MLCF NBP NML OGDC PAEL PIOC
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.1092 0.0000 0.0000 0.0000 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.0000 0.1338 0.0000 0.0000 0.0020 0.0000
## 3 0.0000 0.0639 0.0222 0.0000 0.0000 0.0000 0.0000 0.0979 0.0082 0.0086
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## POL PPL PSO PTC SEARL TRG UBL
## 1 0.0000 0.0342 0.0000 0.0605 0.0000 0.0000 0.0000
## 2 0.0000 0.1891 0.0000 0.1387 0.0000 0.0000 0.0000
## 3 0.0000 0.0000 0.0000 0.0000 0.1033 0.0000 0.0303
## 4 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
##
## Target Returns and Risks:
## mean mu Cov Sigma CVaR VaR
## 1 -0.0784 -0.0784 2.4990 2.4943 5.5400 3.5638
## 2 -0.0151 -0.0151 1.3049 1.2985 3.4278 1.9950
## 3 0.0482 0.0482 1.0581 1.0521 2.7401 1.6179
## 4 0.1115 0.1115 2.6869 2.6869 5.7461 4.4269
##
## Description:
## Fri Jan 13 19:01:34 2017 by user: azam.yahya
The frontier plot is as following
The above plot shows the efficient frontier of a long-only constrained mean-variance portfolio with shrinked covariance estimates: The plot includes the efficient frontier, the tangency line and tangency point for a zero risk-free rate, the equal weights portfolio, EWP, all single assets risk vs. return points. The line of Sharpe ratios is also shown, with its maximum coinciding with the tangency portfolio point. The range of the Sharpe ratio is printed on the right hand side axis of the plot.
The above graph shows the Weights along the efficient frontier of a long-only constrained mean-variance portfolio with shrinked covariance estimates: The graphs from top to bottom show the weights, the weighted returns or in other words the performance attribution, and the covariance risk budgets which are a measure for the risk attribution. The upper axis labels the target risk, and the lower labels the target return. The thick vertical line separates the efficient frontier from the minimum variance locus. The risk axis thus increases in value to both sides of the separator line. The legend to the right links the assets names to colour of the bars.