After portfolio optimization of Shariah-complaint fund using Markowitz Mean-Variance,we will now optimize our Shariah-Complaint 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.

Shariah Complaint Islamic Fund Constraints

The non banking finance corporation act(NBFC), 2008 defines the investment and diversification policy for Shariah Compliant fund. It is important while constructing our portfolio constraints. The NBFC defines the diversification as following

  1. Exposure limits for Shariah compliant fund shall not exceed 15 percent of net assets of a scheme or issued securities of a company.

  2. Shariah Complaint fund shall not invest more than thirty five per cent of total net assets of the Collective Investment Scheme in securities of any one sector as per classification of the stock exchange.;

  3. Shariah Complaint fund shall not take Exposure of more than thirty five per cent of net assets of Collective Investment Scheme in any single group

Data

The data employed in the study consists of daily closing prices of kSE-30. The data set encompassed the trading days from 4th August, 2008 to 2nd February 2015, 2009. The data is collected from the historical data available on the website of Pakistan stock Exchange.

The table for listed companies along with their groups are provided below

Listed PSX 30 companies
Symbol Company.Name Sector Group
DGKC D.G. Khan Cement Company Limited Cement Nishat
KEL K-Electric Limited power generation Abraaj / Shanghai Electric
POL Pakistan Oilfields Limited oil and gas exploration Attock
ENGRO Engro Corporation Limited fertilizer Dawood
LUCK Lucky Cement Limited Cement YBG
PPL Pakistan Petroleum Limited oil and gas exploration Government
FCCL Fauji Cement Company Limited Cement Fauji
MARI Mari Petroleum Company Limited oil and gas exploration Fauji
PSO Pakistan State Oil Company Limited oil and gas marketing Government
FFBL Fauji Fertilizer Bin Qasim Limited fertilizer Fauji
MCB MCB Bank Limited bank Nishat
PTC Pakistan Telecommunication Company Limited communication Etisalat
FFC Fauji Fertilizer Company Limited fertilizer Fauji
MLCF Maple Leaf Cement Factory Limited cement KMLG
SEARL The Searle Company Limited pharmaceutical
HBL Habib Bank Limited bank Agha Khan
HCAR Honda Atlas Cars (Pakistan) Limited auto Shirazi
HUBC Hub Power Company Limited power generation Dawood
JSCL Jahangir Siddiqui Company Limited investment bank JS Group
KAPCO Kot Addu Power Company Limited power generation Government
NBP National Bank Of Pakistan bank Government
NML Nishat Mills Limited textile composite Nishat
OGDC Oil and Gas Development Company Limited oil and gas exploration Government
PAEL Pak Elektron Limited cable Saigol
PIOC Pioneer Cement Limited cement
TRG TRG Pakistan Limited communication
UBL United Bank Limited bank Bestway

The MCD Robustified Mean-Variance Portfolio

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).

Output for MCD robustified portfolio with NBFC,2015 constraint is as following

To plot the frontier with 20 points, the frontier plot is as following

Efficient frontier of a Shariah-compliant 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.

The MVE Robustified Mean-Variance Portfolio

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:       
##  Portfolio Points:  2 of 2 
## 
## Portfolio Weights:
##     HCAR    MCB    HBL    NBP    UBL   PAEL   DGKC   LUCK   FCCL   MLCF
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## 2 0.0323 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.1285 0.0080 0.0000
##     PIOC    PTC    TRG  ENGRO   FFBL    FFC   JSCL    POL    PPL   MARI
## 1 0.0000 0.1425 0.0000 0.0000 0.0000 0.1500 0.1470 0.1500 0.1500 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.0910 0.1463 0.0000 0.0389 0.0000 0.0016
##     OGDC    PSO  SEARL    KEL   HUBC  KAPCO    NML
## 1 0.0143 0.0961 0.0000 0.0000 0.0000 0.1500 0.0000
## 2 0.1500 0.0000 0.0897 0.0139 0.1500 0.1500 0.0000
## 
## Covariance Risk Budgets:
##     HCAR    MCB    HBL    NBP    UBL   PAEL   DGKC   LUCK   FCCL   MLCF
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## 2 0.0322 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.1611 0.0100 0.0000
##     PIOC    PTC    TRG  ENGRO   FFBL    FFC   JSCL    POL    PPL   MARI
## 1 0.0000 0.1375 0.0000 0.0000 0.0000 0.1132 0.3230 0.1286 0.1250 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.0934 0.1598 0.0000 0.0393 0.0000 0.0014
##     OGDC    PSO  SEARL    KEL   HUBC  KAPCO    NML
## 1 0.0099 0.0899 0.0000 0.0000 0.0000 0.0729 0.0000
## 2 0.1510 0.0000 0.0817 0.0156 0.1419 0.1127 0.0000
## 
## Target Returns and Risks:
##      mean      mu     Cov   Sigma    CVaR     VaR
## 1 -0.0151 -0.0151  1.3827  0.8524  3.5706  2.0823
## 2  0.0482  0.0482  1.1081  0.6636  2.8567  1.6218
## 
## Description:
##  Mon Feb 13 11:13:30 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 OGK Robustified Mean-Variance Portfolio

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:       
##  Portfolio Points:  2 of 2 
## 
## Portfolio Weights:
##     HCAR    MCB    HBL    NBP    UBL   PAEL   DGKC   LUCK   FCCL   MLCF
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0089 0.0000 0.0000 0.0000 0.0000
## 2 0.0335 0.0000 0.0000 0.0000 0.0000 0.0031 0.0000 0.1200 0.0008 0.0000
##     PIOC    PTC    TRG  ENGRO   FFBL    FFC   JSCL    POL    PPL   MARI
## 1 0.0000 0.1500 0.0000 0.0000 0.0000 0.1500 0.1500 0.1452 0.1500 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.1021 0.1500 0.0000 0.0223 0.0000 0.0142
##     OGDC    PSO  SEARL    KEL   HUBC  KAPCO    NML
## 1 0.0368 0.0591 0.0000 0.0000 0.0000 0.1500 0.0000
## 2 0.1408 0.0000 0.1049 0.0083 0.1500 0.1500 0.0000
## 
## Covariance Risk Budgets:
##     HCAR    MCB    HBL    NBP    UBL   PAEL   DGKC   LUCK   FCCL   MLCF
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0070 0.0000 0.0000 0.0000 0.0000
## 2 0.0338 0.0000 0.0000 0.0000 0.0000 0.0027 0.0000 0.1488 0.0009 0.0000
##     PIOC    PTC    TRG  ENGRO   FFBL    FFC   JSCL    POL    PPL   MARI
## 1 0.0000 0.1467 0.0000 0.0000 0.0000 0.1137 0.3339 0.1238 0.1238 0.0000
## 2 0.0000 0.0000 0.0000 0.0000 0.1068 0.1656 0.0000 0.0217 0.0000 0.0134
##     OGDC    PSO  SEARL    KEL   HUBC  KAPCO    NML
## 1 0.0258 0.0525 0.0000 0.0000 0.0000 0.0728 0.0000
## 2 0.1395 0.0000 0.1030 0.0088 0.1420 0.1129 0.0000
## 
## Target Returns and Risks:
##      mean      mu     Cov   Sigma    CVaR     VaR
## 1 -0.0151 -0.0151  1.3806  0.9217  3.5568  2.0273
## 2  0.0482  0.0482  1.1017  0.7203  2.8378  1.6004
## 
## Description:
##  Mon Feb 13 11:13:31 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.

The Shrinked Mean-Variance Portfolio

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:       
##  Portfolio Points:  2 of 2 
## 
## Portfolio Weights:
##     HCAR    MCB    HBL    NBP    UBL   PAEL   DGKC   LUCK   FCCL   MLCF
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0274 0.0000 0.0000 0.0000 0.0000
## 2 0.0624 0.0000 0.0000 0.0000 0.0000 0.0129 0.0000 0.0672 0.0000 0.0000
##     PIOC    PTC    TRG  ENGRO   FFBL    FFC   JSCL    POL    PPL   MARI
## 1 0.0000 0.1500 0.0000 0.0000 0.0092 0.1500 0.1457 0.1233 0.1500 0.0000
## 2 0.0141 0.0000 0.0000 0.0000 0.0945 0.0934 0.0000 0.0228 0.0290 0.0317
##     OGDC    PSO  SEARL    KEL   HUBC  KAPCO    NML
## 1 0.0037 0.0885 0.0022 0.0000 0.0000 0.1500 0.0000
## 2 0.1500 0.0000 0.1203 0.0018 0.1500 0.1500 0.0000
## 
## Covariance Risk Budgets:
##     HCAR    MCB    HBL    NBP    UBL   PAEL   DGKC   LUCK   FCCL   MLCF
## 1 0.0000 0.0000 0.0000 0.0000 0.0000 0.0238 0.0000 0.0000 0.0000 0.0000
## 2 0.0751 0.0000 0.0000 0.0000 0.0000 0.0127 0.0000 0.0797 0.0000 0.0000
##     PIOC    PTC    TRG  ENGRO   FFBL    FFC   JSCL    POL    PPL   MARI
## 1 0.0000 0.1473 0.0000 0.0000 0.0061 0.1143 0.3240 0.1023 0.1239 0.0000
## 2 0.0155 0.0000 0.0000 0.0000 0.0979 0.0902 0.0000 0.0228 0.0273 0.0342
##     OGDC    PSO  SEARL    KEL   HUBC  KAPCO    NML
## 1 0.0025 0.0819 0.0010 0.0000 0.0000 0.0728 0.0000
## 2 0.1534 0.0000 0.1310 0.0019 0.1439 0.1144 0.0000
## 
## Target Returns and Risks:
##      mean      mu     Cov   Sigma    CVaR     VaR
## 1 -0.0151 -0.0151  1.3778  1.3708  3.5538  2.0638
## 2  0.0482  0.0482  1.0873  1.0807  2.8079  1.6584
## 
## Description:
##  Mon Feb 13 11:13:32 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.