Description Usage Arguments Value References Examples
BDportfolio_optim is a linear program for financial portfolio optimization. Portfolio risk is measured by one of the risk measures from the list c("CVAR", "DCVAR", "LSAD", "MAD"). Benders decomposition method is explored to enable optimization for very large returns samples (\sim 10^6).
The optimization problem is:
\min F({θ^{T}} r)
over
θ^{T} E(r) ≥ portfolio\_return,
LB ≤ θ ≤ UB,
Aconstr θ ≤ bconstr,
where
F is a measure of risk;
r is a time series of returns of assets;
θ is a vector of portfolio weights.
1 2 3 |
dat |
Time series of returns data; dat = cbind(rr, pk), where rr is an array (time series) of asset returns, for n returns and k assets it is an array with \dim(rr) = (n, k), pk is a vector of length n containing probabilities of returns. |
portfolio_return |
Target portfolio return. |
risk |
Risk measure chosen for optimization; one of "CVAR", "DCVAR", "LSAD", "MAD", where "CVAR" – denotes Conditional Value-at-Risk (CVaR), "DCVAR" – denotes deviation CVaR, "LSAD" – denotes Lower Semi Absolute Deviation, "MAD" – denotes Mean Absolute Deviation. |
alpha |
Value of alpha quantile used to compute portfolio VaR and CVaR; used also as quantile value for risk measures CVAR and DCVAR. |
Aconstr |
Matrix defining additional constraints, \dim (Aconstr) = (m,k), where k – number of assets, m – number of constraints. |
bconstr |
Vector defining additional constraints, length (bconstr) = m. |
LB |
Vector of length k, lower bounds of portfolio weights θ; warning: condition LB = NULL is equivalent to LB = rep(0, k) (lower bound zero). |
UB |
Vector of length k, upper bounds for portfolio weights θ. |
maxiter |
Maximal number of iterations. |
tol |
Accuracy of computations, stopping rule. |
BDportfolio_optim returns a list with items:
return_mean | vector of asset returns mean values. |
mu | realized portfolio return. |
theta | portfolio weights. |
CVaR | portfolio CVaR. |
VaR | portfolio VaR. |
MAD | portfolio MAD. |
risk | portfolio risk measured by the risk measure chosen for optimization. |
new_portfolio_return | modified target portfolio return; when the original target portfolio return |
is to high for the problem, the optimization problem is solved for | |
new_portfolio_return as the target return. | |
Benders, J.F., Partitioning procedures for solving mixed-variables programming problems. Number. Math., 4 (1962), 238–252, reprinted in Computational Management Science 2 (2005), 3–19. DOI: 10.1007/s10287-004-0020-y.
Konno, H., Piecewise linear risk function and portfolio optimization, Journal of the Operations Research Society of Japan, 33 (1990), 139–156.
Konno, H., Yamazaki, H., Mean-absolute deviation portfolio optimization model and its application to Tokyo stock market. Management Science, 37 (1991), 519–531.
Konno, H., Waki, H., Yuuki, A., Portfolio optimization under lower partial risk measures, Asia-Pacific Financial Markets, 9 (2002), 127–140. DOI: 10.1023/A:1022238119491.
Kunzi-Bay, A., Mayer, J., Computational aspects of minimizing conditional value at risk. Computational Management Science, 3 (2006), 3–27. DOI: 10.1007/s10287-005-0042-0.
Rockafellar, R.T., Uryasev, S., Optimization of conditional value-at-risk. Journal of Risk, 2 (2000), 21–41. DOI: 10.21314/JOR.2000.038.
Rockafellar, R. T., Uryasev, S., Zabarankin, M., Generalized deviations in risk analysis. Finance and Stochastics, 10 (2006), 51–74. DOI: 10.1007/s00780-005-0165-8.
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 | library (Rsymphony)
library(Rglpk)
library(mvtnorm)
k = 3
num =100
dat <- cbind(rmvnorm (n=num, mean = rep(0,k), sigma=diag(k)), matrix(1/num,num,1))
# a data sample with num rows and (k+1) columns for k assets;
port_ret = 0.05 # target portfolio return
alpha_optim = 0.95
# minimal constraints set: \eqn{\sum \theta_{i} = 1}
# has to be in two inequalities: \eqn{1 - \epsilon <= \sum \theta_{i} <= 1 + \epsilon}
a0 <- rep(1,k)
Aconstr <- rbind(a0,-a0)
bconstr <- c(1+1e-8, -1+1e-8)
LB <- rep(0,k)
UB <- rep(1,k)
res <- BDportfolio_optim(dat, port_ret, "CVAR", alpha_optim,
Aconstr, bconstr, LB, UB, maxiter=200, tol=1e-8)
cat ( c("Benders decomposition portfolio:\n\n"))
cat(c("weights \n"))
print(res$theta)
cat(c("\n mean = ", res$mu, " risk = ", res$risk,
"\n CVaR = ", res$CVaR, " VaR = ", res$VaR, "\n MAD = ", res$MAD, "\n\n"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.