optimalPortfolio: Optimal portfolio

Description Usage Arguments Details Value Author(s) References Examples

View source: R/optimalPortfolio.R

Description

Function wich computes the optimal portfolio's weights.

Usage

1
optimalPortfolio(Sigma, mu = NULL, semiDev = NULL, control = list())

Arguments

Sigma

a (N x N) covariance matrix.

mu

a (N x 1) vector of expected returns. Default: mu = NULL.

semiDev

a vector (N x 1) of semideviations. Default: semiDev = NULL.

control

control parameters (see *Details*).

Details

The argument control is a list that can supply any of the following components:

Value

A (N x 1) vector of optimal portfolio weights.

Author(s)

David Ardia, Kris Boudt and Jean-Philippe Gagnon Fleury.

References

Amenc, N., Goltz, F., Martellini, L., Retowsky, P. (2011). Efficient indexation: An alternatice to cap-weightes indices. Journal of Investment Management 9(4), pp.1-23.

Ardia, D., Boudt, K. (2015). Implied expected returns and the choice of a mean-variance efficient portfolio proxy. Journal of Portfolio Management 41(4), pp.66-81. doi: 10.3905/jpm.2015.41.4.068

Ardia, D., Bolliger, G., Boudt, K., Gagnon-Fleury, J.-P. (2017). The Impact of covariance misspecification in risk-based portfolios. Annals of Operations Research 254(1-2), pp.1-16. doi: 10.1007/s10479-017-2474-7

Choueifaty, Y., Coignard, Y. (2008). Toward maximum diversification. Journal of Portfolio Management 35(1), pp.40-51.

Choueifaty, Y., Froidure, T., Reynier, J. (2013). Properties of the most diversified portfolio. Journal of Investment Strategies 2(2), pp.49-70.

Das, S., Markowitz, H., Scheid, J., Statman, M. (2010). Portfolio optimization with mental accounts. Journal of Financial and Quantitative Analysis 45(2), pp.311-334.

DeMiguel, V., Garlappi, L., Uppal, R. (2009). Optimal versus naive diversification: How inefficient is the 1/n portfolio strategy. Review of Financial Studies 22(5), pp.1915-1953.

Fan, J., Zhang, J., Yu, K. (2012). Vast portfolio selection with gross-exposure constraints. Journal of the American Statistical Association 107(498), pp.592-606.

Maillard, S., Roncalli, T., Teiletche, J. (2010). The properties of equally weighted risk contribution portfolios. Journal of Portfolio Management 36(4), pp.60-70.

Martellini, L. (2008). Towards the design of better equity benchmarks. Journal of Portfolio Management 34(4), Summer,pp.34-41.

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Load returns of assets or portfolios
data("Industry_10")
rets = Industry_10

# Mean estimation
mu = meanEstimation(rets)

# Covariance estimation
Sigma = covEstimation(rets)

# Semi-deviation estimation
semiDev = semidevEstimation(rets)

# Mean-variance portfolio without constraint and gamma = 0.89
optimalPortfolio(mu = mu, Sigma = Sigma)

# Mean-variance portfolio without constraint and gamma = 1
optimalPortfolio(mu = mu, Sigma = Sigma, 
  control = list(gamma = 1))

# Mean-variance portfolio without constraint and gamma = 0.89
optimalPortfolio(mu = mu, Sigma = Sigma, 
  control = list(type = 'mv'))

# Mean-variance portfolio without constraint and gamma = 0.89
optimalPortfolio(mu = mu, Sigma = Sigma, 
  control = list(type = 'mv', constraint = 'none'))

# Mean-variance portfolio with the long-only constraint and gamma = 0.89
optimalPortfolio(mu = mu, Sigma = Sigma, 
  control = list(type = 'mv', constraint = 'lo'))

# Mean-variance portfolio with LB and UB constraints
optimalPortfolio(mu = mu, Sigma = Sigma, 
  control = list(type = 'mv', constraint = 'user', LB = rep(0.02, 10), UB = rep(0.8, 10)))

# Mean-variance portfolio with the gross constraint, 
# gross constraint parameter = 1.6 and gamma = 0.89
optimalPortfolio(mu = mu, Sigma = Sigma, 
  control = list(type = 'mv', constraint = 'gross'))

# Mean-variance portfolio with the gross constraint, 
# gross constraint parameter = 1.2 and gamma = 0.89
optimalPortfolio(mu = mu, Sigma = Sigma, 
  control = list(type = 'mv', constraint = 'gross', gross.c = 1.2))

# Minimum volatility portfolio without constraint
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'minvol'))

# Minimum volatility portfolio without constraint
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'minvol', constraint = 'none'))

# Minimim volatility portfolio with the long-only constraint
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'minvol', constraint = 'lo'))
  
# Minimim volatility portfolio with LB and UB constraints
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'minvol', constraint = 'user', LB = rep(0.02, 10), UB = rep(0.8, 10)))

# Minimum volatility portfolio with the gross constraint 
# and the gross constraint parameter = 1.6
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'minvol', constraint = 'gross'))

# Minimum volatility portfolio with the gross constraint 
# and the gross parameter = 1.2
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'minvol', constraint = 'gross', gross.c = 1.2))
    
# Inverse volatility portfolio
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'invvol'))

# Equal-risk-contribution portfolio with the long-only constraint
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'erc', constraint = 'lo'))
  
# Equal-risk-contribution portfolio with LB and UB constraints
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'erc', constraint = 'user', LB = rep(0.02, 10), UB = rep(0.8, 10)))

# Maximum diversification portfolio without constraint
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'maxdiv'))

# Maximum diversification portoflio with the long-only constraint
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'maxdiv', constraint = 'lo'))
  
# Maximum diversification portoflio with LB and UB constraints
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'maxdiv', constraint = 'user', LB = rep(0.02, 10), UB = rep(0.8, 10)))

# Risk-efficient portfolio without constraint
optimalPortfolio(Sigma = Sigma, semiDev = semiDev, 
  control = list(type = 'riskeff'))

# Risk-efficient portfolio with the long-only constraint
optimalPortfolio(Sigma = Sigma, semiDev = semiDev, 
  control = list(type = 'riskeff', constraint = 'lo'))
  
# Risk-efficient portfolio with LB and UB constraints
optimalPortfolio(Sigma = Sigma, semiDev = semiDev, 
  control = list(type = 'riskeff', constraint = 'user', LB = rep(0.02, 10), UB = rep(0.8, 10)))
  
# Maximum decorrelation portfolio without constraint
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'maxdec'))

# Maximum decorrelation portoflio with the long-only constraint
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'maxdec', constraint = 'lo'))
  
# Maximum decorrelation portoflio with LB and UB constraints
optimalPortfolio(Sigma = Sigma, 
  control = list(type = 'maxdec', constraint = 'user', LB = rep(0.02, 10), UB = rep(0.8, 10)))

Example output

      NoDur       Durbl       Manuf       Enrgy       HiTec       Telcm 
 0.26695643 -0.08924691 -0.63735698 -0.69270501  0.89989319 -0.82742959 
      Shops        Hlth       Utils       Other 
 0.14848186  0.49988613  1.20518357  0.22633732 
      NoDur       Durbl       Manuf       Enrgy       HiTec       Telcm 
 0.26695643 -0.08924691 -0.63735698 -0.69270501  0.89989319 -0.82742959 
      Shops        Hlth       Utils       Other 
 0.14848186  0.49988613  1.20518357  0.22633732 
      NoDur       Durbl       Manuf       Enrgy       HiTec       Telcm 
 0.26695643 -0.08924691 -0.63735698 -0.69270501  0.89989319 -0.82742959 
      Shops        Hlth       Utils       Other 
 0.14848186  0.49988613  1.20518357  0.22633732 
      NoDur       Durbl       Manuf       Enrgy       HiTec       Telcm 
 0.26695643 -0.08924691 -0.63735698 -0.69270501  0.89989319 -0.82742959 
      Shops        Hlth       Utils       Other 
 0.14848186  0.49988613  1.20518357  0.22633732 
 [1] 4.564416e-01 2.260724e-17 0.000000e+00 3.311876e-17 0.000000e+00
 [6] 0.000000e+00 1.660164e-01 2.351749e-02 3.540246e-01 0.000000e+00
 [1] 0.4278002 0.0200000 0.0200000 0.0200000 0.0200000 0.0200000 0.0923945
 [8] 0.0200000 0.3398053 0.0200000
For consistency with the rest of the package the inequality sign may be switched from >= to <= in a future nloptr version.
 [1]  4.536944e-01 -1.741167e-01  7.271734e-07 -1.258798e-01  9.431759e-02
 [6]  9.039492e-03  2.830105e-01  5.425086e-02  4.056865e-01 -3.556898e-06
For consistency with the rest of the package the inequality sign may be switched from >= to <= in a future nloptr version.
 [1]  4.667712e-01 -5.484142e-03  1.901907e-06 -9.451550e-02  1.894288e-07
 [6]  5.635764e-06  1.945999e-01  4.178636e-02  3.968320e-01  2.464799e-06
       NoDur        Durbl        Manuf        Enrgy        HiTec        Telcm 
 0.497615869 -0.213681819  0.162570800 -0.009689487 -0.047806452  0.194800211 
       Shops         Hlth        Utils        Other 
 0.337721859 -0.032518014  0.232414214 -0.121427181 
       NoDur        Durbl        Manuf        Enrgy        HiTec        Telcm 
 0.497615869 -0.213681819  0.162570800 -0.009689487 -0.047806452  0.194800211 
       Shops         Hlth        Utils        Other 
 0.337721859 -0.032518014  0.232414214 -0.121427181 
 [1] 5.138280e-01 2.258232e-17 2.605669e-17 0.000000e+00 0.000000e+00
 [6] 1.008340e-01 1.297253e-01 0.000000e+00 2.556126e-01 9.694292e-17
 [1] 0.49740150 0.02000000 0.02000000 0.02000000 0.02000000 0.06154041
 [7] 0.07421558 0.02000000 0.24684252 0.02000000
For consistency with the rest of the package the inequality sign may be switched from >= to <= in a future nloptr version.
 [1]  5.048999e-01 -1.985812e-01  6.610667e-02 -1.945711e-06 -2.261382e-02
 [6]  1.808213e-01  3.083723e-01 -3.107834e-02  2.397998e-01 -4.772474e-02
For consistency with the rest of the package the inequality sign may be switched from >= to <= in a future nloptr version.
 [1]  5.081238e-01 -9.999722e-02  2.732414e-06 -1.035909e-07 -6.660731e-07
 [6]  1.342550e-01  2.069553e-01 -2.010851e-06  2.506631e-01  7.920099e-08
     NoDur      Durbl      Manuf      Enrgy      HiTec      Telcm      Shops 
0.13124351 0.07929370 0.10728283 0.06813935 0.09474918 0.11002180 0.11397215 
      Hlth      Utils      Other 
0.08632901 0.10657287 0.10239559 
 [1] 0.12802268 0.07593893 0.09388514 0.08008504 0.08771300 0.10761739
 [7] 0.10883223 0.08887073 0.13724700 0.09178788
 [1] 0.12802268 0.07593893 0.09388514 0.08008504 0.08771300 0.10761739
 [7] 0.10883223 0.08887073 0.13724700 0.09178788
 [1]  0.19953375  0.21260437 -0.91227860  0.32927277  0.09342081  0.19319866
 [7]  0.21367985  0.22326864  0.35040255  0.09689721
 [1] 1.596802e-03 4.426586e-02 0.000000e+00 1.829356e-01 5.535334e-18
 [6] 1.092012e-01 1.528876e-01 1.821066e-01 3.270063e-01 0.000000e+00
 [1] 0.02000000 0.03300903 0.02000000 0.17686650 0.02000000 0.09165413
 [7] 0.12623377 0.16992510 0.32231147 0.02000000
 [1] 0.05000000 0.05000000 0.05000000 0.20000000 0.05000000 0.16008348
 [7] 0.11292109 0.07699543 0.20000000 0.05000000
 [1] 5.431118e-02 3.091289e-02 4.159338e-17 2.000000e-01 0.000000e+00
 [6] 2.000000e-01 2.000000e-01 1.147759e-01 2.000000e-01 0.000000e+00
 [1] 0.02000000 0.02000000 0.02000000 0.21833697 0.02000000 0.16001791
 [7] 0.16107948 0.08907247 0.27149318 0.02000000
       NoDur        Durbl        Manuf        Enrgy        HiTec        Telcm 
 0.497615869 -0.213681819  0.162570800 -0.009689487 -0.047806452  0.194800211 
       Shops         Hlth        Utils        Other 
 0.337721859 -0.032518014  0.232414214 -0.121427181 
 [1] 1.130001e-03 5.184858e-02 2.565072e-17 2.493486e-01 0.000000e+00
 [6] 9.218392e-02 1.245892e-01 1.959186e-01 2.849811e-01 0.000000e+00
 [1] 0.02000000 0.03587518 0.02000000 0.24082550 0.02000000 0.07715694
 [7] 0.10209835 0.18173042 0.28231361 0.02000000

RiskPortfolios documentation built on May 17, 2021, 1:10 a.m.