The purpose of this vignette is to demonstrate a sample of the optimization problems that can be solved by using the ROML.portfolio package. Based on ROML (R Optimization Modeling Language), the ROML.portfolio package offers build-in functions for solving complex portfolio optimization models.
The newest version of ROML
is available at "http://R-Forge.R-project.org"
. Due to changes in R-3.3.1
the package slam
depends now on R >= 3.3.1
. Therfore, if you use an R version older than R-3.3.1
you will have to install the package slam
from the archive (as also shown below).
## NOTE: Since slam Version 0.1-38 it depends on R Version >= 3.3.1
if ( as.numeric(R.Version()$minor) >= 3.1 ) {
install.packages("slam")
} else {
url <- "https://cran.r-project.org/src/contrib/Archive/slam/slam_0.1-37.tar.gz"
if ( .Platform$OS.type == "unix" ) { ## unix
install.packages(url, repos=NULL, method="wget")
} else { ## windows
install.packages(url, repos=NULL, method="internal")
}
}
install.packages("registry")
install.packages("ROI")
If previously no ROI version was installed, one should at least install the two plugins ROI.plugin.glpk
and ROI.plugin.quadprog
to run the examples below.
## NOTE: (Rglpk needs libglpk-dev on Debian/Ubuntu ("sudo apt-get install libglpk-dev"))
install.packages("Rglpk")
install.packages("ROI.plugin.glpk")
install.packages("ROI.plugin.quadprog")
install.packages("R6")
install.packages("ROML", repos="http://R-Forge.R-project.org")
install.packages("ROML.portfolio", repos="http://R-Forge.R-project.org")
Loading the packages:
library("ROI")
library("ROML")
library("ROML.portfolio")
The djia2013 dataset contains daily returns for the 30 Dow Jones Industrial Average companies for the year 2013.
data("djia2013")
We consider a portfolio of assets with random returns. We denote the portfolio choice vector by x and by r the vector random returns. N denotes the number of assets in the portfolio while S is the number of scenarios in the scenarios set.
We consider a portfolio of assets with random returns. We denote the portfolio choice vector by x and by r the vector random returns. N denotes the number of assets in the portfolio while S is the number of scenarios in the scenarios set.
max where \hat \mu is the vector of estimated mean asset returns.
The following optimization problem: \begin{eqnarray*} \max_{x \in \mathbb{R}^N}&& \hat \mu^\top x\\ \sum_{x=1}^N x_i &=& 1\\ x_i &\geq& 0\\ x_1 + x_3 + x_{17} &=& 0.5 \end{eqnarray*} can be set up easily with ROML.portfolio:
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$maximize( reward(portfolio) )
m$subject_to( budget_norm(portfolio))
m$subject_to( portfolio[1] + portfolio[3] + portfolio[17] == 0.5)
(Note that the argument can be omitted as this is the default). To perfom the optimization, the optimize function is called:
opt <- optimize(m, solver="glpk",
data=list(returns = djia2013))
As this optimization problem does not necessarily need a scenario set, the mean vector of the asset returns can also be directly given to the optimize function:
opt <- optimize(m, solver="glpk",
data=list(mu = colMeans(djia2013)))
opt$solution
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.5 0.5 0.0 0.0 0.0
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.0 0.0 0.0 0.0 0.0
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.0 0.0 0.0 0.0 0.0
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.0 0.0 0.0 0.0 0.0
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.0 0.0 0.0 0.0 0.0
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.0 0.0 0.0 0.0 0.0
opt$objval
## [1] 0.01066486
\min_{x \in \mathbb{R}^N} x^\top \Sigma x \Sigma = \mathbb{C}ov(r) The minimum variance portfolio is obtained by:
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$minimize( markowitz(portfolio) )
m$subject_to( budget_norm(portfolio) )
opt <- optimize(m, solver="quadprog",
data=list(returns = djia2013))
As this optimization problem does not necessarily need a scenario set, the variance-covariance matrix of the asset returns can also be directly given to the optimize function:
opt <- optimize(m, solver="quadprog",
data=list(Sigma = cov(djia2013)))
round(opt$solution, 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.000 0.000 0.003 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.010 0.000 0.070 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.062 0.000 0.000 0.066
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.220 0.000 0.161 0.022 0.032
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.060 0.000 0.000 0.084
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.000 0.027 0.043 0.141
opt$objval
## [1] 0.0001238124
The minimization of the mean absolute deviation can be written as a linear problem. \begin{eqnarray*} \min_{x\in \mathbb{R}^N, y\in \mathbb{R}^S, z\in \mathbb{R}^S}&& \frac{1}{S} \sum_{s = 1}^S (y_s + z_s)\\ s.t.&&y_s - z_s = (r_{s} - \hat \mu)^\top x,\\ && y_s \geq 0, z_s \geq 0. \end{eqnarray*} Example: The minimum MAD portfolio is given by:
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$minimize( mad(portfolio) )
m$subject_to( budget_norm(portfolio) )
opt <- optimize(m, solver="glpk",
data=list(returns = djia2013))
round(opt$solution[1:ncol(djia2013)], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.000 0.035 0.000 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.013 0.000 0.091 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.071 0.000 0.000 0.000
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.132 0.000 0.145 0.020 0.048
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.089 0.000 0.000 0.090
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.005 0.080 0.086 0.095
opt$objval
## [1] 0.00884271
A downside risk measure is the lower semi-variance, which is the expected squared deviation from the mean, calculated over those points that are no greater than the mean. Only returns that are below the mean %(or below the target rate of return) contribute to the portfolio risk. Let r_s denote the vector of random returns of the N assets in scenario s. The problem can be formulated as: \min_{x\in \mathbb{R}^N} \frac{1}{S} \sum_{s = 1}^S \mathrm{max}(\hat\mu^\top x - r_s^\top x, 0)^2. The problem can be reformulated as a QP: \begin{eqnarray*} \min_{x\in \mathbb{R}^N, z\in \mathbb{R}^S}& \frac{1}{S} \sum_{s = 1}^S z_s^2\\ s.t.&z_s \geq (\hat\mu - r_s)^\top x)\\ &z_s \geq 0. \end{eqnarray*} The portfolio with minimum lower semi-variance is given by:
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$minimize( downside_var(portfolio) )
m$subject_to( budget_norm(portfolio) )
opt <- optimize(m, solver="quadprog",
data=list(returns = djia2013))
round(opt$solution[1:ncol(djia2013)], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.000 0.000 0.072 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.000 0.000 0.069 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.025 0.000 0.000 0.102
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.221 0.000 0.198 0.020 0.000
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.033 0.000 0.000 0.098
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.029 0.025 0.026 0.082
opt$objval
## [1] 7.020513e-05
Let r_s denote the vector of random returns of the N assets in scenario s. The downside risk measure given by the expected absolute deviation from the mean, calculated over those points that are no greater than the mean is given by: \frac{1}{S} \sum_{s = 1}^S |\mathrm{max}(\hat\mu^\top x - r_s^\top x, 0)| The minimization of this risk measure can be reformulated as a linear problem: \begin{eqnarray*} \min_{x\in \mathbb{R}^N, z\in \mathbb{R}^S}& \frac{1}{S} \sum_{s = 1}^S z_s,\\ s.t.&z_s \geq (\hat\mu - r_s)^\top x\\ &z_s \geq 0. \end{eqnarray*} Example: The portfolio with minimum lower semi-absolute deviation is given by:
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$minimize( downside_mad(portfolio) )
m$subject_to( budget_norm(portfolio) )
opt <- optimize(m, solver="glpk",
data=list(returns = djia2013))
round(opt$solution[1:ncol(djia2013)], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.000 0.035 0.000 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.013 0.000 0.091 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.071 0.000 0.000 0.000
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.132 0.000 0.145 0.020 0.048
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.089 0.000 0.000 0.090
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.005 0.080 0.086 0.095
opt$objval
## [1] 0.004421355
The conditional value at risk/expected shortfall is the average of the losses that exceed the \alpha-quantile of the loss distribution, also called \alpha Value-at-Risk (VaR). Defining the loss distribution as minus of the return of the portfolio, the problem can be formulated as follows: \begin{eqnarray*} \min_{x\in \mathbb{R}^N, z\in \mathbb{R}^S, \gamma\in \mathbb{R}}& \gamma + \frac{1}{(1-\alpha)} \sum_{s = 1}^S p_s z_s\\ s.t.\ &z_s \geq - r_s^\top x - \gamma,\\ &z_s \geq 0, \end{eqnarray*} where VaR is a minimizer of the function over \gamma and p=(p_1, \dots, p_S) is a vector of probabilities associated with the scenarios.
Example: Obtaining the portfolio with minimum 95% conditional value at risk:
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$minimize( cvar(portfolio, 0.95) )
m$subject_to( budget_norm(portfolio) )
opt <- optimize(m, solver="glpk",
data=list(returns = djia2013))
Alternatively, the value of \alpha parameter can be assigned in the optimize function, i.e.,
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$minimize( cvar(portfolio, alpha) )
m$subject_to( budget_norm(portfolio) )
opt95 <- optimize(m, solver="glpk",
data=list(returns = djia2013, alpha = 0.95))
round(opt95$solution[grep("portfolio", names(opt95$solution))], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.000 0.043 0.092 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.000 0.000 0.000 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.034 0.000 0.000 0.000
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.263 0.000 0.292 0.000 0.000
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.101 0.000 0.000 0.149
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.026 0.000 0.000 0.000
opt95$objval
## [1] 0.01957014
Specifying \alpha in the data list is advantageous when solutions for different \alpha’s ought to be compared. For example, if the solution for 95% CVaR is to be compared with the solution for 99% CVaR, only the optimize function has to be recalled, the model remains unchanged:
opt99 <- optimize(m, solver="glpk",
data=list(returns = djia2013, alpha = 0.99))
round(opt99$solution[grep("portfolio", names(opt99$solution))], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.053 0.000 0.162 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.000 0.000 0.000 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.000 0.230 0.000 0.000
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.339 0.000 0.000 0.000 0.000
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.016 0.000 0.000 0.153
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.047 0.000 0.000 0.000
opt99$objval
## [1] 0.02196323
The 95% or the 99% VaR are a by-product of the optimization problem and can be extracted from the solution
VaR <- c(opt95$solution[grep("gamma", names(opt95$solution))],
opt99$solution[grep("gamma", names(opt99$solution))])
names(VaR) <- c("0.95", "0.99")
VaR
## 0.95 0.99
## 0.01684393 0.02196323
The optimal portfolio is defined as that one that minimizes the maximum loss over all past historical periods, subject to a restriction on the minimum acceptable average return across all observed periods of time. The minimax portfolio maximizes the minimum gain % and can be seen as a limiting case of CVaR for \alpha \rightarrow 1. Let M_p=\min_s r_s^\top x denote the minimum gain of the portfolio. \begin{eqnarray*} \max_{x \in \mathbb{R}^N, M_p\in \mathbb{R}}& M_p\\ s.t.& r_s^\top x - M_p \geq 0. \end{eqnarray*} Example: The minimax portfolio, subject to target return constraints is given by:
m <- model()
m$variable(portfolio, lb = -10) # the portfolio choice vector;
m$minimize( minimax_young(portfolio) )
m$subject_to( budget_norm(portfolio) )
opt <- optimize(m, solver="glpk",
data=list(returns = djia2013))
opt
## No solution found.
## The solver message was: No feasible solution exists.
## The objective value is: NA
Let r_f denote the risk free rate (when not specified is set by default to zero). The Sharpe ratio of a random return of an asset is defined as: \frac{\mathbb{E}(\tilde r)- r_f}{\sqrt{\mathbb{V}ar(\tilde r)}} The budget normalization constraint is applied and the problem can be formulated as a QP: \begin{eqnarray*} \max_{y\in \mathbb{R}^N, \kappa\in \mathbb{R}}& - y^\top Q y\\ s.t.&(\hat\mu - r_f \mathit{1})^\top y = \text{1},\\ & \mathit{1}^\top y = \kappa,\\ & \kappa > 0. \end{eqnarray*} The optimal solution is given by x^* = y^* / \kappa^*.
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$maximize( sharpe(portfolio) )
opt <- optimize(m, solver="quadprog",
data=list(returns = djia2013))
round(opt$solution[grep("portfolio", names(opt$solution))]/
opt$solution[grep("kappa", names(opt$solution))], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.073 0.310 0.000 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.000 0.000 0.000 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.000 0.000 0.000 0.000
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.000 0.209 0.092 0.067 0.122
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.000 0.000 0.000 0.126
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.000 0.000 0.000 0.000
If not explicitly specified, the default for the risk free rate is 0. The Omega Ratio is a risk-return performance measure of an investment asset, portfolio, or strategy. The Omega Ratio, introduced in 2002 by Keating and Shadwick, is defined as the probability weighted ratio of gains versus losses for some threshold return target \tau. \Omega(\tilde r) = \frac{\int_\tau^{+\infty}\left(1 - F(r)\right)\mathrm{d}r}{\int_{-\infty}^\tau F(r)\mathrm{d}r} where F(r) denotes the cumulative distribution function of \tilde r. The maximization of \Omega(\tilde r) can be formulated as an linear problem (note that the budget normalization constraint and the target return constraint are already part of the model formulation).
The Omega optimal portfolio is given by x^* = y^* /z^*, where z is the homogenizing variable. If not explicitly specified, the default for the threshold is \tau = 0.
m <- model()
m$variable(portfolio, lb = 0) # the portfolio choice vector;
m$maximize( omega(portfolio) )
opt <- optimize(m, solver="glpk",
data=list(returns = djia2013))
round(opt$solution[grep("portfolio", names(opt$solution))]/
opt$solution[grep("z", names(opt$solution))], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.050 0.344 0.000 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.000 0.000 0.023 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.009 0.000 0.000 0.000
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.000 0.120 0.141 0.084 0.062
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.000 0.000 0.000 0.128
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.039 0.000 0.000 0.000
Example: Maximize quadratic utility where short selling is allowed but the weights should not be less than -1.
m <- model()
m$variable(portfolio, lb = -1) # the portfolio choice vector;
m$maximize( quadratic_utility(portfolio, lambda) )
m$subject_to( budget_norm(portfolio) )
opt <- optimize(m, solver="quadprog",
data=list(returns = djia2013, lambda = 4))
round(opt$solution[grep("portfolio", names(opt$solution))], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 1.403 3.605 -1.000 -1.000 -1.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.167 1.401 0.739 -0.271 -0.410
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## -1.000 -0.619 1.330 -0.687 -1.000
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## -1.000 4.996 -0.332 0.986 0.596
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## -0.146 -1.000 -1.000 -1.000 0.890
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## -0.353 -0.297 -1.000 -1.000 -1.000
Box constraints: we follow ROI and set as default 0 \leq x_i \leq \infty. Different bounds will be specified in the portfolio variable definition, e.g., m$variable(x, lb = -10, ub = 10)
.
Group constraints: can be defined using subsetting (see examples).
Budget constraint: \sum_{i=1}^N x_i = B, \sum_{i=1}^N x_i \leq B_u, \sum_{i=1}^N x_i \geq B_l.
Budget normalization constraint: \sum_{i=1}^N x_i = 1.
Turnover constraint: For a target turnover L and some initial weights x_0, the turnover contraint is \sum_{i=1}^N |x_i - x_{i0}| \leq L. This can be reformulated in terms of auxiliary variables y^+, y^- \in \mathbb{R}^{+N} such that y^+_i- y_i^- = x_i - x_{0i} and \sum_{i=1}^N (y_i^+ + y_i^-) \leq L. If no initial weights are specified, the default is equal weights.
Cardinality constraint: assigns bounds P_{min} and P_{max} on the number of assets in a portfolio. Binary auxiliary variables z\in \mathbb{R}^N are introduced such that P_{min} \leq \sum_{i=1}^N z_i\leq P_{max} and x_i - z_i \leq 0.
Target return constraint: \hat\mu^\top x \geq \tau.
Risk constraints – Variance: Typically constraints of the form x^\top Q x \leq q^2. Note however that this is a quadratic constraint and needs appropriate solvers (e.g., in ROI.plugin.cplex).
Risk constraints – CVaR: Typically CVaR (x, \alpha) \leq q.
m <- model()
m$variable(portfolio, lb = 0)
m$maximize(omega(portfolio))
m$subject_to(cardinality(portfolio) <= 7)
m$subject_to(cvar(portfolio, 0.95) <= 0.02)
opt <- optimize(m, solver="glpk",
data=list(returns = djia2013))
round(opt$solution[grep("portfolio", names(opt$solution))]/
opt$solution[grep("z", names(opt$solution))], 3)
## portfolio$1 portfolio$2 portfolio$3 portfolio$4 portfolio$5
## 0.000 0.204 0.098 0.000 0.000
## portfolio$6 portfolio$7 portfolio$8 portfolio$9 portfolio$10
## 0.000 0.000 0.000 0.000 0.000
## portfolio$11 portfolio$12 portfolio$13 portfolio$14 portfolio$15
## 0.000 0.027 0.000 0.000 0.000
## portfolio$16 portfolio$17 portfolio$18 portfolio$19 portfolio$20
## 0.186 0.000 0.211 0.000 0.000
## portfolio$21 portfolio$22 portfolio$23 portfolio$24 portfolio$25
## 0.000 0.136 0.000 0.000 0.138
## portfolio$26 portfolio$27 portfolio$28 portfolio$29 portfolio$30
## 0.000 0.000 0.000 0.000 0.000
m <- model()
m$variable(x, lb = -1)
m$maximize(reward(x))
m$subject_to(cvar(x, 0.95) <= 0.02)
m$subject_to(cvar(x, 0.99) <= 0.03)
m$subject_to(x[2] + x[10] + x[20] <= 0.5)
m$subject_to(turnover(x) <= 0.5)
opt <- optimize(m, solver="glpk", data=list(returns = djia2013))
round(opt$solution[grep("x", names(opt$solution))], 3)
## x$1 x$2 x$3 x$4 x$5 x$6 x$7 x$8 x$9 x$10
## 0.033 0.209 0.033 -0.049 0.033 0.033 0.033 0.033 0.033 0.033
## x$11 x$12 x$13 x$14 x$15 x$16 x$17 x$18 x$19 x$20
## -0.209 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033
## x$21 x$22 x$23 x$24 x$25 x$26 x$27 x$28 x$29 x$30
## 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033 0.033
Name | Arguments | Objectives | Type |
---|---|---|---|
reward |
(portfolioVar) |
Portfolio return/reward | LP |
markowitz |
(portfolioVar) |
Variance of portfolio | QP |
mad |
(portfolioVar) |
Mean Absolute Deviation | LP |
downside_var |
(portfolioVar) |
Lower semi-variance of portfolio | QP |
downside_mad |
(portfolioVar) |
lower semi-mean absolute deviation | LP |
cvar |
(portfolioVar, alpha, probs = NULL) |
cvar | LP |
minimax_young |
(portfolioVar) |
Minimax portfolio | LP |
sharpe |
(portfolioVar, rf = 0) |
Sharpe ratio | QP |
omega |
(portfolioVar, tau = 0) |
Omega | LP |
Name | Arguments | Objectives | Type |
---|---|---|---|
reward |
(portfolioVar) |
Target return | LP |
budget_norm |
(portfolioVar) |
budget normalization constraint,i.e., sum of the portfolio equals 1 | LP |
budget |
(portfolioVar) |
budget constraint,i.e., sum of the portfolio equals budget | LP |
turnover |
(portfolioVar, x0 = NULL) |
Turnover | LP |
cardinality |
(portfolioVar) |
Cardinality | MILP |
markowitz |
(portfolioVar) |
Variance of portfolio | QP |
cvar |
(portfolioVar, alpha, probs = NULL) |
Conditional value at risk | LP |