PortfolioOptimProjection: Portfolio optimization which finds an optimal portfolio with...

Description Usage Arguments Value References Examples

Description

PortfolioOptimProjection is a linear program for financial portfolio optimization. The function finds an optimal portfolio which has the smallest distance to a benchmark portfolio given by bvec. Solution is by the algorithm due to Zhao and Li modified to account for the fact that the benchmark portfolio bvec has the dimension of portfolio weights and the solved linear program has a much higher dimension since the solution vector to the LP problem consists of a set of primal variables: financial portfolio weights, auxiliary variables coming from the reduction of the mean-risk problem to a linear program and also a set of dual variables depending on the number of constrains in the primal problem (see Palczewski).

Usage

1
2
3
PortfolioOptimProjection (dat, portfolio_return,
risk=c("CVAR","DCVAR","LSAD","MAD"), alpha=0.95, bvec,
Aconstr=NULL, bconstr=NULL, LB=NULL, UB=NULL, maxiter=500, tol=1e-7)

Arguments

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.

bvec

Benchmark portfolio, a vector of length k; function PortfolioOptimProjection finds an optimal portfolio with the smallest distance to bvec.

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.

Value

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

References

Palczewski, A., LP Algorithms for Portfolio Optimization: The PortfolioOptim Package, R Journal, 10(1) (2018), 308–327. DOI:10.32614/RJ-2018-028.

Zhao, Y-B., Li, D., Locating the least 2-norm solution of linear programs via a path-following method, SIAM Journal on Optimization, 12 (2002), 893–912. DOI:10.1137/S1052623401386368.

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
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;  
w_m <- rep(1/k,k) # benchmark portfolio, a vector of length k, 
port_ret = 0.05 # portfolio target return
alpha_optim = 0.95

# minimal constraints set: \sum theta_i = 1
# has to be in two inequalities: 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 <- PortfolioOptimProjection(dat, port_ret, risk="MAD",  
alpha=alpha_optim, w_m, Aconstr, bconstr, LB, UB, maxiter=200, tol=1e-7)

cat ( c("Projection optimal 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"))

PortfolioOptim documentation built on May 2, 2019, 10:21 a.m.