JFRM  Vol.6 No.4 , December 2017
Portfolio Optimization Modelling with R for Enhancing Decision Making and Prediction in Case of Uganda Securities Exchange
ABSTRACT
Portfolio Optimization involves choosing proportions of assets to be held in a portfolio, so as to make the portfolio better than any other. In this research, we use a software for statistical computing R to analyse the performance of portfolio optimization models which include; Markowitz’s Mean-Variance (MV) model, the VaR model, and Konno and Yamazaki’s Mean-Absolute Deviation (MAD) model. We start by analysing multi-asset data for the major indexes in the world followed by historical data of 16 constituent shares listed on the Uganda Securities Exchange (USE) covering 6.5 years. The paper then tests the stock performance of the models using R. We found that GREXP bonds dominated the world market as they accounted for more than 60% of the Maximum Diversified Portfolio (MDP). For the USE, we generated more risk measures like volatility, Sharpe Ratio (SR), Risk Parity (RP), Expected Shortfall (ES) or CVaR which we used to assess stock performance. UMEME, NVL, BATU, JHL, DFCU, EBL, EABL, KCB, SBU and CENT were the best-performing stocks. By understanding the performance of portfolio optimization models in R, Ugandan investors will develop a better view of the latest performance of the stocks listed on the USE. This will help them to decide on which stocks to include in their investment portfolios, thus prevent wrong investment decisions.

1. Introduction

The capital market is an important component of the financial system, which entails funds being mobilized by firms, institutions or the government directly from savers through the issuance of equities or bonds (Kasekende, 2017b). Efficient capital markets can accommodate the needs of investors and are well suited to provide long-term finance to the corporate and public sectors ( Kasekende , 2017b. It is important to emphasise the role of the capital markets in business and economic research in Uganda. By using the media and research to feed the public on investment opportunities available in the Ugandan capital market, Ugandans will make a useful decision on where to invest their money (Kasekende, 2017a). It is surprising that only a few Ugandans know about treasury bills as opposed to buying a boda-boda and taxi (Semakula, 2017). Therefore, we are motivated to use analytical skills to synthesize complicated economic and financial issues such as portfolio optimization for the public. Since this paper focuses on Uganda’s capital market, a brief review of the Capital Markets Authority (CMA), the ALTX, and the Uganda Securities Exchange (USE) is worthwhile.

The responsibilities of the CMA include: development, promotion, and regulation the Uganda capital markets industry, with the main objectives of ensuring market efficiency and investor protection (CMA, 2017). A stock exchange is a marketplace for securities, with stockbrokers who earn commissions on transactions they make (Njanike, Katsuro, & Mudzura, 2009; Quaye, Mu, Abudu, & Agyare, 2016). The USE and the ALTX are currently the two licensed and registered stock exchanges in Uganda. The USE with close to 40,000 registered investors is the central place for trading securities by licensed dealers (USE, 2017b). It provides a platform for raising capital through the issuance of debt, equity and any other instruments to potential investors.

The USE operates through 3 market segments: the Fixed Income Securities Market Segment (FISMS); the Main Investment Market Segment (MIMS); and the Growth Enterprise Market Segment (GEMS) (USE, 2017a). The MIMS is the market for established companies looking to raise funding. It consists of 16 listed Equities 8 of which are locally listed: Bank of Baroda Uganda (BOBU); British American Tobacco Uganda (BATU); Uganda Clays Limited (UCL); New Vision Printing and Publishing Company Ltd (NVL); Stanbic Bank Uganda (SBU); Development Finance Company of Uganda Ltd (DFCU); National Insurance Corporation (NIC) and Umeme Limited (UMEME). MIMS also consists of 8 other equity securities that are cross-listed on the Nairobi Securities Exchange (NSE): Equity Bank Limited (EBL); Kenya Commercial Bank (KCB); Jubilee Holdings Limited (JHL); Centum Investment Company Ltd (CENT); East African Breweries Limited (EABL); Kenya Airways (KA); Nation Media Group (NMG); Uchumi Supermarkets Limited (UCHM). NSE is the main stock exchange in Kenya and offers an automated platform for the listing and trading of various securities (NSE, 2017).

The FISMS offers a platform for fixed income securities. Its main objective is to provide a separate independent market for the companies wishing to raise capital through issuing and listing of fixed income securities like treasury bonds, preference shares, corporate bonds, and debenture stocks (USE, 2017a). It also acts as a market for investors wishing to trade the above securities at the USE. The FISMS also lists other short-term financial instruments such as commercial papers and treasury bills. It currently has 39 government of Uganda treasury bonds and 6 corporate bonds listed.

The Bank of Uganda (BOU) licensed all commercial banks to have unrestricted access to the primary market for all government security operations. This is part of BOU’s ongoing commitment to make an investment in government securities easier to the public (Mutebile, 2017). The primary dealer system aims to promote participation in government securities markets, to foster the development of financial markets, to improve the secondary market trading system, and to ensure efficiency in the operations related to the government securities market at the central bank (Mutebile, 2017). Primary dealers are acknowledged for their contribution to the growth of the government securities market as they ensure high demand during primary market auctions (Mutebile, 2017).

The ATLX East Africa exchange went live in Kampala in July 2016, with the optimism of improving access to foreign financial securities by local stockbrokers (Busuulwa, 2016). The ATLX trading platform provides a medium for Exchange Traded Funds (ETFs), foreign equities, Asset-Backed Securities (ABS), and bonds. ETFs are recognized as investment vehicles of choice for investors targeting any asset classes, industry sectors, and low-cost exposure to equity market indices (Krause, Ehsani, & Lien, 2014). ALTX is owned by ALTEX Africa Group (AAG), a firm based in Mauritius and founded by Jatin Jivram and Joseph Kitamirike in 2013 (Reuters, 2016).

The USE is a reflection of Uganda’s economy; when the economy does not perform well, the markets do not do well. The automation of the stock trading at the USE in July 2015 was highly anticipated to turn around the fate of the stock market. At the same time, it would act as an eye opener for Uganda’s stock market to foreign investors (Bwiso, 2017).

Portfolio Optimization

Portfolio Optimization involves choosing proportions of assets to be held in a portfolio, so as to make the portfolio better than any other. Simultaneous profit maximization and risk minimization has been a decision rule over the years with the development of the minimax concept providing more interesting insight into the history of risk research (Li, Wu, & Ojiako, 2014). The minimax concept deals with the provision of choice reasons behind an individual’s decision choice when faced with a number of possible alternative actions, with the impact of each decision choice unknown (Naslund & Whinston, 1964; Li et al., 2014).

According to Li et al. (2014), the major reason for decision choice was because rational individuals were more likely to seek to maximize expected returns from a decision, but this expectation would be weighted by the probability of an alternative outcome (Simon, 1959). They, therefore, advocated for decision models to come into play. Quantitative and mathematical models have been increasingly applied to decision making and prediction, especially in aspects of business management with highly complex characteristics (Watson & Brown, 1978; Xu, Zhou, Jiang, Yu, & Niu, 2016; Li et al., 2014). Namugaya, Weke, & Charles (2014) employed different univariate Generalized Autoregressive Conditional Heteroscedastic (GARCH) models for modelling stock return volatility on the USE. Mayanja, Mataramvura, & Mahera (2013) used a model based on the modern portfolio optimization, incorporated certain restrictions specific to the USE investment environment, and developed a modified model. Investors are individuals who are wealth maximization minded and always aim for higher returns on their investments in stocks listed on exchanges (Quaye et al., 2016). Investment management involves an investor deciding on whether to invest in a particular stock, to increase or reduce their portfolio investment, to carry out portfolio diversification or to entirely exit the market (Li et al., 2014).

The first portfolio optimization model was developed by Markowitz (1952) which now serves as an inspiration to a number of scholars interested in understanding the relationship between risk and profits. Then other scholars like Konno & Yamazaki (1991) developed their portfolio optimization model. Financial institutions use VaR model to manage risk. Xu et al. (2016) used a large CVaR-based method for portfolio selection. Risk management is a subject of interest in finance and management, therefore a comprehensive understanding of portfolio optimization models by Ugandan investors will enable them to assess the performance of stocks listed on the USE and thus preventing wrong investment decisions.

Risk measure is a key research component in portfolio optimization (Xu et al., 2016). Risk is the chance of exposure to adverse consequences of uncertain future events (ACCA, 2017). It refers to the uncertainty associated with a decision which may deliver undesirable outcomes (Sitkin & Pablo, 1992). It involves risk management and risk evaluation (Hansson, 1996). Risk management consists of aspects such as; outcome uncertainty, outcome expectations, and the potential of an outcome (Polak, Rogers, & Sweeney, 2010; Li et al., 2014). Risk management is used to identify the risks associated with new opportunities that lead to an increase in the chance of profitability and maximized returns (ACCA, 2017). Effective risk management improves financial performance thereby boosting shareholders’ value (ACCA, 2017).

It is perceived that risk has economic characteristics, which prescribe that larger risks are associated with events that vary most economically (Sitkin & Pablo, 1992). Therefore, we assume that events that are characterized by large variability between actual and expected outcomes will accrue more risk (Li et al., 2014). These outcomes may be either positive or negative (Ward, 2003). Although risk management is about managing both negative and positive risks (Haimes, 2009), this paper mainly focuses on the management of the negative impact of risk. The study aims to generate an understanding of how the balance between risk minimization and profit maximization can be optimized by using R language to test the performance of models against data obtained from the USE. We believe that investment decisions in listed securities are driven by the investors’ ability to understand the data and information at their disposal in order to make informed decisions. A good understanding of the performance of models will enable risk managers better manage corporate risks. After this introduction, in the next section, we introduce the concept of portfolio optimization modelling. We also refer to the literature to review the optimization models of interest.

2. Literature Review

2.1. Model Overview

Portfolio Optimization has been used over the years in the financial services industry. It is the allocation of capital to the available assets so as to maximize return on the investment and minimize risk (Mayanja et al., 2013). It has been applied by various scholars (Polak et al., 2010; Li et al., 2014; Xu et al., 2016) in finance to generate an understanding how risk may be minimized while profits are maximized. Portfolio Optimization research can be traced to the work of Markowitz (1952), who developed a model to solve the problem of selecting stocks. Markowitz’s mean-variance (MV) model is a quadratic program model, where the variance of each stock is adapted for measuring risk (Xu et al., 2016). The model assumes that all investors are reasonable (rational) and reluctant to take risks (risk-averse). Thus, in effect, it is expected that investors are more likely to choose assets with a higher return given the same level of risks.

According to Luenberger (1998), MV portfolios are obtained from formulating a mathematical problem. We assume n assets, whose rates of return are r ¯ 1 , r ¯ 2 ,⋯, r ¯ n and covariances σ ij , for i,j=1,2,⋯,n . We define a portfolio by a set of n weights w i ,i=1,2,⋯,n , that add to one. With negative weights corresponding to short selling. Therefore, in order to find a minimum-variance portfolio, the value of the mean is fixed at some arbitrary value r ¯ then a portfolio of minimum variance with this mean can be found. Hence the problem is formulated.

Minimize  ∑ i,j=1 n w i w j σ ij (1)

Subject to   ∑ i=1 n   w i r ¯ i = r ¯ (2)

∑ i=1 n   w i =1 (3)

This problem lays a foundation for single-period investment theory. It addresses the trade-off between expected rate of return and variance of the rate of return in a portfolio (Luenberger, 1998). The resulting Markowitz problem can be solved numerically to obtain a solution. It can also be solved analytically to get strong additional conclusions from the analytic solution. The Markowitz problem is used when a risk-free asset (e.g.: treasury bills), as well as a risky asset, are available.

Solution to the Markowitz problem

The conditions for the solution to the problem is found using Lagrange multipliers α and β . The Lagrangian (L) is formed.

L= ∑ i,j=1 n w i w j σ ij −α( ∑ i=1 n   w i r ¯ i − r ¯ )−β( ∑ i=1 n w i −1 ) .

The first derivative of L with respect to each variable w i is found and set to zero. The differentiation is done for two-variable cases, then it becomes easy to generalize for n variables. For the two variables,

L=( w 1 2 σ 1 2 + w 1 w 2 σ 12 + w 2 w 1 σ 21 + w 2 2 σ 2 2 )−α( r ¯ 1 w 1 + r ¯ 2 w 2 − r ¯ )−β( w 1 + w 2 −1 ) .

Hence,

∂L ∂ w 1 =( 2 σ 1 2 w 1 + σ 12 w 2 + σ 21 w 2 )−α r ¯ 1 −β. (4)

∂L ∂ w 2 =( σ 12 w 1 + σ 21 w 1 +2 σ 2 2 w 2 )−α r ¯ 2 −β. (5)

Equations (2)-(5) are solved simultaneously to find the unknowns w 1 , w 2 ,α and β .

Limitations of the model

The MV model has some limitations. Chen et al. (2009) argue that the model utilizes standard deviation for measuring risks and that both negative and positive risks are employed as variables. Li et al. (2014) argue that investors only tend to focus on negative risks. Bodie, Kane, & Marcus (2011) argue that the model limits the role of conventional risk measures. Much as it gauges how much an investment’s returns vary over time, it is affected by downside and upside moves, whereas investors fear losses much more than they value gains (Wang, Song, & Lin, 2017). Xu et al. (2016) argue that it is difficult to use the model for optimizing large portfolios.

After Markowitz, other scholars developed portfolio optimization models. Konno and Yamazaki (1991) developed the mean-absolute deviation (MAD) portfolio optimization model which adopts a mean’s absolute deviation for measuring risk instead of the variance. Based on the guidance by Li et al. (2014), the MAD model is mathematically expressed as:

E| ∑ j=1 n R j x j −E( ∑ j=1 n R j x j ) | ,

where: R j = the random return of asset j.

They also proved that the mean absolute deviation can be approximated as:

E| ∑ j=1 n R j x j −E( ∑ j=1 n R j x j ) |= 1 T ∑ t=1 T | ∑ j=1 n ( r jt − r j ) x j | ,

where: r jt = the realization of random variable R j during period t. Therefore Li et al. (2014) further expressed the MAD model as:

Minimize  1 T ∑ i=1 T | ∑ j=1 n ( r jt − r j ) x j | (6)

Subject to  ∑ i=1 n    r i x i ≥d (7)

∑ i=1 n    x i =1 (8)

x i ≥0  ∀i=1,⋯,n (9)

In the above equations, d is the required rate of return, x i is the weight variable. Constraint (7) is for ensuring that the minimum portfolio return achieves the investors’ minimum requirements. (8) means that the total fraction equals to one, implying that all the money must be invested. (9) means that short selling is prohibited in the model.

Various scholars (Simaan, 1997; Liu & Gao, 2006; Li et al., 2014) have pointed out several advantages of the MAD model. Firstly, it doesn’t require calculating the covariance matrix, this implies that the model is easier to update when new data is available. Secondly, the calculation is less complicated than that of the MV model because the MAD model adopts a linear program, which adopts quadratic programming. Thirdly, the MAD model normally has fewer assets, thus reducing the transaction cost in portfolio revisions.

Value at risk (VaR) is another model that is widely used for risk optimization in the financial services industry (Danielsson, 2011; Xu et al., 2016). The VaR is the measure of loss associated with extreme negative returns (Wang et al., 2017). It is the minimum amount by which an investment or portfolio value of will fall at a given level of probability over a given period of time (ACCA, 2016). It’s a measure of downside risk (Xu et al., 2016). VaR is written into bank regulations and it is closely watched by risk managers (Bodie et al., 2011). It is a risk measure that focuses on extreme outcomes (Wang et al., 2017).

We base on Wang (2000) and Li et al. (2014)’s recommended approach for calculating portfolios under the VaR model. This approach is similar to that of Markowitz’s MV model as it uses VaR value to measure risk and therefore it minimizes the VaR value instead of the variance. It can, therefore, be expressed mathematically as:

Minimize  μ x (10)

Subject to  ∑ i=1 n    r i x i ≥d (11)

∑ i=1 n    x i =1 (12)

x i ≥0   ∀i=1,⋯,n (13)

where: μ x = the portfolio VaR, d is the required rate of return, and x i is the weight variable.

Just like in the case of MV and MAD models, the constraint (11) is for ensuring that minimum portfolio return achieves investors’ minimum requirements. (12) means that the total fraction equals to one, implying that all the money must be invested. (13) means that short selling is prohibited in the model. The VaR model uses variance-covariance approach, and according to Li et al. (2014), the mathematical formula for this can be expressed as:

VaR=M∗λ∗δ∗ t

where: M = portfolio market value, λ = confidence level, δ = volatility of the portfolio and t = time period. As M,λ, t are all constants, δ which is the standard deviation is the only variable in the formula.

2.2. Risk-Based Performance Measures

In addition to analysing the above models in R, we generated the following measures that helped us to explain overall stock performance.

2.2.1. Volatility

Refers to the degree of variation of stock prices over time as measured by the standard deviation (Bodie et al., 2011). It is a statistical measure of dispersion of the returns of a security or market index which can be measured by standard deviation or variance between returns from that same security or market index (Namugaya et al., 2014).

2.2.2. Sharpe Ratio (SR)

It was developed by Sharpe in 1966 and it’s derived from the capital market line (Rana & Akhter, 2015). It’s advantageous because it provides returns (reward) per total risk (volatility) for a security or index (Bodie et al., 2011). Since risk is measured by standard deviation of the security, SR gives a risk and return trade-off (Rana & Akhter, 2015). Therefore, it explains an investor’s compensation for assuming additional risk. Higher SR reflects the superior performance of a security. This reward-to-volatility measure is used for evaluating investment managers’ performance.

2.2.3. Risk Parity (RP)

RP is used in portfolio management to focus on allocation of risk (volatility), instead of capital allocation. The RP approach advocates that when asset allocations are adjusted to the same level of risk, the RP portfolio can achieve a higher SR and become more resistant to market downturns than traditional portfolios (Lee, 2014). This approach to building a RP portfolio is similar to the one of creating a minimum variance portfolio subject to the constraint that each asset contributes equally to overall volatility (Amundi, 2014). RP means that each asset (single stock, asset class, equity sector) has an equal contribution to the total portfolio risk (Amundi, 2014).

2.2.4. Conditional Value at Risk (CVaR) or Expected Shortfall (ES)

ES and CVaR are downside risk measures (Xu et al., 2016). ES is a risk measure used to evaluate market risk or credit risk of a portfolio (Xu et al., 2016). It is the expected portfolio loss when VaR has been breached (Bodie et al., 2011). CVaR helps to estimate the magnitude of expected loss on the very bad days (Xu et al., 2016).

After this review of the literature, we describe the data collection method employed.

3. Data Collection

We utilized the 6.5 years’ historical data for 16 constituent shares listed on the USE indexes (LSI & ALSI). The USE has two indexes, the All Share Index (ALSI) which tracks all the 16 listed companies (8 local and 8 cross-listed at Nairobi Securities Exchange) and the local share index (LSI) which tracks only the 8 local companies. Both indexes are market-cap or value weighted. Stock prices were obtained from the website, https://www.use.or.ug/. Returns of each stock at the closing price of daily trading was computed and used for data analysis.

Data analysis techniques

The calculation of portfolio optimization models includes 6.5 year’s historical data for 16 different stocks from January 2010 to June 2016. All calculations were undertaken using the R language. We tested the performance of models using the same sets of historical data in order to generate an understanding of how stocks performed during the period under study.

A graphical analysis of the movement of the LSI & ALSI between January 2010 and December 2016 is shown in Figure 1 below.

Calculating techniques

The portfolio optimization code was written in R, a software for statistical computing (R Project, 2016). To exemplify our analysis, we considered portfolios of common stocks. Raw data downloaded from USE website contains

Source: (USE product markets|ALSI All share Index|LSI Local share Index).

Figure 1. Movement of ALSI and LSI.

historical prices of each stock. To estimate returns empirically, the daily stock prices were used as follows:

r=In( s i s i−1 )  for i=1,2,⋯,n

The stock returns were converted into .xlsx readable in R language. We also obtained sector numbers of each of the stocks from the USE website. The sector file was converted into a.csv file readable in R language.

3.1. Markowitz’s Mean-Variance (MV) Model Portfolio Settings

>Library (fPortfolio)

MV portfolios are defined by time series data set, the portfolio specification object, and the constraint strings. Specifying the portfolio requires three steps:

Step 1: portfolio data

The portfolio functions expect S4 time series objects. We use Rmetrics time- series package for time series generation. Alternatively, we can load a data set from the demo examples provided in the fPortfolio package (Würtz, Setz, Chalabi, Chen, & Ellis, 2015). The portfolio functions expect time-ordered data records. To sort S4 time series objects, use the generic function sort(). To align time series objects and to manage missing values we use the function align(). If we want to bind and merge several time series to a data set of assets, we can use the functions cbind(), rbind() and merge().

Step 2: portfolio specification

For Markowitz’s MV portfolio we use the default settings (Würtz et al., 2015).

The printout tells us that the portfolio type is concerned with the mean-variance portfolio “MV”, that we want to optimize (minimize) the risk “minrisk” using the quadprog solver “solveRquadprog”, and that the sample covariance estimator “covEstimator” will be applied. The other two parameters shown are the risk- free rate and the number of frontier points. The first will only be used when we calculate the tangency portfolio and the Sharpe ratio, and the second when we calculate the whole efficient frontier (Würtz et al., 2015).

Step 3: portfolio constraints

In most cases, we worked with long-only portfolios.

Specifying forces the lower and upper bounds for the weights to zero and one respectively. Many alternative constraints have already been implemented in fPortfolio. These include unlimited short selling, lower and upper bounds, linear equality and inequality constraints, covariance risk budget constraints, and non- linear function constraints. The solver for dealing with these constraints has to be selected and assigned by the function setSolver().

3.2. Konno and Yamazaki’s Mean-Absolute Deviation Model

For MAD model we also use the default settings and then make the code for portfolio optimization as shown below (Würtz et al., 2015).

3.3. VaR Model

Risk-optimal portfolios can be differentiated from Markowitz’s portfolios based on the fact that a certain VaR or ES (expected shortfall) level is not the result of an efficient portfolio allocation, but an objective (Pfaff, 2016). The market risk measure CVaR is the expected loss exceeding the VaR for a given confidence level (Pfaff, 2016). For CVaR model we can use the default settings as shown below (Würtz et al., 2015).

If we want to create a CVaR portfolio, we have to specify at least the model type, and the solver for the optimization (Würtz et al., 2015).

The R packages used for data analysis include: Financial Risk Modelling and Portfolio Optimization with R (FRAPO) (Pfaff, 2016); Rmetrics-Portfolio Selection and Optimization (FPortfolio) (Pfaff, 2016); Econometric tools for performance and risk analysis (Performance Analytics) (Würtz et al., 2015).

4. Data Analysis

In the previous section, we show details of data collection, data computation, and R portfolio settings. In this section, we articulate how the data has been analysed using R Studio. We start by analysing some multi-asset data for the following major indexes across the world (Pfaff, 2016): GSPC United States (S&P 500 Index (Equity)); GLD United States (SPDR Gold Shares (Commodities)); RUA United States (Russell 3000 Index (Equity)); BG05.L United Kingdom (Gilt All Index (Bonds)); GDAXI Germany (DAX (XETRA) Index (Equity)); GREXP Germany (REX-Performance Index (Bonds)); FTSE United Kingdom (FTSE 100 Index (Equity)); DJCBTI United States (Dow Jones CBOT Treasury Index (Bonds)); N225 Japan (Nikkei 225 Index (Equity)); and EEM iShares (MSCI Emerging Markets Index (Equity)). Based on the guidance by Pfaff (2016), we extracted the price data at end of month for gold, bond indices, and stock for the fourth quarter of 2004 and first quarter of 2005.

The resulting returns are in the following increasing order; N225, FTSE, GDAXI, GSPC, RUA, GREXP, BGO5.L, DJCBTI, GLD, and EEM.

We calculated return series for multi-assets, efficient frontier, and portfolioSpec using a solver; solveRquadprog. This helped us to obtain portfolio weights, covariance risk budgets, and target returns and risks.

A tangency portfolio was computed for the multi-assets using the solver; solveRquadprog as shown below. We obtained portfolio weights, covariance risk budgets, and target returns and risks.

GREXP had the highest portfolio weight followed by GDAXI and GLD. GREXP had the highest covariance risk budgets followed by GLD and GDAXI. The target return was 0.4773, covariance was 0.9110, CVaR was 1.4095 and the VaR was 1.2320.

An efficient frontier for multi-assets was drawn with standard deviation set as 8. We also incorporated minimum tail dependence (MTD) and risk parity (RP) also known as equal risk contribution (ERC) and obtained results on the efficient frontier as shown in Figure 2.

We then executed a two-step RP that enabled us to view risk parity portfolio 2 (RP2) as shown in Figure 3. The graph also indicates maximum Sharpe ratio (MSR) at the blue tangent point on the capital market line originating from zero, minimum volatility (MV) at the purple point showing the lowest level of risk on the efficient frontier, maximum diversified portfolio (MDP) at the green point, which shows the portfolio that maximizes diversification ratio (DR) and risk parity (RP) at the red point, which advocates that when asset allocations are adjusted to the same level of risk, the RP portfolio can achieve a higher SR and can be resistant to market fluctuations.

We then obtained the concentration of the multi-asset data as shown below. Indicating that GREXP was dominating other indexes in the world market, followed by GLD and GDAXI.

Various portfolios were obtained as shown in the pie charts plots in Figure 4, showing GREXP dominating other indexes in the following portfolios; 8%

Figure 2. Efficient frontier.

Figure 3. The efficient frontier with various portfolios.

Figure 4. Pie chart plots for world major indexes.

volatility portfolio, maximum Sharpe ratio, minimum volatility portfolio, maximum diversified portfolio, risk parity portfolio and 2-stage risk parity portfolio.

Uganda Securities Exchange (USE) Data Analysis

After having a thorough analysis of world major stock indexes data, we then focused on USE data. We read the USE data in R language using the following code and assumed 250 working days in a year:

We then extracted the MV portfolio frontier data as shown by the following output indicating the portfolio weights, covariance risk budgets and target returns and risk for the 2 indexes and 16 stocks listed on the USE.

We obtained the MV tangency portfolio for all stocks listed on USE showing that BATU had the highest portfolio weight and covariance risk budget followed by JHL. ALSI dominated LCI in terms of portfolio weight and covariance risk budget over the 6.5 year period. The mean return was 0.0012, covariance was 0.0100, CVaR was 0.0161 and VaR was 0.0091.

We then extracted the MAD efficient portfolio showing that UMEME dominated in terms of portfolio weight followed by NVL, BATU, and JHL. In terms of covariance risk budget, BATU dominated other stocks followed by UMEME, JHL, and NVL. ALSI dominated LCI in terms of portfolio weight and covariance risk budget over the 6.5 year period. The mean return was 0.0008, covariance was 0.0073, CVaR was 0.0143 and VaR was 0.0085.

We plotted an efficient frontier showing MSR, MV, RP and RP2 at 12% volatility as shown in Figure 5.We obtained the concentration of the data which indicated that ALSI was the dominant index. The best-performing stocks are UMEME, NVL, BATU, JHL, DFCU, EBL, EABL, KCB, SBU and CENT.

Figure 5. The efficient frontier with various USE portfolios.

Cardinality shows the performance of portfolios in the following order; w_MV, w_MSR, w_8, w_RP and w_RP2.

A plot for the various portfolio histograms is as shown in Figure 6.

We used R to get the risk parity plot by typing > plot(w_RP), > plot (w_RP2), > plot (w_MSR), > plot (w_MDP), > plot (w_MV) and > plot (w_MTD) in the console then Ctrl+R. The following graphs in Figure 7 resulted.

We used R to get the volatility of all stocks under study by typing > vol in the console then Ctrl+R. The following results were extracted showing that the most volatile stocks were NVL, UMEME, DFCU and KCB in that order. The least volatile stocks were NMG, SBU, UCL and BOBU in that order. ALSI was more

Figure 6. Portfolio histograms.

Figure 7. Portfolio graphs.

volatile than LCI for the period under study.

This could also be obtained by looking at the head and tail by using > head (vol) then Ctrl+R, > tail (vol) then Ctrl+R. The following results in the console.

We used > list (w_RP), > list (w_RP2), > list (w_MDP), > list (w_MSR), > list (w_MTD), and > list (w_MV) to get the various portfolios as shown below.

We extracted the minimum and maximum values of the various portfolios as shown below.

We extracted pie chart plots showing the USE portfolios and the multi-asset portfolio as the Max Diversified portfolio as shown in Figure 8.

Analysis of USE portfolios indicates that the best-performing stocks were UMEME, NVL, BATU, JHL, DFCU, EBL, EABL, KCB, SBU and CENT. From the pie charts NMG, SBU, UCL and BOBU had the lowest volatility, however, NVL, UMEME, DFCU and KCB had the highest volatility. Volatility reflects the

Figure 8. Pie chart plots USE portfolios and the multi-asset portfolio.

variation of stock prices over time as measured by the standard deviation. BATU, UMEME, JHL and EBL had the highest Sharpe ratio. Highest SR reflects the superior performance of stocks. It explains how well investors are compensated for assuming additional risk. NVL, UMEME, and DFCU had the highest risk parity.

5. Discussions

ALSI dominated LCI in overall performance because of the benefits of cross- listing. The LCI performance is based on a single listing on USE. The NSE is more developed than USE, therefore various benefits accrue from the cross- listing. Increased marketability for firms’ securities and access to a broader investor base are the major benefits of cross-listings (Chouinard & D’Souza, 2004). Other benefits (De Landsheere, 2012) include financial gains; liquidity; increase in the volume of trading; reduced cost of capital; increased shareholder base; and the establishment of a secondary market for shares used in acquisitions.

Managers prefer debt issuance (increase gearing) when the share price is low and issuance of equity when the share price is high. The resulting issue of debt or equity is used by investors as a signal from managers as to the true worth of the company’s shares. The information asymmetry between investors and managers can be used to value shares (ACCA, 2016). When equity is issued, the market takes it as a signal that shares are overvalued. This may make investors sell their shares and make substantial gains which lead to a fall in the share price. As a result, the cost of equity rises, which leads to a higher marginal cost of finance. To avoid this scenario, managers may issue debt even if shares are seen as overvalued. The issue of debt is interpreted as share undervaluation. Investors will have an incentive to get a bargain and will, therefore, start to buy the shares, leading to an increase in share price (ACCA, 2016).

We establish the major reasons behind individual best-performing stocks based on the latest financial statements; UMEME, NVL, BATU, JHL, DFCU, EBL, EABL, KCB, SBU and CENT. 2016 trading statistics show that UMEME was the largest trading listed company followed by Stanbic Bank Uganda (SBU) and DFCU respectively. UMEME is held by a broad range of investors and it provided a float of 100% hence it has more shares that trade on the secondary market. This results in UMEME trading more shares. SBU offered only 20% of its shares in 2006 to the public. When long-term investors like NSSF buy shares, they hold for a longer period and lock up liquidity. The kind of float provided and the nature of investors determine the turnover (Bwiso, 2017).

Over the period UMEME embarked on continuous investment, staff engagement, and public sensitization and safety improvements. Several country-wide campaigns against illegal power connections increased. The company invested $500 million in distribution network expansion, new connections and rollout of prepaid metering. This resulted in improved electricity supply, increased grid connections and reduction in network outages. Energy loss reduced over the period. Customer numbers increased especially due to prepaid metering, with 65% in 2016 compared to the 52.2% in 2015. Prepaid revenue as a percentage of total revenue increased to 16.3% in 2016 compared to 11.6% in 2015. Revenue collection rate increased from 98.2% in 2015 to 98.4% in 2016, supported by prepayment metering and multiple payment platforms for customers. UMEME believes that the collection rate is a good performance considering the challenging business environment. The weak economic growth affected UMEME’s net profit which fell by 6% according to the financial results of 2016 (UMEME, 2017). Analysis of the statement of financial position of UMEME shows that its long-term debt is Ushs. 578,416 million, while the short-term debt is Ushs. 124,021 million as at December 31, 2016. This is an indication of increased gearing. It confirms our results that UMEME is one of the stocks with the highest volatility, Sharpe ratio and risk parity. Earnings per share (EPS) and return on equity (ROE) are more volatile for geared companies (ACCA, 2016). The managers of UMEME thus undervalued its shares. Investors interested in making future bargains may buy now because share prices are likely to increase in future.

The profit for SBU increase by 26.8% as at end of December 31, 2016. The EPS moved from 2.95 in 2015 to 3.73 in 2016. SBU assets are mainly; government securities held for trading, government securities available for sale, loans and advances to customers, and Loans and advances to banks. The Directors of SBU proposed a dividend for the year ended 31 December 2016 of Ushs 1.172 per share (SBU, 2017). The major liabilities of SBU are; deposits from banks, deposits from customers, amounts due to group companies, and low borrowed funds. The company is therefore not heavily geared. This confirms our results that SBU is one of the stocks with the lowest volatility.

The DFCU profits increased by 25% in 2016. The financial statements were approved by the board on 20 March 2017. The Board recommended a cash dividend of Ushs. 25.19 per share less withholding tax where applicable (2015: Ushs 21.73 per share). The major assets of DFCU include; marketable (trading) securities, loans and advances, investment securities. The major liability of DFCU is the deposits from customers. The company is not heavily geared and its volatility is low based on our analysis (DFCU, 2017). DFCU is one of the stocks with highest risk parity, which implies that it contributes a low level of risk to a portfolio. Based on our analysis, we advise investors to invest in DFCU stock as it would guarantee a return on investment.

BATU’s gross revenue was relatively stable at Ushs 139 billion in 2016 relative to 2015 which was Ushs 141 billion reflecting higher excise driven prices offset by lower volumes. Profit after tax from continuing operations dropped by 25% reflecting the impact of excise-driven price increases in the domestic market. Cumulative excise increases for 2015 and 2016 amounted to 40%. This increase, coupled with a tough economic environment impacted negatively on consumer disposable incomes. BATU remains a significant contributor to Uganda’s revenues. Excise duty and Value Added Tax (VAT) increased from Ushs 71 billion in 2015 to Ushs 74 billion in 2016, an increase of 4%. Total comprehensive income for the year reduced by 62%, reflecting the discontinuation of the leaf business in 2015 and lower cigarette profitability (BATU, 2017). However, BATU had the highest Sharpe Ratio. Therefore, the stock had a superior performance and investors were compensated for assuming additional risk. Investors are advised to invest in this stock as its superior performance is expected to continue in the future.

NVL turnover reduced by 10.2% from 2015 with commercial printing and circulation revenue centres registering the biggest decline. The low revenue performance was attributed to reduced media spending coupled with a low level of economic activity in the industry. The cost of sales decreased by 8.9% from 2015 mainly on account of reduced production volumes to match the decline in revenue levels whereas administrative expenses increased by 7.7%. The Directors did not recommend payment of an interim dividend (NVL, 2017).

JHL Directors proposed a bonus share issue of 1 share for every 10 shares held and the payment of a final dividend of Kshs. 7.50 per share, subject to withholding tax where applicable making a total of Kshs. 8.50 per share. The dividend was paid on July 11, 2017, to members on the register, after approval at the Annual General Meeting (JHL, 2017). JHL had a high Sharpe Ratio. The stock’s superior performance compensated investors for assuming additional risk. Superior performance is expected to continue in the future.

The Directors of KCB recommend a dividend for the year ended December 31, 2016, of Kshs. 3 per share (KCB, 2017).

The tough economic conditions in 2016 did not only affect the banking sector but extended to the insurance sector as well, the NIC Holdings financial results were analysed. The NIC Board recommended for the approval of shareholders a payment of Shs1/-(One Shilling) for every ordinary share held at the close of the register on 15th September 2017 out of the retained earnings as at 31st December 2016 subject to withholding tax at the appropriate rate (NIC, 2017).

6. Recommendations

The Ugandan capital market is endowed with various investment opportunities in debt and equity securities. It is less risky to invest in listed companies or government securities as compared to investing in taxis or boda-bodas.

Government securities are debt instruments issued to the public by the government through Bank of Uganda (BOU). The public can place funds with government through opening Central Securities Depository (CDS) accounts at BOU.

Government securities are in form of Treasury Bills or Treasury Bonds. Treasury Bills involve placing funds on CDS accounts for a period not exceeding one year while Treasury Bonds are long-term investments exceeding one year.

Commercial banks can now open CDS accounts for the public on behalf of BOU. This is a convenient way that enables easy access to investment in government securities.

Investing in government securities is advantageous as it offers competitive interest rates, can be used as collateral for borrowing, has minimal credit risk, can be liquidated anytime at competitive rates and acts as saving and investment mechanism.

We, therefore urge the public to invest in government securities given that they are safe assets. Since there is need to increase the saving culture in Uganda, the liquid securities provide both saving and investment opportunities for changing livelihoods.

7. Conclusion

From the pie chart plots extracted and the data analysis, we can see that GREXP bonds dominated the world market as they accounted for more than 60% of the Maximum Diversified Portfolio (MDP). When it comes to USE, ALSI dominates LCI in most portfolios during the entire period under study. UMEME, NVL, BATU, JHL, DFCU, EBL, EABL, KCB, SBU and CENT were the best-performing stocks for the 6.5 years. We, therefore, advise investors in Uganda and the world at large to invest in diversified portfolios containing stocks listed on the USE as this will guarantee them of earning returns on their investments.

Acknowledgements

We thank the anonymous reviewers for their comments. We acknowledge the support from the Central Bank of Uganda. Special thanks to Andrew Mwima, the manager trading at USE and Joseph Lutwama, the Director Research and Market development at CMA for their support. The views expressed in this article are those of the authors and not necessarily the institutions affiliated with the study. The usual caveats apply.

Cite this paper
Baganzi, R. , Kim, B. and Shin, G. (2017) Portfolio Optimization Modelling with R for Enhancing Decision Making and Prediction in Case of Uganda Securities Exchange. Journal of Financial Risk Management, 6, 325-351. doi: 10.4236/jfrm.2017.64024.
References
[1]   ACCA (2016). ACCA P4, Advanced Financial Management (9th ed.). London: BPP Learning Media Ltd.

[2]   ACCA (2017). ACCA P1, Governance, Risk and Ethics.

[3]   Amundi (2014). Amundi Asset Management: Investment Strategy Collected Research Papers.

[4]   BATU (2017). BATU Full Year Results 31 December 2016. Kampala.
https://www.use.or.ug/uploads/reports/company/BATU/BATU%20Full%20Year%20Results%2031
%20December%202016.pdf


[5]   Bodie, Z., Kane, A., & Marcus, A. J. (2011). Investments (9th ed.). New York, NY: McGraw-Hill.

[6]   Busuulwa, B. (2016). Commodities Exchange Launched in Kampala. The East African.
http://www.theeastafrican.co.ke/business/Commodities-exchange--launched-in-Kampala/-/
2560/3297646/-/rj2rwe/-/index.html


[7]   Bwiso, P. (2017). An Interview with Paul Bwiso: The Future of USE; Which Are the Top four Listed Companies in Terms of Turnover and Why (pp. 1-37)? Summit Business Review.
https://www.summitbusiness.net/sbdigital/SBR%20March-April%202017/files/assets/common/
downloads/SBR%20March-April%202017.pdf


[8]   Chen, G., Liao, X., & Wang, S. (2009). A Cutting Plane Algorithm for MV Portfolio Selection Model. Applied Mathematics and Computation, 215, 1456-1462.

[9]   Chouinard, E., & D’Souza, C. (2004). The Rationale for Cross-Border Listings. Bank of Canada Review, 1, 1-23.

[10]   CMA (2017). Who We Are.
http://www.cmauganda.co.ug/ug/smenu/1/Who-We-Are.html

[11]   Danielsson, J. (2011). Financial Risk Forecasting, the Theory and Practice of Forecasting Market Risk, with Implementation in R and Matlab. John Wiley & Sons Ltd.

[12]   De Landsheere, J. (2012). Cross-Listing in the 21st Century “Benefits of ADR-Listings: An Ending Story?” Tilburg University.
http://arno.uvt.nl/show.cgi?fid=128400

[13]   DFCU (2017). DFCU Bank Full Year Results 31 December 2016. Kampala.
https://www.use.or.ug/uploads/reports/company/DFCU/DFCU%20BANK%20Full%20Year%
20Results%2031%20December%202016.pdf


[14]   Haimes, Y. (2009) On the Complex Definition of Risk: A Systems-Based Approach. Risk Analysis. An International Journal, 29, 1647-1654.

[15]   Hansson, S. O. (1996). What Is Philosophy of Risk? Theoria, 29, 1647-1654.
https://doi.org/10.1111/j.1755-2567.1996.tb00536.x

[16]   JHL (2017). JHL Announcement 2016 Audited Consolidated Results. Kampala.
https://www.dse.co.tz/sites/default/files/dsefiles/JHLAnnouncement-2016Audited
ConsolidatedResults.pdf


[17]   Kasekende, L. (2017a). At the 4th Edition of the Uganda National Journalism Awards; African Centre for Media Excellence (ACME). Kampala.
https://www.bou.or.ug/bou/bou-downloads/speeches/DeputyGovernorsSpeeches/2017/April/
Remarks-by-Dr-Kasekende_2017-Uganda-National-Journalism-Awards_April-2017.pdf


[18]   Kasekende, L. (2017b). Launch of the 10-Year Capital Markets Development Master Plan. Kampala.
http://www.bis.org/review/r170726a.htm

[19]   KCB (2017). KCB-Group-Financial-Results-FY16. Nairobi.
https://ke.kcbbankgroup.com/images/downloads/KCB-Group-Financial-Results-FY16.pdf

[20]   Konno, H., & Yamazaki, H. (1991). Mean-Absolute Deviation Portfolio Optimization Model and Its Applications to Tokyo Stock Market. Management Science, 37, 519-531.
https://doi.org/10.1287/mnsc.37.5.519

[21]   Krause, T., Ehsani, S., & Lien, D. (2014). Exchange-Traded Funds, Liquidity and Volatility. Applied Financial Economics, 24, 1617-1630.
https://doi.org/10.1080/09603107.2014.941530

[22]   Lee, W. (2014). Constraints and Innovations for Pension Investment: The Cases of Risk Parity and Risk Premia Investing. The Journal of Portfolio Management, 40, 12-20.
http://www.bfjlaward.com/pdf/25949/12-20_Lee_JPM_0417.pdf
https://doi.org/10.3905/jpm.2014.40.3.012


[23]   Li, W. C., Wu, Y., & Ojiako, U. (2014). Using Portfolio Optimisation Models to Enhance Decision Making and Prediction. Journal of Modelling in Management, 9, 36-57.
https://doi.org/10.1108/JM2-11-2011-0057

[24]   Liu, M., & Gao, Y. (2006). An Algorithm for Portfolio Selection in a Frictional Market. Applied Mathematics and Computation, 182, 1629-1638.

[25]   Luenberger, D. G. (1998). Investment Science. New York, NY: Oxford University Press.

[26]   Markowitz, H. (1952). Portfolio Selection. The Journal of Finance, 7, 77-91.

[27]   Mayanja, F., Mataramvura, S., & Mahera, C. W. (2013). A Mathematical Approach to a Stocks Portfolio Selection: The Case of Uganda Securities Exchange (USE). Journal of Mathematical Finance, 2, 487-501.
https://doi.org/10.4236/jmf.2013.34051

[28]   Mutebile, E. T. (2017). Investing in Government Securities Now Easier and More Accessible to the Public.
https://www.bou.or.ug/bou/bou-downloads/press_releases/2017/Apr/Investing-in-Government
-Securities-Now-Easier-and-More-Accessible-to-the-Public.pdf


[29]   Namugaya, J., Weke, P. G. O., & Charles, W. M. (2014). Modelling Stock Returns Volatility on Uganda Securities Exchange. Applied Mathematical Sciences, 8, 5173-5184.
https://doi.org/10.12988/ams.2014.46394

[30]   Naslund, B., & Whinston, A. (1964). Model of Decision Making under Risk. Metroeconomica, 16, 81-94.
https://doi.org/10.1111/j.1467-999X.1964.tb00842.x

[31]   NIC (2017). National Insurance Corporation Full Year 31 December 2016. Kampala.
https://www.use.or.ug/uploads/reports/company/SBU/Stanbic%20Bank%20Uganda%20Full%
20Year%20Results%2031%20December%202016.pdf


[32]   Njanike, K., Katsuro, P., & Mudzura, M. (2009). Factors Influencing the Zimbabwe Stock Exchange Performance (2002-2007). Annals of the University of Petrosani, Economics, 9, 161-172.

[33]   NSE (2017). About NSE.
https://www.nse.co.ke/nse/about-nse.html

[34]   NVL (2017). New Vision Limited Full Year Results 31 December 2016. Kampala.
https://www.use.or.ug/uploads/reports/company/NVL/NewVisionGroupHalfYearResults 31
December2016.pdf


[35]   Pfaff, B. (2016). Financial Risk Modelling and Portfolio Optimization with R (2nd ed.). Wiley.
https://doi.org/10.1002/9781119119692

[36]   Polak, G. G., Rogers, D. F., & Sweeney, D. J. (2010). Risk Management Strategies via Minimax Portfolio Optimization. European Journal of Operational Research, 207, 409-419.

[37]   Quaye, I., Mu, Y., Abudu, B., & Agyare, R. (2016). Review of Stock Markets’ Reaction to New Events: Evidence from Brexit. Journal of Financial Risk Management, 5, 281-314.
https://doi.org/10.4236/jfrm.2016.54025

[38]   Rana, M. E., & Akhter, W. (2015). Performance of Islamic and Conventional Stock Indices: Empirical Evidence from an Emerging Economy. Financial Innovation, 1, 1-17.
https://doi.org/10.1186/s40854-015-0016-3

[39]   R Project (2016). The R Project for Statistical Computing.
https://www.r-project.org/

[40]   Reuters (2016). ALTX Africa Targets Small Investors with New Uganda Exchange. Reuters.
http://af.reuters.com/article/ugandaNews/idAFL8N19Z3U1

[41]   SBU (2017). Stanbic Bank Uganda Limited Annual Report 2016. Kampala.
https://www.use.or.ug/uploads/reports/company/SBU/StanbicBankUgandaFullYearResults31
December2016.pdf


[42]   Semakula, J. (2017). Kasekende Challenges Journalists on Integrity. New Vision Uganda. Kampala.
http://www.newvision.co.ug/new_vision/news/1451074/kasekende-challenges-journalists-integrity

[43]   Simaan, Y. (1997). Estimation Risk in Portfolio Selection: The Mean Variance Model versus the Mean Absolute Deviation Model. Management Science, 43, 1437-1446.
https://doi.org/10.1287/mnsc.43.10.1437

[44]   Simon, H. (1959). Theories of Decision-Making in Economics and Behavioral Science. American Economic Review, 49, 253-283.

[45]   Sitkin, S., & Pablo, A. (1992). Reconceptualizing the Determinants of Risk Behavior. Academy of Management Review, 17, 9-38.

[46]   UMEME (2017). UMEME Full Year Results 31 December 2016. Kampala.
https://www.use.or.ug/uploads/reports/company/UMEM/UMEME%20Full%20Year%20Results%
2031%20December%202016.pdf


[47]   USE (2017a). Role of USE.
https://www.use.or.ug/content/role-use

[48]   USE (2017b). USE Background.
https://www.use.or.ug/

[49]   Wang, D., Song, J., & Lin, Y. (2017). Does the VaR Measurement using Monte-Carlo Simulation Work in China?—Evidence from Chinese Listed Banks. Journal of Financial Risk Management, 6, 66-78.
https://doi.org/10.4236/jfrm.2017.61006

[50]   Ward, S. (2003). Linked References Are Available on JSTOR for This Article: Approaches to Integrated Risk Management: A Multi-Dimensional Framework. Risk Management: An International Journal, 5, 7-23.

[51]   Watson, S., & Brown, R. (1978). The Valuation of Decision Analysis. Journal of the Royal Statistical Society, 141, 69-78.
https://doi.org/10.2307/2344777

[52]   Würtz, D., Setz, T., Chalabi, Y., Chen, W., & Ellis, A. (2015). Portfolio Optimization with Rmetrics. Rmetrics Association & Finance Online Publishing.

[53]   Xu, Q., Zhou, Y., Jiang, C., Yu, K., & Niu, X. (2016). A Large CVaR-Based Portfolio Selection Model with Weight Constraints. Economic Modelling, 59, 436-447.

 
 
Top