Conditional Value at Risk (CVaR) PDF
Document Details
Uploaded by Deleted User
2020
Linköpings tekniska högskola
Tags
Summary
This document is a computer exercise on Conditional Value at Risk (CVaR) for a production economics course. It outlines the problem and provides instructions for installing required software and completing the task. It details the necessary mathematical calculations and presents the exercise as an optimization problem to be solved. The exercise is from 2020.
Full Transcript
Linköpings tekniska högskola Finansiell optimering IEI Laboration 4 Produktionsekonomi November 11, 2020...
Linköpings tekniska högskola Finansiell optimering IEI Laboration 4 Produktionsekonomi November 11, 2020 Computer exercise 4 - Conditional Value at Risk (CVaR) Aim: You will build an optimization model that determines the portfolio with minimum CVaR. Installing software: Download AMPL, AMPL API and Ipopt from Lisam (select appropriate operating system) Unzip all the files in one root directory Copy the file ipopt[.exe] from Ipopt[operating system type]/bin to ampl [operating system type]/ Add the correct file path to the directory in amplFolderPath on the first line in cvar.m (mac users also have to change \to / in the path) Background: Value at Risk (VaR), is a common risk measure on financial markets, with some inherent drawbacks. The risk measure lack control of the risk above the VaR value. It is not sub-additive, a property which is important in risk measures, since increased diversification should lead to decreased risk. If the investor in spite of these drawbacks would like to find an optimal portfolio with respect to VaR he would face a non-convex optimization problem which is very difficult to solve. A closely related risk measure is to measure the expected loss in excess of VaR, CVaR. Rockafellar and Uryasev1 realized that CVaR in the objective or as a constraint can be formulated with a linear programming formulation. The risk measure has now become common on financial markets. An investor has an initial portfolio where the investment in each asset is given by the vector b ∈ Rn×1 and c ∈ R is the investment in the risk-free asset. The initial asset prices is P1 ∈ Rn×1 , which gives the initial wealth P1T b + c. The investor can buy and sell assets, x ∈ Rn×1 , which gives the investment in each asset, b + x, and the investment in the risk-free asset, c − P1T x. Given scenario i ∈ L with probability pi the prices of assets are Pi ∈ Rn×1 which gives the loss L(x, Pi ) = P1T b + c − (PiT (b + x) + ert (c − P1T x)), where r is the continuously compounded risk-free interest rate for time t. α-VaR defines the loss that will not be exceeded with probability α (e.g. 95%). V aR(x, α) = min{ζ ∈ R|Ψ(x, ζ) ≥ α}, (1) 1 Rockafellar, R.T. and Uryasev, S., Optimization of Conditional Value-At-Risk, The Journal of Risk, vol 2, page 21-41, 2000. 1 where Ψ(x, ζ) describes the probability that the loss is smaller than ζ, e.g. X Ψ(x, ζ) = pi. (2) i∈L|L(x,Pi )≤ζ CVaR is the expected loss that exceed VaR, X X pi L(x, Pi ) pi L(x, Pi ) i∈L|L(x,Pi )>ζ i∈L|L(x,Pi )>ζ CV aR(x, α) = E[L(x, Pi )|L(x, Pi ) > ζ] = =. 1−α X pi i∈L|L(x,Pi )>ζ (3) To realize that the problem can be solved as a linear optimization problem the following definition is made yi = max[0, L(x, Pi ) − ζ], i ∈ L, which allows gives the following expression X X X pi y i = pi y i + pi yi (4) i∈L i∈L|L(x,Pi )≤ζ i∈L|L(x,Pi )>ζ X X = 0+ pi L(x, Pi ) − ζ pi (5) i∈L|L(x,Pi )>ζ i∈L|L(x,Pi )>ζ X = pi L(x, Pi ) − ζ(1 − α) ⇔ (6) i∈L|L(x,Pi )>ζ X X pi L(x, Pi ) pi y i i∈L|L(x,Pi )>ζ i∈L ⇔ =ζ+ (7) 1−α 1−α The left hand side is the definition of CVaR, which can be calculated with the right hand side. The optimization model that minimize CVaR can be formulated as X pi y i i∈L min ζ + x,y,ζ 1−α. (8) s.t. L(x, Pi ) = P1T b + c − (PiT (b + x) + ert (c − P1T x)) i ∈ L yi = max[0, L(x, Pi ) − ζ] i∈L x∈X The second constraint is non-linear, but since yi is minimized it can be reformulated as yi ≥ 0, yi ≥ L(x, Pi ) − ζ which gives the linear optimization model X pi y i i∈L min ζ + x,y,ζ 1−α. (9) s.t. yi ≥ P1T b + c − (PiT (b + x) + ert (c − P1T x)) − ζ i ∈ L yi ≥ 0 i∈L x∈X 2 The set X can e.g. define that a certain expected return is required, µ̄, that short selling is not allowed and that money may not be borrowed, X pi PiT (x + b) + ert (c − P1T x) = (1 + µ̄)(P1T b + c) i∈L = X. (10) b+x≥0 c − P1T x ≥ 0 To assist you there is a program which generates scenarios in Matlab and write them to an AMPL file, whereafter a call to AMPL is made from Matlab. The file CVaR.zip can be downloaded from lisam. Exercise: Determine the portfolio with minimal CVaR in one year given the expected return µ̄ = 0.1! 3 Exercise: Relax the constraints for shorting and borrowing. What happens with CVaR? What is the explanation?................................................................................................................................................................................ Exercise: Compute Value-at-Risk in Matlab for the optimal solution using round((1-alpha)*nSamples) to determine the quantile. To sort L in descending order sort(L, ’descend’) can be used. Compare with the solution from AMPL!................................................................................................................................................................................ Exercise: Compute Conditional Value-at-Risk in Matlab for the optimal so- lution using round((1-alpha)*nSamples) to determine the quantile. Compare with the solution from AMPL!................................................................................................................................................................................ Below follows an example of an AMPL formulation of a model. inventory.mod param T; # number of time periods param initInventory; # initial inventory param c{1..T}; # productions cost param u{1..T}; # production capacity param l{1..T}; # inventory cost param d{1..T}; # demand var x{1..T} >= 0; # number of manufactured units var y{0..T} >= 0; # number of stored units minimize totalcost: sum {t in 1..T} (c[t]*x[t] + l[t]*y[t]); subject to inventory {t in 1..T} : y[t-1] + x[t] = d[t] + y[t]; subject to initialinventory : y = initInventory; subject to capacitycon {t in 1..T} : x[t]