5
86 RJune 2011 cuttingg. cRitRisk most active areas of risk management today is counterparty credit risk management (CCRM). Managing counterparty risk is part icularly challenging because it requires the simultaneous evaluation of all the trades facing a given counterparty. For multi-asset portfolios, this typi- cally comes with extraordinary computation al cha llenges. Indeed, for portfolios other than those comprising simple vanilla instruments, computationally intensive Monte Carlo (MC) simulations are often the only practical tool available for this task. Sta ndard approaches for the calcul ation of risk req uire repeating the calculation of the prot and loss of the portfolio under hundreds of market scenarios. As a result, in many cases these calculations cannot be completed in a practical amount of time, even employing a vast amount of computer power. Since the total cost of through-the-life risk management can deter- mine whether it is protable to execute a new trade, solving this technology problem is critical to allow a securities rm to remain competitive. Following the introduction of adjoint methods in nance (Giles & Glasserman, 2006), a computational technique dubbed adjoint algorithmic dierentiation (AAD) (Capriotti, 2011, and Capriotti & Giles, 2010 and 2011) has recently emerged as tre- mendously eective for speeding up the calculation of sensitivi- ties in MC in the context of the so-called pathwise derivatives method (Broadie & Glasserman, 1996).  Algorithmic dierentiation (AD) (Griewank, 2000) is a set of programming techniques for the ecient calculation of the deriv- atives of functions implemented as computer programs. Te main idea underlying AD is that any such function – no matter how complicated – can be interpreted as a composition of basic arith- metic and intrinsic operations that are easy to dierentiate. What makes AD particularly attractive, when compared with standard (nite-dierence) methods for the calculation of derivatives, is its computational eciency. In fact, AD exploits the information on the structure of the computer code in order to optimise the calcu- lation. In particular, when one requires the derivatives of a small number of outputs with respect to a large number of inputs, the calculation can be highly optimised by applying the chain rule through the instructions of the program in opposite order with respect to their original evaluation (Griewank, 2000). Tis gives rise to AAD. Surprisingly, even if AD has been an active branch of computer science for several decades, its impact in other research elds has been fairly limited until recently. Interestingly, in contrast to the usual situation in which well-established ideas in applied mathe- matics or physics have often been ‘borrowed’ by quants, AAD has been introduced in MC applications in natural science (Sorella & Capriotti, 201 0) only after its ‘rediscovery’ in quantitative nance. In this article, we demonstrate how this powerful technique can be used for highly ecent computation of price sensitivities in the context of CCRM. Counterparty credit risk management  As a typical task in the day-to-day operation of a CCRM desk, here we consider the calculation of the credit valuation adjust- ment (CVA) as the main measure of a dealer’s counterparty credit risk. For a given portfolio of trades facing the same investor or institution, the CVA aims to capture the expected loss associated  with the counterparty defaulting in a situation in which the posi- tion, netted for any collateral agreement, has a positive mark-to- market for the dealer. Tis can be evaluated at time T 0 = 0 as:  V CVA = E I τ c T ( )  D 0,  τ c ( ) × L GD τ c ( ) NPV τ c ( ) C R τ c ( ) ( ) ( ) + (1)  where t c is the default time of the counterparty,  NPV ( t ) is the net present value of the portfolio at time t from the dealer’s point of view, C(  R( t )) is the collateral outstanding, ty pically dependent on the rating R of the counterparty,  L GD ( t ) is the loss given default,  D(0, t ) is the discount factor for the interval [0, t ], and I(  t c   T ) is the indicator that the counterparty’s default happens before the longest deal maturity in the portfolio, T . Here, for simplicity of notation we consider the unilateral CVA, and the generalisation to bilateral CVA (Brigo & Capponi, 201 0) is straightfor ward. Te quantity in (1) is typically calculated on a discrete time grid of ‘horizon dates’ T 0 < T 1 < ... < T  N O as, for instance:  V CVA ; E i=1  N O I T i1 < τ c T i ( ) D 0,T i ( ) × L GD T i ( ) NPV T i ( ) C R T i ( ) ( ) ( ) + (2) In general, the quantity above depends on several correlated ran- dom market factors, including the interest rate, the counterpar- Real-time counterparty credit risk  management in M onte Carlo  Adjoint algorithmic dierentiation can be used to implement the calculation o counterparty credit risk efciently. Luca Capriotti  , Jacky Lee and Matthew Peacock demonstrate how this powerul technique can be used to reduce the computational cost by hundreds o times, thus opening the way to real-time risk management in Monte Carlo One of the

Cap Riot Ti

Embed Size (px)

Citation preview

Page 1: Cap Riot Ti

8/3/2019 Cap Riot Ti

http://slidepdf.com/reader/full/cap-riot-ti 1/5

86 RJune 2011

cuttingg.cRitRisk 

most active areas of risk management today iscounterparty credit risk management

(CCRM). Managing counterparty risk is part icularly challengingbecause it requires the simultaneous evaluation of all the tradesfacing a given counterparty. For multi-asset portfolios, this typi-cally comes with extraordinary computational cha llenges.

Indeed, for portfolios other than those comprising simplevanilla instruments, computationally intensive Monte Carlo(MC) simulations are often the only practical tool available forthis task. Standard approaches for the calculation of risk requirerepeating the calculation of the prot and loss of the portfoliounder hundreds of market scenarios. As a result, in many casesthese calculations cannot be completed in a practical amount of time, even employing a vast amount of computer power. Sincethe total cost of through-the-life risk management can deter-mine whether it is protable to execute a new trade, solving thistechnology problem is critical to allow a securities rm toremain competitive.

Following the introduction of adjoint methods in nance(Giles & Glasserman, 2006), a computational technique dubbedadjoint algorithmic dierentiation (AAD) (Capriotti, 2011, andCapriotti & Giles, 2010 and 2011) has recently emerged as tre-mendously eective for speeding up the calculation of sensitivi-ties in MC in the context of the so-called pathwise derivatives

method (Broadie & Glasserman, 1996). Algorithmic dierentiation (AD) (Griewank, 2000) is a set of programming techniques for the ecient calculation of the deriv-atives of functions implemented as computer programs. Te mainidea underlying AD is that any such function – no matter howcomplicated – can be interpreted as a composition of basic arith-metic and intrinsic operations that are easy to dierentiate. Whatmakes AD particularly attractive, when compared with standard(nite-dierence) methods for the calculation of derivatives, is itscomputational eciency. In fact, AD exploits the information onthe structure of the computer code in order to optimise the calcu-lation. In particular, when one requires the derivatives of a small

number of outputs with respect to a large number of inputs, thecalculation can be highly optimised by applying the chain rulethrough the instructions of the program in opposite order withrespect to their original evaluation (Griewank, 2000). Tis givesrise to AAD.

Surprisingly, even if AD has been an active branch of computerscience for several decades, its impact in other research elds hasbeen fairly limited until recently. Interestingly, in contrast to theusual situation in which well-established ideas in applied mathe-

matics or physics have often been ‘borrowed’ by quants, AAD hasbeen introduced in MC applications in natural science (Sorella &Capriotti, 2010) only after its ‘rediscovery’ in quantitative nance.

In this article, we demonstrate how this powerful techniquecan be used for highly ecent computation of price sensitivitiesin the context of CCRM.

Counterparty credit risk management

 As a typical task in the day-to-day operation of a CCRM desk,here we consider the calculation of the credit valuation adjust-ment (CVA) as the main measure of a dealer’s counterparty creditrisk. For a given portfolio of trades facing the same investor orinstitution, the CVA aims to capture the expected loss associated

 with the counterparty defaulting in a situation in which the posi-tion, netted for any collateral agreement, has a positive mark-to-market for the dealer. Tis can be evaluated at time T 

0= 0 as:

 

V CVA

= E⎡

⎣⎢I τ

c≤ T ( ) D 0, τ

c( )

× LGD

τc( ) NPV  τ

c( )− C R τc

−( )( )( )+⎤

⎦⎥

(1)

 where tc

is the default time of the counterparty,  NPV (t ) is the netpresent value of the portfolio at time t from the dealer’s point of view, C( R(t )) is the collateral outstanding, typically dependent onthe rating R of the counterparty, L

GD(t ) is the loss given default,

 D(0, t ) is the discount factor for the interval [0, t ], and I( tc ≤ T ) is

the indicator that the counterparty’s default happens before thelongest deal maturity in the portfolio, T . Here, for simplicity of 

notation we consider the unilateral CVA, and the generalisationto bilateral CVA (Brigo & Capponi, 2010) is straightforward. Tequantity in (1) is typically calculated on a discrete time grid of ‘horizon dates’ T 

0< T 

1< ... < T  N O as, for instance:

 

V CVA

; E⎡

⎣⎢i=1

 N O

∑ I T i−1 < τ

c≤ T 

i( ) D 0,T i( )

× LGD T i( ) NPV T i( )−C R T i−( )( )( )

+⎤

⎦⎥

(2)

In general, the quantity above depends on several correlated ran-dom market factors, including the interest rate, the counterpar-

Real-time counterparty credit risk 

management in Monte Carlo Adjoint algorithmic dierentiation can be used to

implement the calculation o counterparty credit risk 

efciently. Luca Capriotti  , Jacky Lee and Matthew 

Peacock demonstrate how this powerul technique

can be used to reduce the computational cost by 

hundreds o times, thus opening the way to real-time

risk management in Monte Carlo

One of the

Page 2: Cap Riot Ti

8/3/2019 Cap Riot Ti

http://slidepdf.com/reader/full/cap-riot-ti 2/5

risk.net/risk-magazine  87

ty’s default time and rating, the recovery amount, and all themarket factors the net present value of the portfolio depends on.

 As such, its calculation requires a MC simulation.o simplify the notation and generalise the discussion beyond

the small details that might form part of a dealer’s denition of 

a specic credit charge, here we consider expectation values of the form:

 V  =EQ P R, X ( )⎡⎣ ⎤⎦

(3)

 with ‘payout’ given by:

P = P T i, R T 

i( ), X T i( )( )

i=1

 N O

(4)

 where:

 P T 

i, R T 

i( ), X T i( )( ) = %P

iX T 

i( );r( )δr,  R T i( )

r=0

 N  R

(5)

Here the rating of the counterparty entity including default, R(t ),is represented by an integer r = 0, ... , N 

 Rfor simplicity; X (t ) is the

realised value of the M market factors at time t . Q =Q( R, X ) rep-

resents a probability distribution according to which  R = ( R(T 1),... , R(T  N 0))

t and X = ( X (T 1), ... , X (T  N 0))

t are distributed; P~

i(⋅; r) is a

rating-dependent payout at time T i.1

Te expectation value in (3) can be estimated by means of MCby sampling a number  N 

 MC of random replicas of the underlying

rating and market state vector,  R[1], ... ,  R[ N  MC 

] and  X [1], ... ,

 X [ N  MC 

], according to the distributionQ( R, X ), and evaluating thepayout P( R,  X ) for each of them. Tis leads to the central limittheorem (Kallenberg, 1997) estimate of the option value V as:

 V  ;

1

 N  MC 

P R i MC [ ], X i

 MC [ ]( )i MC =1

 N  MC 

(6)

 with standard error S/ √  N __

 MC 

__, where S2 = E 

Q[P( R, X )2] – E 

Q[P ( R,

 X )]2 is the variance of the sampled payout.In the following, we will make minimal assumptions about the

particular model used to describe the dynamics of the market fac-tors. In particular, we will only assume that for a given MC sam-ple the value at time T 

iof the market factors can be obtained from

their value at time T i –1

by means of a mapping of the form X (T i) =

F i( X (T 

i –1), Z  X ) where Z  X  is a  N  X  dimensional vector of correlated

standard normal random variates,  X (T 0) is today’s value of the

market state vector, and F iis a mapping regular enough for the

pathwise derivatives method to be applicable (Glasserman, 2004),as is generally the case for practical applications.

 As an example of a counterparty rating model generally used inpractice, here we consider the rating transition Markov chainmodel of Jarrow, Lando & urnbull (1997) in which the rating attime T 

ican be simulated as:

  R T i( ) = I % Z i

 R>Q T i ,r( )

( )r=1

 N  R

(7)

 where Z ~ R

iis a standard normal variate, and Q(T 

i, r) is the quantile-

threshold corresponding to the transition probability from today’srating to a rating r at time T 

i. Note that the discussion below is

not limited to this particular model, and it could be applied withminor modications to other commonly used models describingthe default time of the counterparty and its rating (Schönbucher,2003). Here we consider the rating transition model (7) for itspractical utility, as well as for the challenges it poses in the appli-cation of the pathwise derivatives method, because of the dis-creteness of its state space.

In this setting, MC samples of the payout estimator in (6) canbe generated according to the following standard algorithm. For i= 1, ... , N 

O:

n Step 1. Generate a sample of  N  X  + 1 jointly normal randomvariables ( Z  R

i,  Z  X 

i) ≡ ( Z  R

i,  Z  X 

i,1, ... ,  Z  X 

i, N  X )t  distributed according to

φ( Z  Ri, Z  X ; ρi), a ( N  X +1)-dimensional standard normal probability density function with correlation matrix ρ

i, for example, with the

rst row and column corresponding to the rating factor.n Step 2. Iterate the recursion X (T 

i) = F 

i( X (T 

i –1), Z  X ).

n Step 3. Set  Z ~ R

i = Si

 j =1 Z  R

 j / √ i_

and calculate  R(T i) according to

(7).2

n Step 4. Calculate the time T ipayout estimator P(T 

i, R(T 

i), X (T 

i))

in (5), and add this contribution to the total estimator in (4).Te calculation of risk can be obtained in a highly ecient way 

by implementing the pathwise derivatives method (Broadie &Glasserman, 1996) according to the principles of AAD (Capri-otti, 2011, and Capriotti & Giles, 2010 and 2011). Te pathwisederivatives method allows the calculation of the sensitivities of V  (6) with respect to a set of  N 

θparameters θ = (θ

1, ... , θ N θ), say:

 

∂V  θ( )∂θ

= ∂∂θk 

E P R, X ( )⎡⎣ ⎤⎦

(8)

by dening appropriate estimators that can be sampled simulta-neously in the same MC simulation. Tis can be achieved by observing that whenever the payout function is regular enough(for example, Lipschitz-continuous, see Glasserman, 2004), onecan rewrite equation (8) by taking the derivative inside the expec-tation value, as:

 

∂V  θ( )∂θ

=EP

∂P R, X ( )∂θ

⎣⎢

⎦⎥

(9)

 where P = P( Z  R, Z  X ) is the distribution of the correlated normalvariates used in the MC simulation, which is independent of θ.3 Te calculation of equation (9) can be performed by applying thechain rule, and calculating the average value of the pathwisederivatives estimator:

θk  ≡∂Pθ R, X ( )

∂θk =

∂Pθ R, X ( )∂ X l  T i( )l =1

 M 

∑i=1

 N O

∑ ×∂ X l  T i( )∂θk 

+

∂Pθ R, X ( )∂θk 

(10)

 where we have allowed for an explicit dependence of the payouton the model parameters.4 Due to the discreteness of the statespace of the rating factor, the pathwise estimator for its relatedsensitivities is not well dened. However, as we will show below,one can express things in such a way that the rating sensitivitiesare incorporated in the explicit term ∂P

θ( R, X )/∂θ

k .

In the following, we will show how the calculation of the path- wise derivatives estimator (10) can be implemented eciently by means of AAD. We begin by briey reviewing this technique.

Adjoint algorithmic diferentiation

Griewank (2000) contains a detailed discussion of the computa-tional cost of AAD. Here, we will only recall the main results inorder to clarify how this technique can be benecial for the e-

1 Te discussion below applies also to the case in which the payout at time T idepends on the history of the 

market factors  X up to time T i

 2 Here we have used the fact that the payout (5) depends on the outturn value of the rating at time T iand 

not on its history  3 For simplicity of notation, we exclude the case in which θ includes the elements of the correlation matrix ρ in φ( Z  R, Z  X ; ρ). Te extension to this case is straightforward and can be performed along the lines of Capriotti & Giles (2010)4 Here and in the following we w ill use the standard AD notation θ

_

k to indicate the sensitivity of the 

 payout with respect to the model parameter  θk 

Page 3: Cap Riot Ti

8/3/2019 Cap Riot Ti

http://slidepdf.com/reader/full/cap-riot-ti 3/5

88 RJune 2011

cuttingg.cRitRisk 

cient implementation of the pathwise derivatives method. Teinterested reader can nd in Capriotti (2011) and Capriotti &Giles (2010 and 2011) several examples illustrating the intuitionbehind these results.

o this end, consider a function:

Y  = FUNCTION X ( )

(11)

mapping a vector X in Rn to a vector Y in Rm through a sequenceof steps:

  X →L→U →V →L→Y 

(12)

Here, each step can be a distinct high-level function or even anindividual instruction.

Te adjoint mode of AD results from propagating the deriva-tives of the nal result with respect to all the intermediate varia-bles – the so-called adjoints – until the derivatives with respect tothe independent variables are formed. Using the standard ADnotation, the adjoint of any intermediate variable V 

k is dened as:

V k  = Y  j ∂Y  j 

∂V k  j =1

m

(13)

 where Y _

is the vector in Rm. In particular, for each of the interme-diate variables U 

i, using the chain rule we get:

U i = Y  j  j =1

m

∑∂Y  j 

∂U i= Y  j 

 j =1

m

∑∂Y  j 

∂V k k 

∑∂V k ∂U i

 which corresponds to the adjoint mode equation for the interme-diate function V = V (U ):

U i = V k k 

∑∂V k ∂U i

(14)

namely a function of the form U _

= V _(U , V 

_). Starting from the

adjoint of the outputs, Y _

, we can apply this to each step in thecalculation, working from right to left:

  X ←L←U ←

V ←

L

←Y  (15)

until we obtain X _

, that is, the following linear combination of therows of the Jacobian of the function X  → Y :

 X i = Y  j  j =1

m

∑∂Y  j 

∂ X i

(16)

 with i = 1, ... , n.In the adjoint mode, the cost does not increase with the

number of inputs, but it is linear in the number of (linear com-binations of the) rows of the Jacobian that need to be eva luatedindependently. In particu lar, if the fu ll Jacobian is required, oneneeds to repeat the adjoint calculat ion m times, setting the vec-tor Y 

_equal to each of the elements of the canonical basis in Rm.

Furthermore, since the partial (branch) derivatives depend on

the values of the intermediate variables, one generally rst hasto compute the original calculation storing the values of all theintermediate variables such as U and V , before performing theadjoint mode sensitivity calculation.

One particularly important theoretical result (Griewank,2000) is that given a computer program performing some high-level function (11), the execution time of its adjoint counterpart:

 X = FUNCTION_ b X ,Y ( )

(17)

(with sux _b for ‘backward’ or ‘bar’) calculating the linear com-bination (16) is bounded by approximately four times the cost of execution of the original one, namely:

Cost  FUNCTION_ b[ ]Cost  FUNCTION[ ]

≤ω A

(18)

 with w A

 ∈ [3, 4]. Tus, one can obtain the sensitivity of a sin-gle output, or of a linear combination of outputs, to an unlim-

ited number of inputs for a little more work than the originalcalculation.

 As also discussed at length in Capriotti (2011) and Capriotti &Giles (2010 and 2011), AAD can be straightforwardly imple-mented by starting from the output of an algorithm and proceed-ing backwards, applying systematically the adjoint compositionrule (14) to each intermediate step, until the adjoints of the inputs(16) are calculated. As already noted, the execution of such back-

 ward sweep requires information that needs to be calculated andstored by executing beforehand the steps of the original algorithm– the so-ca lled forward sweep. A simple illustration of this proce-dure is discussed in the Appendix.

AAD and counterparty credit risk management

 When applied to the pathwise derivatives method, AAD allows

the simultaneous calculation of the pathwise derivatives estima-tors for an arbitrarily large number of sensitivities at a small xedcost. Here, we describe in detail the AAD implementation of thepathwise derivatives estimator (10) for the CCRM problem (1).

  As noted above, the sensitivities with respect to parametersaecting the rating dynamics need special care due to the discretenature of the state space. However, setting these sensitivities asidefor the moment, the AAD implementation of the pathwise deriv-atives estimator consists of Steps 1–4 described above plus thefollowing steps of the backward sweep. For i = N 

O, ... , 1:

n Step 4_

. Evaluate the adjoint of the payout:

 X T i( ),θ( ) = P T 

i, R T 

i( ), X T i( ),θ,P( )

 with P_

= 1.n Step 3

_. Nothing to do: the parameters θ do not aect this non-

dierentiable step.n Step 2

_. Evaluate the adjoint of the propagation rule in Step 2:

 X T i−1( ),θ( )+ = F 

iX T 

i−1( ),θ, Z  X , X T 

i( ),θ( ) where + = is the standard addition assignment operator.n Step 1

_. Nothing to do: the parameters θ do not aect this step.

 A few comments are in order. In Step 4_

, the adjoint of the pay-out function is dened while keeping the discrete rating variableconstant. Tis provides the derivatives X 

_

l (T 

i) = ∂P

θ/∂ X 

l (T 

i), and θ

_

k  

= ∂Pθ/∂θ

k . In dening the adjoint in Step 2

_, we have taken into

account that the propagation rule in Step 2 is explicitly depend-ent on both  X (T 

i) and the model parameters θ. As a result, its

adjoint counterpart produces contributions to both θ_

and  X _(T 

i).

Both the adjoint of the payout and of the propagation mapping

can be implemented following the principles of AAD as discussedin Capriotti (2011) and Capriotti & Giles (2011). In many situa-tions, AD tools can also be used as an aid or to automate theimplementation, especially for simpler, self-contained functions.In the backward sweep above, Steps 1

_and 3

_have been skipped

because we have assumed for simplicity of exposition that theparameters θ do not aect the correlation matrices ρ

iand the rat-

ing dynamics. If correlation risk is instead required, Step 2_

alsoproduces the adjoint of the random variables Z  X , and Step 1

_con-

tains the adjoint of the Cholesky decomposition, possibly withthe support of the binning technique, as described in Capriottiand Giles (2010).

Page 4: Cap Riot Ti

8/3/2019 Cap Riot Ti

http://slidepdf.com/reader/full/cap-riot-ti 4/5

risk.net/risk-magazine  89

Rating transition risk 

Te risk associated with the rating dynamics can be treated by noting that (5) can be expressed more conveniently as:

 

P T i ,% Z i

 R, X T i( )( ) = %Pi X T i( );0( )

+ %Pi X T i( );r( )− %Pi X T i( );r −1( )( )I % Z i R>Q T i ,r;θ( )( )

r=1

 N  R

(19)

so that the singular contribution to the pathwise derivatives esti-mator reads:

 

∂θk P T i ,

% Z i , X T i( )( ) =− %Pi X T i( );r( )− %Pi X T i( );r −1( )( )r=1

 N  R

×δ % Z i R=Q T i ,r;θ( )( )∂θk 

Q T i ,r;θ( )

(20)

Tis estimator cannot be sampled in this form with MC. Never-theless, it can be integrated out using the properties of Dirac’sdelta along the lines of Joshi & Kainth (2004), giving afterstraightforward computations:

 

θk  =−φ Z 

*

, Z i X 

,ρi

( )iφ Z i

 X ,ρi

 X ( )∂θk 

r=1

 N  R

∑ Q T i ,r;θ( )

× %Pi X T i( );r( )− %Pi X T i( );r −1( )( )

(21)

 where Z * is such that ( Z * + Si j  –1=1 Z  R

 j )/ √ i

_= Q(T 

i, r; θ), and φ( Z  X 

i, ρ X 

i)

is a N  X 

-dimensional standard normal probability density function with correlation matrix ρ X 

iobtained by removing the rst row and

column of ρi; here ∂θk Q(T 

i, r; θ) is not stochastic and can be eval-

uated (for example, using AAD) once per simulation. Te nalresult is rather intuitive as it is given by the probability-weightedsum of the discontinuities in the payout.

Results

 As a numerical test, we present here results for the calculation of risk on the CVA of a portfolio of commodity derivatives. For thepurpose of this illustration, we consider a simple one-factor log-normal model for the futures curve of the form:

dF T  t ( )F T  t ( )

=σT exp −β T − t ( )( )dW t 

(22)

 where W t 

is a standard Brownian motion; F T (t ) is the price at

time t of a futures contract expiring at T ; sT 

and b dene a sim-ple instantaneous volatility function that increases approach-ing the contract expiry, as empirically observed for many com-modities. Te value of the future’s price F 

T (t ) can be simulated

exactly for any time t  so that the propagation rule in Step 2reads for T 

i ≤ T :

F T 

T i( ) = F 

T T i

−1( )exp σi ΔT i Z −

1

2σi

2ΔT i⎛

⎝⎜

⎠⎟

(23)

 where DT i= T 

i– T 

i –1and:

σi

2=

σT 

2

2βΔT i

e−2βT 

e2βT 

i − e2βT 

i−1( )is the outturn variance. In this example, we will consider deter-ministic interest rates. As an underlying portfolio for the CVA calculation, we consider a set of commodity swaps, paying on astrip of futures (for example, monthly) expiries t 

 j , j = 1, ... ,  N 

the amount F t  j (t  j ) – K . Te time t net present value for this port-folio reads:

160

140

120

100

80

60

40

20

0

0 100 200 300 400 500 600N risks

       S     p     e     e       d   -     u     p       /      R      C      P      U

°

°

°

° • • ••

Note: the full dots are the ratio of the CPU time required for the

calculation of the CVA, and its sensitivities, and the CPU time spentfor the calculation of the CVA alone. Lines are guides for the eye

1speed-pheallaoofrforhecVA

ofaporfolooffveommodywapoverafve-

yearhorzo,aafoofhemberofr

allaed(empydo)

  NPV t ( ) = D t ,t  j ( ) j =1

 N e

∑ F t  j t ( )−K ( )

(24)

Note that although we consider here for simplicity of exposition alinear portfolio, the method proposed applies to an arbitrarily complex portfolio of derivatives, for which in general NPV (t ) willbe a non-linear function of the market factors F t  j (t ) and modelparameters θ.

For this example, the adjoint propagation rule in Step 2_

simply reads:

F T 

T i−1( )+ = F 

T T 

i( )exp σi

ΔT i Z −

1

i

2ΔT i

⎝⎜

⎠⎟

σ i = F T 

T i( ) F T 

i( ) ΔT i Z −σ iΔT 

i( ) with s

_

irelated to this step’s contribution to the adjoint of the

future’s volatility s_

T by:

σT + =

σi

2βΔT i

e−2βT 

e2βT 

i − e2βT 

i−1( )

 At the end of the backward path, F _

T (0) and s

_

T contain the path-

 wise derivatives estimator (10) corresponding, respectively, to thesensitivity with respect to today’s price and volatility of the futures

contract with expiry T .Te remarkable computational eciency of the AAD imple-

mentation is illustrated in gure 1. Here, we plot the speed-upproduced by AAD with respect to the standard nite-dierencemethod. On a fairly typical trade horizon of ve years, for a port-folio of ve swaps referencing distinct commodities futures withmonthly expiries, the CVA bears non-trivial risk to more than600 parameters: 300 futures prices (F 

T (0)), and at-the-money 

volatilities (sT ), say 10 points on the zero rate cur ve, and 10 points

on the credit default swap curve of the counterparty used to cali-brate the transition probabilities of the rating transition model(7). As illustrated in gure 1, the computation time required for

Page 5: Cap Riot Ti

8/3/2019 Cap Riot Ti

http://slidepdf.com/reader/full/cap-riot-ti 5/5

90 RJune 2011

cuttingg.cRitRisk 

the calculation of the CVA and its sensitivities is less than fourtimes that spent for the computation of the CVA alone, as pre-dicted by equation (18). As a result, even for this very simpleapplication, AAD produces risk measures more than 150 timesfaster than nite dierences, that is, for a CVA evaluation taking

10 seconds, AAD produces the full set of sensitivities in less than40 seconds, while nite dierences require approximately 1 hourand 40 minutes.

Moreover, as a result of the analytic integration of the singularitiesintroduced by the rating process, the risk measures produced by 

 AAD are typically less noisy than those produced by nite dier-ences. Tis is illustrated in table A, which shows the variance reduc-tion on the sensitivities with respect to the thresholds Q(T 

i, r) for a

simple test case. Here, we have considered the calculation of a calloption of the form (F 

T (T 

i) –C ( R(T 

i)))+ with a strike C ( R(T 

i)) linearly 

dependent on the rating, and T i= 1. Te variance reduction dis-

played in the table can be thought of as a further speed-up factorbecause it corresponds to the reduction in the computation time fora given statistical uncertainty on the sensitivities. Tis diverges asthe perturbation in the nite-dierence estimators d tends to zero,and may be very signicant even for a fairly large value of d.

Conclusion

In conclusion, we have shown how AAD allows an extremely e-cient calculation of counterparty credit risk valuations in MC.Te scope of this technique is clearly not limited to this impor-tant application but extends to any valuation performed withMC. For any number of underlying assets or names in a portfolio,the proposed method allows the calculation of the complete risk at a computational cost that is at most four times the cost of cal-culating the prot and loss of the portfolio. Tis resu lts in remark-able computational savings with respect to standard nite-dier-ence approaches. In fact, AAD allows one to perform in minutesrisk runs that would take otherwise several hours or could not

even be performed overnight without large parallel computers.

  AAD therefore makes possible real-time risk management inMC, allowing investment rms to hedge their positions moreeectively, actively manage their capital allocation, reduce theirinfrastructure costs and ultimately attract more business. n

Lacaproadreor,JayLeeamaadreoradMahew

Peaoave-predeheQaavesraeedeparmeofhe

vemebadvoofcredsegropnewYor.theywold

leohaMegle,AdamPeao,nseedadMarsedmafor

meroefldo,adFredrAeoforaareflreadofhe

marp.theopoadvewexpreedharlearehoeofhe

ahor,addooeearlyrepreehoeofcredsegrop.mal:

[email protected],[email protected],mahew.

[email protected]

Brigo D and A Capponi, 2010

Bilateral counterparty risk with

application to CDSs

Risk March, pages 85–90

Broadie M and P Glasserman, 1996

Estimating security price derivatives

using simulation

Management Science 42, pages

269–285

Capriotti L, 2011

Fast Greeks by algorithmic 

diferentiation

Journal of Computational Finance

3(3), pages 3–35

Capriotti L and M Giles, 2010

Fast correlation Greeks by adjoint 

algorithmic diferentiation

Risk April, pages 79–83

Capriotti L and M Giles, 2011

 Algorithmic diferentiation: adjoint Greeks made easy 

Available at http://ssrn.com/ 

abstract=1801522

Giles M and P Glasserman, 2006

Smoking adjoints: ast Monte Carlo

Greeks

Risk January, pages 92–96

Glasserman P, 2004

Monte Carlo methods in nancial 

engineering

Springer, New York 

Griewank A, 2000

Evaluating derivatives: principles

and techniques o algorithmic 

diferentiation

Frontiers in Applied Mathematics,Philadelphia

Jarrow R, D Lando and S Turnbull,

1997

 A Markov model or the term structure

o credit spreads

Review of Financial Studies 10, pages

481–523

Joshi M and D Kainth, 2004

Rapid computation o prices and 

deltas o n-th to deault swaps in the

Li model 

Quantitative Finance 4, pages

266–275

Kallenberg O, 1997

Foundations o modern probability 

Springer, New York 

Schönbucher P, 2003

Credit derivatives pricing models:

models, pricing, implementation

Wiley Finance, London

Sorella S and L Capriotti, 2010

 Algorithmic diferentiation and the

calculation o orces in quantum

Monte Carlo

Journal of Chemical Physics 133,

pages 234111 1–10

Referee

A.Varaeredo(VR)oheevewh

repeohehreholdQ(1,r )(N R=3)foraallopo

whara-depedere

d VR[(Q(1,1)] VR[Q(1,2)] VR[Q(1,3)]

0.1 24 16 12

0.01 245 165 125

0.001 2,490 1,640 1,350

Note: d indicates the perturbation used in the nite-dierence estimators of the sensitivities. The

specication of the parameters used for this example is available upon request

As a simple example of adjoint algorithmic dierentiation (AAD) implementa-

tion, we consider an algorithm mapping a set of inputs (θ1, ... , θ

n) into a single

outputP, according to the following steps:n Step 1. Set X 

i= exp(–θ2

i/2 + θ

i Z ), for i = 1, ... , n, where Z is a constant.

n Step 2. Set P = (Sn

i=1 X 

i– K )+, where K is a constant.

 The corresponding adjoint algorithm consists of Steps 1 and 2 (forward sweep),

plus a backward sweep consisting of the adjoints of Steps 2 and 1, respectively:

n Step 2_

. Set X _

i= P

_ I(Sn

i=1 X 

i– K > 0), for i = 1, ... , n.

n Step 1_

. Set θ_

i= X 

i(–θ

i+ Z ), for i = 1, ... , n.

We can immediately verify that the output of the adjoint algorithm above

gives for P_

= 1 the full set of sensitivities with respect to the inputs, θ_

i= ∂P/∂θ

i.

Note that, as described in the main text, the backward sweep requires informa-

tion that is calculated during the execution of the forward sweep, Steps 1 and 2,for example, to calculate the indicator I(Sn

i=1 X 

i– K ) and the value of  X 

i. Finally,

simple inspection shows that both the forward and the backward sweep have a

computation complexity O(n), that is, all the components of the gradient of P 

can be obtained at a cost that is of the same order of the cost of computing P, in

agreement with the general result (18). It is easy to recognise in this example a

stylised representation of the calculation of the pathwise estimator for vega

(volatility sensitivity) of a call option on a sum of lognormal assets.

Appedx:ampleexample