Home > Asset Allocation, R, Risk Measures > Maximum Loss and Mean-Absolute Deviation risk measures

## Maximum Loss and Mean-Absolute Deviation risk measures

During construction of typical efficient frontier, risk is usually measured by the standard deviation of the portfolio’s return. Maximum Loss and Mean-Absolute Deviation are alternative measures of risk that I will use to construct efficient frontier. I will use methods presented in Comparative Analysis of Linear Portfolio Rebalancing Strategies: An Application to Hedge Funds by Krokhmal, P., S. Uryasev, and G. Zrazhevsky (2001) paper to construct optimal portfolios.

Let x.i, i= 1,…,n be weights of instruments in the portfolio. We suppose that j= 1,…,T scenarios of returns with equal probabilities are available. I will use historical assets returns as scenarios. Let us denote by r.ij the return of i-th asset in the scenario j. The portfolio’s Maximum Loss (page 34) can be written as

$\max_{1\leq j \leq T}\left \{ -\sum_{i=1}^{n}r_{ij}x_i \right \}$

It can be formulated as a linear programming problem

$\min_{}{}w\newline\newline-\sum_{i=1}^{n}r_{ij}x_j\leq w , j=1,...,T$

This linear programming problem can be easily implemented

min.maxloss.portfolio <- function
(
ia,		# input assumptions
constraints	# constraints
)
{
n = ia$n nt = nrow(ia$hist.returns)

# objective : maximum loss, w
f.obj = c( rep(0, n), 1)

# adjust constraints, add w
constraints = add.variables(1, constraints)

#  - [ SUM <over i> r.ij * x.i ] < w, for each j = 1,...,T
a = rbind( matrix(0, n, nt), 1)
a[1 : n, ] = t(ia$hist.returns) constraints = add.constraints(a, rep(0, nt), '>=', constraints) # setup linear programming f.con = constraints$A
f.dir = c(rep('=', constraints$meq), rep('>=', len(constraints$b) - constraints$meq)) f.rhs = constraints$b

# find optimal solution
x = NA
sol = try(solve.LP.bounds('min', f.obj, t(f.con), f.dir, f.rhs,
lb = constraints$lb, ub = constraints$ub), TRUE)

if(!inherits(sol, 'try-error')) {
x = sol$solution[1:n] } return( x ) }  The portfolio’s Mean-Absolute Deviation (MAD) (page 33) can be written as $\frac{1}{T}\sum_{j=1}^{T}\left | \sum_{i=1}^{n}r_{ij}x_{i} - \frac{1}{T}\sum_{k=1}^{T}\sum_{i=1}^{n}r_{ik}x_{i} \right |$ It can be formulated as a linear programming problem $\min_{}{}\frac{1}{T}\sum_{j=1}^{T}(u_{j}^{+}+u_{j}^{-})\newline\newline \sum_{i=1}^{n}r_{ij}x_{i} - \frac{1}{T}\sum_{j=1}^{T}\sum_{i=1}^{n}r_{ij}x_{i}=u_{j}^{+}-u_{j}^{-}, j=1,...,T\newline\newline u_{j}^{+},u_{j}^{-} \geq 0, j=1,...,T$ This linear programming problem can be implemented min.mad.portfolio <- function ( ia, # input assumptions constraints # constraints ) { n = ia$n
nt = nrow(ia$hist.returns) # objective : Mean-Absolute Deviation (MAD) # 1/T * [ SUM (u+.j + u-.j) ] f.obj = c( rep(0, n), (1/nt) * rep(1, 2 * nt) ) # adjust constraints, add u+.j, u-.j constraints = add.variables(2 * nt, constraints, lb = 0) # [ SUM <over i> r.ij * x.i ] - 1/T * [ SUM <over j> [ SUM <over i> r.ij * x.i ] ] = u+.j - u-.j , for each j = 1,...,T a = rbind( matrix(0, n, nt), -diag(nt), diag(nt)) a[1 : n, ] = t(ia$hist.returns) - repmat(colMeans(ia$hist.returns), 1, nt) constraints = add.constraints(a, rep(0, nt), '=', constraints) # setup linear programming f.con = constraints$A
f.dir = c(rep('=', constraints$meq), rep('>=', len(constraints$b) - constraints$meq)) f.rhs = constraints$b

# find optimal solution
x = NA
sol = try(solve.LP.bounds('min', f.obj, t(f.con), f.dir, f.rhs,
lb = constraints$lb, ub = constraints$ub), TRUE)

if(!inherits(sol, 'try-error')) {
x = sol$solution[1:n] } return( x ) }  Let’s examine efficient frontiers computed under different risk measures using historical input assumptions presented in the Introduction to Asset Allocation post: ############################################################################### # Create Efficient Frontier ############################################################################### n = ia$n

# 0 <= x.i <= 0.8
constraints = new.constraints(n, lb = 0, ub = 0.8)

# SUM x.i = 1
constraints = add.constraints(rep(1, n), 1, type = '=', constraints)

# create efficient frontier(s)
ef.risk = portopt(ia, constraints, 50, 'Risk')
ef.maxloss = portopt(ia, constraints, 50, 'Max Loss', min.maxloss.portfolio)
ef.mad = portopt(ia, constraints, 50, 'MAD', min.mad.portfolio)

# Plot multiple Efficient Frontiers
layout( matrix(1:4, nrow = 2) )
plot.ef(ia, list(ef.risk, ef.maxloss, ef.mad), portfolio.risk, F)
plot.ef(ia, list(ef.risk, ef.maxloss, ef.mad), portfolio.maxloss, F)
plot.ef(ia, list(ef.risk, ef.maxloss, ef.mad), portfolio.mad, F)

# Plot multiple Transition Maps
layout( matrix(1:4, nrow = 2) )
plot.transition.map(ef.risk)
plot.transition.map(ef.maxloss)
plot.transition.map(ef.mad)


The Mean-Absolute Deviation and Standard Deviation risk measures are very similar by construction – they both measure average deviation, so it is not a surprise that their efficient frontiers and transition maps are close. On the other hand, the Maximum Loss measures the extreme deviation and has very different efficient frontier and transition map.

To view the complete source code for this example, please have a look at the aa.test() function in aa.test.r at github.

About these ads
1. No comments yet.
1. October 25, 2011 at 4:56 pm | #1
2. October 26, 2011 at 2:26 pm | #2
3. November 1, 2011 at 12:13 pm | #3
4. November 22, 2011 at 3:31 am | #4
5. March 14, 2012 at 7:28 pm | #5