Top Banner
Department of Physics Ume˚ a University February 4, 2017 Credit Risk Modeling and Implementation Report 1.2 Johan Gunnars ([email protected]) Master’s Thesis in Engineering Physics, 30.0 credits. Supervisor: Oskar Janson ([email protected]) Examiner: Markus ˚ Adahl ([email protected])
50

Credit Risk Modeling and Implementation Report 1.2

Mar 30, 2023

Download

Documents

Khang Minh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Credit Risk Modeling and Implementation Report 1.2

Department of PhysicsUmea University February 4, 2017

Credit Risk Modeling and Implementation

Report 1.2

Johan Gunnars ([email protected])

Master’s Thesis in Engineering Physics, 30.0 credits.Supervisor: Oskar Janson ([email protected])

Examiner: Markus Adahl ([email protected])

Page 2: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Abstract

The financial crisis and the bankruptcy of Lehman Brothers in 2008 lead toharder regulations for the banking industry which included larger capital re-serves for the banks. One of the parts that contributed to this increased capitalreserve was the the credit valuation adjustment capital charge which can beexplained as the market value of the counterparty default risk. The purpose ofthe credit valuation adjustment capital charge is to capitalize the risk of futurechanges in the market value of the counterparty default risk.

One financial contract that had a key role in the financial crisis was the creditdefault swap. A credit default swap involves three different parts, a contractseller, a contract buyer and a reference entity. The credit default swap can beseen as an insurance against a credit event, a default for example of the refer-ence entity.This thesis focuses on the study and calculation of the credit valuation ad-justment of credit default swaps. The credit valuation adjustment on a creditdefault swap can be implemented with two different assumptions. In the firstcase, the seller (buyer) of the contract is assumed to be default risk free andthen only the buyer (seller) contributes to the default risk. In the second case,both the seller and the buyer of the contract is assumed to be default risky andtherefore, both parts contributes to the default risk.

i

Page 3: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Sammanfattning

Finanskrisen och Lehman Brothers konkurs 2008 ledde till hardare regleringarfor banksektorn som bland annat innefattade krav pa storre kapitalreserver forbankerna. En del som bidrog till denna okning av kapitalreserverna var kred-itvardighetsjusteringens kapitalkrav som kan forklaras som marknadsvardet avmotpartsrisken. Syftet med kreditvardighetsjusteringens kapitalkrav ar att kap-italisera risken for framtida forandringar i marknadsvardet av motpartsrisken.

Ett derivat som hade en nyckelroll under finanskrisen var kreditswappen. Enkreditswap innefattar tre parter, en saljare, en kopare och ett referensforetag.Kreditswappen kan ses som en forsakring mot en kredithandelse, till exempelen konkurs pa referensforetaget.Detta arbete fokuserar pa studier och berakningar av kreditvardesjusteringenpa kreditswappar. Kreditvardesjusteringen pa en kreditswap kan implementerasmed tva olika antaganden. I det forsta fallet antas saljaren (koparen) vara risk-fri och da bidrar bara koparen (saljaren) till konkursrisken. I det andra falletantas bade saljaren och koparen bidra till konkursrisken.

ii

Page 4: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Contents

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Counterparty Credit Risk . . . . . . . . . . . . . . . . . . . . . . 11.3 Over-The-Counter . . . . . . . . . . . . . . . . . . . . . . . . . . 11.4 Credit Default Swap . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.4.1 Credit event . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4.2 Settlement . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4.3 The Usage of CDS Contracts . . . . . . . . . . . . . . . . 3

1.5 Regulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.6 Credit Valuation Adjustment . . . . . . . . . . . . . . . . . . . . 51.7 Right and Wrong Way Risk . . . . . . . . . . . . . . . . . . . . . 5

2 Theory 62.1 Credit Default Swap . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.1.1 Premium Leg . . . . . . . . . . . . . . . . . . . . . . . . . 62.1.2 Protection leg (Payment Leg) . . . . . . . . . . . . . . . . 72.1.3 Credit Default Swap Payoff . . . . . . . . . . . . . . . . . 7

2.2 Hazard and Survival Function . . . . . . . . . . . . . . . . . . . . 82.3 Credit Valuation Adjustment . . . . . . . . . . . . . . . . . . . . 9

2.3.1 Unilateral CVA for CDS . . . . . . . . . . . . . . . . . . . 92.3.2 Bilateral CVA for CDS . . . . . . . . . . . . . . . . . . . 92.3.3 Default Correlation . . . . . . . . . . . . . . . . . . . . . . 102.3.4 CIR++ Intensity Model . . . . . . . . . . . . . . . . . . . 11

3 Method 123.1 Construction of Hazard Rate and Survival Probability Curve . . 12

3.1.1 Premium Leg . . . . . . . . . . . . . . . . . . . . . . . . . 123.1.2 Protection leg . . . . . . . . . . . . . . . . . . . . . . . . . 123.1.3 Bootstrapping hazard rate . . . . . . . . . . . . . . . . . . 133.1.4 Survival probability . . . . . . . . . . . . . . . . . . . . . 14

3.2 CVA for CDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.2.1 Calibration of CIR++ Process . . . . . . . . . . . . . . . 153.2.2 CIR++ Simulation . . . . . . . . . . . . . . . . . . . . . . 163.2.3 Conditional Survival Probability . . . . . . . . . . . . . . 173.2.4 Fractional Fast Fourier Transform . . . . . . . . . . . . . 173.2.5 Conditional Gaussian Copula Function . . . . . . . . . . . 19

4 Results 214.1 Survival Curve Construction from Market Spreads . . . . . . . . 214.2 Unilateral CVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.3 Bilateral CVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

5 Discussion 305.1 Survival Curve Construction from Market Spreads . . . . . . . . 305.2 Unilateral and Bilateral CVA . . . . . . . . . . . . . . . . . . . . 305.3 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

5.3.1 Adjoint Algorithmic Differentiation. . . . . . . . . . . . . 315.3.2 Interest Rate Swaps . . . . . . . . . . . . . . . . . . . . . 31

iii

Page 5: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

5.3.3 Collateralized CVA . . . . . . . . . . . . . . . . . . . . . . 315.3.4 Calibration of Intensity Process Parameters . . . . . . . . 31

A Appendix 34A.1 Derivation of Conditional Copula . . . . . . . . . . . . . . . . . . 34A.2 CDS Input Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 35A.3 CVA Input Parameters . . . . . . . . . . . . . . . . . . . . . . . . 37A.4 Unilateral CVA Simulation Results . . . . . . . . . . . . . . . . . 37A.5 Simulation Verification Results . . . . . . . . . . . . . . . . . . . 40

A.5.1 Risk Free Investor . . . . . . . . . . . . . . . . . . . . . . 40A.5.2 All Parts Risky . . . . . . . . . . . . . . . . . . . . . . . . 43

iv

Page 6: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

1 Introduction

1.1 Background

Cinnober FT is a developer of financial systems for clearing of financial transac-tions. The primary function of the clearing house is to eliminate counterpartyrisk between the two parties of a trade. The trades most commonly handledby a clearing house are those created on exchanges. The clearing house insertsitself as the counterparty to both the seller and the buyer. The clearing housecalculates a risk margin value that both parts of the trade have to post as col-lateral while the trade is being cleared. If one part involved in the trade failsto fulfill their obligation, the clearing house can take this collateral and settlewith the other part of the trade.However, if you are trading outside the exchange, on the so called over thecounter market (OTC), a clearing houses may not be involved. This means thatyou are directly exposed to the credit risk of your counterparty.

The goal of the thesis is to investigate and implement credit risk models. Thecompleted implementation will rely on a sound theoretical framework comple-mented with recognized best practices and be possible to run on top of actualmarket data such as CDS spreads.

1.2 Counterparty Credit Risk

The financial risk is normally divided into smaller parts. One important part isthe counterparty credit risk or just counterparty risk, but to be able to explaincounterparty risk, there are two other parts of the financial risk that have to beexplained.Credit risk can be explained as the risk that a debtor is unable or unwilling tomake a payment to fulfill contractual obligations. This is generally known as adefault.Market risk is the risk of losses in positions arising from movements in marketprices. If it is linear, it arises from an exposure to the movements of underlyingvariables such as stock prices and credit spreads. This risk can be eliminatedby entering into an offsetting contract.Counterparty risk represents a combination of market risk, which defines theexposure and the credit risk, which defines the credit quality of the counterpart,(Gregory, 2012).Counterparty risk is of major importance in over the counter derivatives becausethe counterparty risk is mitigated in exchange traded derivatives, (MosegardSvendsen, 2014).

1.3 Over-The-Counter

The over-the-counter (OTC) market is the off-exchange market and the largestdifference from the exchange market is that the participants of a trade aredirectly exposed to the credit risk, the risk of a default of the counterpart. Whentrading on the exchange, a clearing house act as a middle part and eliminatesthe credit risk and make sure that the trade goes through by taking collateral,a fee depending on how risky every part of the trade is.

1

Page 7: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

1.4 Credit Default Swap

The credit default swap (CDS) is an agreement between two parties to exchangethe credit risk of a reference entity, (Beinstein and Scott, 2006). The CDScan easiest be explained as an insurance but there are differences between aninsurance and a CDS. The largest difference is that the CDS buyer does notneed to own what he/she insure. This means that by buying a CDS, you couldinsure someone else’s property.The buyer of the contract, pays regular payments to the seller of the contract.In the case of a credit event for the reference entity, the payments stop and theseller of the CDS pays a large amount to the buyer. If the contract expires, theseller has received regularly payments and does not need to pay anything back.

Figure 1: The credit default swap consists of three parts, the protection buyer,the protection seller and a reference entity.

1.4.1 Credit event

The trigger of the CDS contract is called a credit event. These are a few possiblecredit events, explained by (Beinstein and Scott, 2006):

• Bankruptcy: Includes insolvency, creditor arrangements and appoint-ment of administrators.

• Failure to pay: When a payment on one or more obligations fails afterany grace period.

• Restructuring: Refers to a change in the agreement between the refer-ence entity and the holder of the obligation due to the deterioration increditworthiness or financial condition to the reference entity. This withrespect to reduction of interest or principal, postponement of payment ofinterest or principal, change of currency and contractual subordination.

2

Page 8: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

1.4.2 Settlement

Let us assume that an investor is exposed to an entity through a bond andwants to hedge the default risk of the entity. Then the investor can buy a CDSwith this entity as the reference.If the reference entity defaults before the maturity of the CDS, then the in-vestor of the CDS will receive a single default payment from the seller of thecontract. This is called settlement. The settlement is usually physical or in cash.

If the settlement is physical, the investor deliver the bond to the seller of theCDS in exchange for a payment equal to the face value of the bond.If the settlement is in cash, the investor receives a payment of the differencebetween the face value and the market value of the bond.

1.4.3 The Usage of CDS Contracts

There are several different application for credit default swaps.Let us assume that there are three companies, named A,B and C.

In this first example, company A is lending company B $1 million and willreturn 10% of interest per year. Company A wants to insure the loan and buysa CDS from company C with company B as reference entity. Company A pays1% of the loan to company C in exchange for an insurance against a default ofcompany B, see Figure 2. In the event of a default of company B, company Cwill compensate company A for the loss. If company B would have defaultedwithout the CDS, company A would not get the money back.

Figure 2: Example 1 to the left and example 2 to the right.

In this second example, company A suspects that company C will default in thenear future and buys a CDS from company B with company C as the referenceentity. Company A pays periodic payments to company B and receives a default

3

Page 9: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

payment in the case of a default of company C, see Figure 2. This is the samething as buying an insurance on someone else’s car and hoping that the car willsuffer an accident.In this last example, company A is a pension fund that wants to invest theirmoney. The problem is that they can only lend their money to someone witha very high credit rating. Let us assume that company B wants to borrow themoney from company A but the credit rating of company B is too low. Inthis case, company A can buy a CDS from company C with company B asthe reference entity. Lets assume that the credit rating for company C is thehighest possible. Then company A would lend their money to company B andcompany C will compensate company A in the case of a default of companyB, see Figure 3. The result of this example is that company A will lend theirmoney to company B which now have the credit rating of company C.

Figure 3: Example 3.

1.5 Regulations

Too big to fail is a concept that can be explained as when a company is soessential to the economy in the world, the government will bail them out in caseof bankruptcy to prevent a global economic disaster. Trading with one of thesecompanies was considered risk free but the latest financial crisis in 2008 and thebankruptcy of Lehman Brothers showed that no investments are risk free.

The Basel accords were constructed to reduce the banks’ market and creditrisk exposure. The framework of Basel I mainly focuses on credit risk. Basel IIwas more risk aware and was based on three pillars. Minimum capital require-ments, supervisory review and the market discipline. Basel II was implementedin the middle of the financial crisis at 2008 but before it was completely imple-mented, Basel III began to develop. This lead to the fact that Basel II neverreached its full potential.

Basel III was implemented after the financial crisis and focuses mainly on the

4

Page 10: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

risk of a bank run and requires larger capital reserves by the banks. One ofthe parts that were added to the total counterpart credit risk capital charge inBasel III is the credit valuation adjustment capital charge (CVA capital charge).(Norman and Chen, 2013).

The purpose of the CVA capital charge is to capitalize the risk of future changesin CVA. Every new accord comes with harder regulations and that trend willprobably continue.

1.6 Credit Valuation Adjustment

CVA is the difference between the risk free portfolio value and the true portfoliovalue that includes the possibility of a counterpart default. In other words, CVAis the market value of counterpart credit risk, (Pykhtin and Zhu, 2007).

1.7 Right and Wrong Way Risk

Right and wrong way risk is a concept that comprises a correlation between thedefault risk of a counterpart and the value of the underlying contract. Wrongway risk occurs in the case of a positive correlation and right way risk with anegative correlation.When the default risk of the counterpart increases at the same time as the valueof the contract increases, the wrong way risk will increase the CVA. The rightway risk is the opposite, with an increasing default risk and a decreasing valueof the contract, the CVA will decrease.

One example of wrong way risk is then a company sells a put option, the rightbut not the obligation, to sell the companies own stock. When the stock price de-creases, the value of the put option increases. When the stock price decreases,the default risk of the company increases. (Hoffman, 2011) and (Milwidsky,2011).

5

Page 11: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

2 Theory

This section consists of three parts. The first part describes the parts of thecredit default swap and the valuation of the contract. The second part describesthe theory behind the hazard rate and the corresponding survival probability.The final part gives the theory behind bilateral credit valuation adjustment.This involves simulation of an intensity model, correlation of defaults and val-uation of the bilateral credit valuation adjustment.

2.1 Credit Default Swap

The theory in this section is based on (Brigo and Mercurio, 2006).A credit event of the referent will from now be denoted as a default and thethree parts of the contract will be denoted as:

• 0 = Investor, the part that calculates the CVA

• 1 = Reference entity

• 2 = Counterpart, the part that the CVA is calculated on

The default time is denoted by τi where the index i = 0,1,2 represents thedifferent parts of the contract. The protection buyer pays regular payments atthe rate of S, the spread, at the predetermined times Ta+1, Ta+2, ..., Tb until thecontract expires or until a default of the reference entity occurs.In exchange, the protection buyer receives a payment of the loss given default(LGD) on the notional at a default of the reference entity. The LGD can obtaina maximum value of 1 when the full notional is paid and a minimum value of 0when nothing is paid.

2.1.1 Premium Leg

The value of the premium leg is the present value of the payments that is madeby the protection buyer, (Cojocaru and Militaru, 2014).With the assumption that the stochastic discount factor D(s, t) is independentof the default time τ1 for all 0 < s < t, the value of the premium leg at time 0of the CDS can be defined as:

PremiumLega,b(S) = E[D(0, τ1)(τ1 − Tγ(τ1)−1)S1{Ta<τ1<Tb}

]++

b∑i=a+1

E[D(0, Ti)αiS1{τ1≥Ti}

]= S

∫ Tb

t=Ta

P (0, t)(τ1 − Tγ(τ1)−1)Q(τ1 ∈ [t, t+ dt))

+S

b∑i=a+1

P (0, Ti)αiQ(τ1 ≥ Ti)

= −S∫ Tb

t=Ta

P (0, t)(τ1 − Tγ(τ1)−1)dtQ(τ1 ≥ t)

+S

b∑i=a+1

P (0, Ti)αiQ(τ1 ≥ Ti)

(1)

6

Page 12: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

where αi is the year fraction between Ti−1 and Ti, Tγ(τ1)−1 is the last paymentdate before τ1, P (0, t) is the zero coupon bond observed from the market thatdiscounts the payments back from time t to 0 and Q(τ1 ≥ T ) is the survivalprobability. τ1 represents the default time of the reference entity.The integral term represent the accrued premium which is the fraction of thepremium that has accrued from the preceding payment date up to the defaulttime and the summation term represents the discounted payments, (O’Kaneand Turnbull, 2003).

2.1.2 Protection leg (Payment Leg)

The value of the protection leg is the present value of the amount that the pro-tection buyer receives in the case of a default of the reference entity, (Cojocaruand Militaru, 2014).With the assumption that the default time τ1 and the interest rates are inde-pendent, the value of the protection leg at time 0 of the CDS can be definedas:

ProtecLega,b(LGD) = E[1{Ta<τ1≤Tb}D(0, τ1)LGD

]= LGD

∫ Tb

t=Ta

P (0, t)Q(τ1 ∈ [t, t+ dt))

= −LGD

∫ Tb

t=Ta

P (0, t)dtQ(τ1 ≥ t))

(2)

2.1.3 Credit Default Swap Payoff

By again assuming that the default time and the interest rates are independentand that the recovery rate is deterministic, the value of a CDS contract to theseller at time t is given by:

CDSa,b(t;S) = PremiumLega,b(t;S)− ProtecLega,b(t;S) (3)

(Milwidsky, 2011). To obtain the value of the CDS to the protection buyer, thesigns in front of the legs is switched.Given a CDS contract at time 0 for a default of the reference entity betweentime Ta and Tb, with the periodic premium rate S1 and the loss given defaultLGD1, the value of the CDS to the protection seller is given by:

CDSa,b(0, S1,LGD1) = S1

[−∫ Tb

t=Ta

P (0, t)(t− Tγ(t)−1)dtQ(τ1 ≥ t)

+

b∑i=a+1

P (0, Ti)αiQ(τ1 ≥ Ti)

]

+LGD1

[∫ Tb

t=Ta

P (0, t)dtQ(τ1 ≥ t)

] (4)

where γ(t) is the first payment in period Tj following time t.We now denote

NPV(Tj , Tb) := CDSa,b(Tj , S,LGD1) (5)

7

Page 13: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

the residual NPV of a receiver CDS between the times Ta and Tb evaluated atTj , where Ta < Tj < Tb. NPV is the net present value.Equation (5) can be written on the same form as Equation (4) but for evaluationat time Tj :

NPV(Tj , Tb) = CDSa,b(Tj , S1,LGD1)

= 1τ1>Tj

{S1

[−∫ Tb

max{Ta,Tj}P (Tj , t)(t− Tγ(t)−1)dtQ(τ1 ≥ t|FTj )

+

b∑i=max{a,j}+1

P (Tj , Ti)αiQ(τ1 ≥ Ti|FTj )

+ LGD1

[∫ Tb

max{Ta,Tj}P (Tj , t)dtQ(τ1 ≥ t|FTj )

]}(6)

where evaluation is conditioned on the information that is available to the mar-ket at time Tj , FTj . (Brigo and Capponi, 2008).

2.2 Hazard and Survival Function

The theory in this section is based on (Rodriguez, 2010).Let us assume that T is a continuous random variable, f(t) is the pdf, F (t) =Pr {T < t} is the cdf which gives the probability of an event has occurred byduration t. The survival function is defined as the complement of the cdf:

Q(t) = Pr {T ≥ t} = 1− F (t) =

∫ ∞t

f(x)dx (7)

The survival function gives the probability that a default has not occurred untiltime t. The hazard rate is the instantaneous rate of default and can be definedas:

λ(t) = limdt→0

Pr {t ≤ T < t+ dt|T ≥ t}dt

(8)

The numerator gives the conditional probability of default in the interval [t, t+ dt)given that a default has not already occurred, and the denominator is the widthof the interval. By taking the limit of the expression and letting dt go to zero,the result obtained is the instantaneous rate of default, or the hazard rate.According to (Schonbucher, 2003), the hazard rate can be rewritten as:

λ(t) =f(t)

Q(t)(9)

This formula means that the default rate at time t is equal to the probabil-ity density function at t divided by the survival probability until time t. Bycombining Equation (7) and Equation (9), the hazard rate can be expressed as:

λ(t) = − d

dtlogQ(t) (10)

If we integrate the expression from 0 to t, the survival probability at time t canbe written as a function of the hazard rates up to time t:

Q(t) = exp

{−∫ t

0

λ(x)dx

}(11)

8

Page 14: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

The integral is the cumulative hazard function and it can be viewed as the sumof the risks from time 0 to t:

Λ(t) =

∫ t

0

λ(x)dx. (12)

Given the hazard rates, the survival function can be calculated and given thesurvival function, the hazard rates can be calculated. The survival functiongives the curve with the probability of default at different times. The hazardrate is the short time probability of default.

2.3 Credit Valuation Adjustment

The theory in this section is based on (Brigo and Capponi, 2008).The unilateral credit valuation adjustment (UCVA) can be explained as thedifference in the price for a contract with a default risk free counterpart andthat with a default risky counterpart. The bilateral credit valuation adjustment(BCVA) can be explained as the difference in the price for a contract with adefault risk free investor and counterpart and the price of the contract with adefault risky investor and counterpart, (Hoffman, 2011). The CVA can be seenas the price of the default risk.Let us now define long and short position for the CVA calculation.

• Long: Calculated from the buyer, on the seller of the CDS.

• Short: Calculated from the seller, on the buyer of the CDS.

2.3.1 Unilateral CVA for CDS

The unilateral credit valuation adjustment for the short position is given by:

UCVAa,b(t, S,LGD1,2)

= LGD2Et

[1{t<τ2≤T} P (t, τ2)

[NPV(τ2)]+

] (13)

and for the long position:

UCVAa,b(t, S,LGD1,2)

= LGD2Et

[1{t<τ2≤T} P (t, τ2)

[−NPV(τ2)]+

] (14)

From Equation (13), (14) and (6), it is clear that the only terms that are leftto calculate are:

1τ1>τ2Q(τ1 > t|Fτ2) (15)

2.3.2 Bilateral CVA for CDS

Let us define the following events:

• A = {τ0 ≤ τ2 ≤ T} Investor defaults before counterpart, both defaultsbefore the maturity of the contract.

• B = {τ0 ≤ T ≤ τ2} Investor defaults before the maturity of the contract,the counterpart defaults after the maturity.

9

Page 15: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

• C = {τ2 ≤ τ0 ≤ T} Counterpart defaults before the investor, both defaultsbefore the maturity of the contract.

• D = {τ2 ≤ T ≤ τ0} Counterpart defaults before the maturity of thecontract, the investor defaults after the maturity.

The bilateral credit valuation adjustment for the short position is given by:

BCVAa,b(t, S,LGD0,1,2)

= LGD2Et{1C∪DP (t, τ2) [ NPV(τ2)]+}− LGD0Et{1A∪BP (t, τ0) [ −NPV(τ0)]+}

(16)

and for the long position:

BCVAa,b(t, S,LGD0,1,2)

= LGD2Et{1C∪DP (t, τ2) [ −NPV(τ2)]+}− LGD0Et{1A∪BP (t, τ0) [ NPV(τ0)]+}

(17)

From Equation (16), (17) and (6), is is clear that the only terms that are leftto calculate are:

1C∪D1τ1>τ2Q(τ1 > t|Fτ2) (18)

and1A∪B1τ1>τ0Q(τ1 > t|Fτ0) (19)

The big advantage for BCVA against Unilateral CVA is that BCVA is sym-metric. The BCVA of the investor is minus the BCVA for the counterpart,(Hoffman, 2011).

2.3.3 Default Correlation

Let us assume that the defaults are correlated between the parts of the contract.The dependence is modeled by using a trivariate Gaussian copula function. Theexponential random variables that characterizes the default times are modeledwith the dependence function. The default intensities λi for the parts of thecontract are assumed to be independent of each other. By assuming that thecumulative intensities are strictly positive, Λi will be invertible. The defaulttimes τi can be defined as

τi = Λ−1i (ξi), i = 0, 1, 2 (20)

where ξi is a standard unit-mean exponential random variable. From the prop-erties of exponential random variables follows that

Ui = 1− exp(−ξi) (21)

are uniform [0, 1] randomly distributed which are correlated through a Gaussiantrivariate copula

CR(u0, u1, u2) = Q(U0 < u0, U1 < u1, U2 < u2) (22)

where R is a correlation matrix.

10

Page 16: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

2.3.4 CIR++ Intensity Model

The stochastic intensity model that we chose for simulation of the paths for thethree parties of the contract is

λj(t) = yj(t) + ψj(t;βj), t ≥ 0, j = 0, 1, 2 (23)

where ψ is a deterministic function that depends on the parameter vector βjand is integrable on closed intervals. yj is assumed to be a Cox Ingersoll Ross(CIR) process that is given by

dyj(t) = κj(µj − yj(t))dt+ νj

√yj(t)dZj(t), j = 0, 1, 2 (24)

The parameter vectors are βj = (κj , µj , νj , yj(0)) where all components are pos-itive deterministic constants. Zj is assumed to be standard Brownian motionthat are independent. One note is that the Feller condition 2κjµj > ν2

j thatprevent the CIR process for attending a zero value is not imposed. Instead aconstraint is imposed on the deterministic shift ψ that makes it strictly positiveand because the CIR process cannot become negative, the CIR++ process be-comes strictly positive and nonzero.We also define the following integrated quantities that will be used later

Λj(t) =

∫ t

0

λj(s)ds, Yj(t) =

∫ t

0

yj(s)ds, Ψj(t;βj) =

∫ t

0

ψj(s;βj)ds (25)

11

Page 17: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

3 Method

This section describes the method for the implementation. The first part ofthe implementation consists of constructing the hazard rate curve and the cor-responding survival probability curve. The second part of the implementationconsists of the calculation of the bilateral credit valuation adjustment for acredit default swap.

3.1 Construction of Hazard Rate and Survival ProbabilityCurve

The theory that the method in this section is based on comes from (O’Kaneand Turnbull, 2003). To be able to calculate the hazard rate curve, there are afew input parameters that are necessary. The first are the risk-free zero rates,that are used for discounting payments. The second parameter is the recoveryrate R and the third parameter is the market spreads S for a set of tenors. Themodel that is selected for the calculation of the hazard rates is the JPMorganmodel. This model assumes that the default occurs midway during the period.The accrued payment is made at the end of the period.

From the zero rates, the zero curve can be calculated by interpolating the zerorates and then calculate the discount factors that are needed.For the 4Y data, the quarterly discount factors are given so we just need todo a interpolation to obtain the monthly discount factors (because the modelcalculates the payment leg monthly). This interpolation is done linearly.

3.1.1 Premium Leg

Lets assume that there are n = 1, ..., N contractual payment dates t1, ..., tN ,where tN is the maturity date. The premium leg is defined in Equation (1) andby using the approximation given by (O’Kane and Turnbull, 2003), the premiumleg can be written as:

PremiumLeg(tV,S) ≈ S(tV , tn)

N∑n=1

P (TV , tn)αnQ(tV , tn)

+S(tV , tn)

2

N∑n=1

P (tV , tn)αn(Q(tV , tn−1)−Q(tV , tn))

=S(tV , tn)

2

N∑n=1

P (tV , tn)αn(Q(tV , tn−1) +Q(tV , tn))

(26)

where tV is the time of evaluation and accrued premium is assumed. S(tV , tn) isthe spread for the corresponding payment date tn Equation (26) is the expressionthat we are going to use for the calculation of the hazard rates and the survivalprobabilities.

3.1.2 Protection leg

The protection leg is defined in Equation (2) and by using the approximation in(O’Kane and Turnbull, 2003), we will get the following expression for calculation

12

Page 18: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

of the protection leg:

ProtecLeg(tV , R) ≈ (1−R)

M×tN∑m=1

P (tV , tm)(Q(tV , tm−1)−Q(tV , tm)) (27)

where M is a finite number of discrete points per year. This expression will beused for calculation of the hazard rates and the survival probabilities.

3.1.3 Bootstrapping hazard rate

The spread is assumed to be break even which implies that the payment leg isequal to the premium leg. By setting Equation (26) equal to Equation (27),rearranging some terms and rewrite the probabilities in terms of the hazardrates, we get the following expression under the assumptions that the CDS havequarterly payments and monthly discretization:

S(tv, tv + 1Y )

1−R∑

n=3,6,9,12

P (tv, tn)αne−λnτn + e−λnτn−3

2

=

12∑m=1

P (tv, tm)(e−λmτm−1 − e−λmτm)

(28)

where τn and τm are discretization factors:

τ0 = 0.0, τ1 = 0.0833, τ2 = 0.167, ..., τ12 = 1.00 (29)

The only unknown terms in Equation (28) is the hazard rate which can be solvedfor the first period by using a root finder such as Newton-Raphson. When thehazard rate for the first period is solved, this rate can be used for solving thehazard rate for the next period. The hazard rate for the first in combinationwith the hazard rate for the second period is then used for calculation of thehazard rate for the third period. This procedure is repeated until all hazardrates are solved. The procedure is called bootstrapping. The hazard rate isassumed to be constant over the periods and therefore piecewise constant overthe whole time period. Notice that larger intervals reduces the accuracy butdecreases the number of calculations needed.

13

Page 19: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Figure 4: Example of the piecewise constant hazard rate.

The calculated hazard rates can then be used to calculate the credit valuationadjustment for the CDS.

3.1.4 Survival probability

Given the piecewise constant hazard rates, the survival probabilities can thenbe calculated by:

Q(τ) =

exp(−λ0,0.5τ) if 0 < τ ≤ 0.5

exp(−0.5λ0,0.5 − λ0.5,1(τ − 0.5)) if 0.5 < τ ≤ 1

exp(−0.5λ0,0.5 − 0.5λ0.5,1 − λ1,3(τ − 1)) if 1 < τ ≤ 3

exp(−0.5λ0,0.5 − 0.5λ0.5,1 − 2λ1,3 − λ3,5(τ − 3)) if 3 < τ ≤ 5

(30)

3.2 CVA for CDS

The theory that this method is based on (Milwidsky, 2011) and (Brigo andCapponi, 2008). There are four main steps in the calculation of CVA for aCDS. Figure 5 shows the procedure for the calculation, step by step. The firststep is to calibrate the parameters that will be used in the simulation of theintensities. The second step is to simulate default times for all parts of thecontract. The next step is to valuate the CDS contract and the last step is tocalculate the CVA given the values of the contract in each scenario.

14

Page 20: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Figure 5: Flow chart of the calculation of CVA, (Milwidsky, 2011).

3.2.1 Calibration of CIR++ Process

The first step for calculation of the BCVA is to calibrate the CIR++ parame-ters to the market data. The deterministic function ψ is given by (Brigo andMercurio, 2006):

ψ(t, β) = λ(t)− fCIR(0, t) = fM (0, t)− fCIR(0, t) (31)

where fM (0, t) are the hazard rates that are obtained from the market calibra-tion and fCIR(0, t) is the instantaneous forward rate for the CIR process whichis given by:

fCIR(0, t) = 2κµeth − 1

2h+ (κ+ h)(eth − 1)+ y0

4h2eth

[2h+ (κ+ h)(eth − 1)]2(32)

whereh =

√κ2 + 2ν2 (33)

To obtain the CIR++ parameters, (µ, κ, y0, ν), we want to minimize∫ T

0ψ(s, β)2ds.

There are however some restrictions:

• All CIR++ parameters have to be positive.

• The integral Ψ(t, β) have to be positive.

• The integral Ψ(t, β) have to be increasing.

15

Page 21: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

3.2.2 CIR++ Simulation

When the CIR++ parameters are known, we can start simulating paths for theCIR++ process. (Brigo and Capponi, 2008) gives an expression for calculatingthe next value of the simulated path, y(t), that we are going to use, given theCIR++ parameters and the previous value, y(u):

y(t) =ν2(1− e−κ(t−u))

4κχ′2d

(4κe−κ(t−u)

ν2(1− e−κ(t−u))y(u)

)(34)

where

d =4κµ

ν2(35)

According to (Glasserman, 2003), we can rewrite the non-central chi distributionχ′2ν (λ) as:

χ′2ν (λ) = (Z +

√λ)2 + χ2

ν−1(λ) (36)

where Z ∼ N(0, 1) and χ2ν−1(λ) is the ordinary chi distribution. (Glasserman,

2003) also propose an algorithm for the simulation of the paths shown in Figure6.

Figure 6: The algorithm for simulating paths of the CIR process provided by(Glasserman, 2003).

Notice that according to Equation (23) that the shift ψ have to be added to thesimulated path of the CIR process to obtain the intensities.

16

Page 22: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

3.2.3 Conditional Survival Probability

(Capponi, 2009) defines the conditional survival probability in the unilateralcase as:

1τ1>τ2Q(τ1 > t|Fτ2) = 1A + 1τ2<t1τ1>τ2

∫ 1

U1

FΛ1(t)(−log(1− u1))dC1|2(u1;U2)

(37)and (Brigo and Capponi, 2008) defines the conditional survival probability inthe bilateral case for a counterpart default as:

1C∪D1τ1>τ2Q(τ1 > t|Fτ2) =

1τ2≤T1τ2≤τ0

(1A + 1τ2<t1τ1≥τ2

∫ 1

U1,2

FΛ1(t)−Λ1(τ2)(−log(1− u1)− Λ1(τ2))dC1|0,2(u1;U2)

)(38)

and for an investor default as:

1A∪B1τ1>τ0Q(τ1 > t|Fτ0) =

1τ0≤T1τ0≤τ2

(1B + 1τ0<t1τ1≥τ0

∫ 1

U1,0

FΛ1(t)−Λ1(τ0)(−log(1− u1)− Λ1(τ0))dC1|2,0(u1;U0)

)(39)

FΛi is the cumulative distribution function of the intensity process for part i,which is the CIR process plus the shift.The integral in Equation (38) can be approximated as:

Q(τ1 > Tk|Fτi , τ1 > τi) ≈∑j

pj+1 + pj2

∆fj (40)

In the unilateral case, the function fj can be written as:

fj = C1|2(uj , U2) (41)

In the bilateral case, in the case of a counterpart default, the function fj canbe written as:

fj = C1|0,2(uj , U2) (42)

and in the case of a investor default, fj can be written as:

fj = C1|2,0(uj , U0) (43)

The function pj is the cumulative distribution function of the intensity process.

3.2.4 Fractional Fast Fourier Transform

By using the inversion of the characteristic function of the integrated CIR pro-cess with a Fourier transform, the CDF of the integrated CIR process can becalculated as:

F (x) = P (X ≤ x) =2

π

∫ ∞0

Re(φ(u))sin(ux)

udu (44)

17

Page 23: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

where X is a non-negative random variable and X = Y1(τk) − Y1(τi). Onemethod for numerical calculation of the integral is the Trapezoidal rule whichis defined as: ∫ b

a

f(x)dx ≈ b− a2N

N−1∑j=0

(f(xj) + f(xj+1)) (45)

Because the integrand will die out to zero, we just need to make sure that theupper limit is large enough. By applying the Trapezoidal rule to Equation (44),the CDF can be calculated as:

2

π

∫ ∞0

Re(φ(u))sin(uxk)

udu ≈ 2

π

b− a2N

N−1∑j=0

Re(φ(uj))sin(ujxk)

ujδwj (46)

where the weights wj are:

w0 = 1, w1 = 2, w2 = 2, ..., wN−2 = 2, wN−1 = 1.

If we assume that the step size for x is λ, the CDF can be calculated from:

δ

π

N−1∑j=0

Re(φ(δj))sin(δjλk)

δjwj (47)

The characteristic function φ is defined as:

φ(u) =eκ

2µt/ν2

e2y0iu/(κ+γcoth(γt/2))

(cosh(γt/2) + κsin(γt/2)/γ)2κµ/ν2 (48)

where γ is:

γ =√κ2 − 2ν2iu (49)

There is a problem when we want to integrate this function. The integrand willhave discontinuities and these comes from the denominator of the characteristicfunction. By factor the eγt/2 term out of the denominator of Equation (48), thediscontinuity will disappear. The modified characteristic equation can then bewritten as:

φ(u) =e(κµt

ν2(κ−γ))e(

2y0iu

κ+γcoth(γt/2))

[ 12 (1 + κ

γ + e−γt(1− κγ ))]2κµ/ν2 (50)

The integral in Equation (44) have a lower limit of 0 which gives a problem.The integrand:

Re(φ(u))sin(ux)

u(51)

is undefined at u = 0 which comes from that sin(ux)u is undefined. This can

however be solved by applying L’Hopital’s rule to the equation. This will givethe equation:

limu→0+

sin(ux)

u= x (52)

and because the characteristic equation is 1 when u = 0, we have:

limu→0+

Re(φ(u))sin(ux)

u= x (53)

18

Page 24: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

3.2.5 Conditional Gaussian Copula Function

In the unilateral case the conditional copula function is given by:

C1|2(uj , U2) =Q(U1 < uj |U2)−Q(U1 < U1|U2)

1−Q(U1 < U1|U2)

=

∂C1,2(u1,u2)∂u2

∣∣∣u2=U2

− ∂C1,2(U1,u2)∂u2

∣∣∣u2=U2

1− ∂C1,2(U1,u2)∂u2

∣∣∣u2=U2

(54)

where the inputs are defined as:

U1 = 1− eΛ1(τ2) (55)

U2 = 1− eΛ2(τ2) (56)

uj = 1− e−xj−Y1(τ2)−Ψ1(Tk) (57)

In the bilateral case the conditional copula function is given as:

C1|0,2(uj , U2) =

∂C1,2(uj ,u2)∂u2

∣∣∣u2=U2

− ∂C(U0,2,uj ,u2)∂u2

∣∣∣u2=U2

−∂C1,2(U1,2,u2)∂u2

∣∣∣u2=U2

+∂C(U0,2,U1,2,u2)

∂u2

∣∣∣u2=U2

1− ∂C0,2(U0,2,u2)∂u2

∣∣∣u2=U2

− ∂C1,2(U1,2,u2)∂u2

∣∣∣u2=U2

+∂C(U0,2,U1,2,u2)

∂u2

∣∣∣u2=U2

(58)for a counterpart default and:

C1|2,0(uj , U0) =

∂C0,1(u0,uj)∂u0

∣∣∣u0=U0

− ∂C(u0,uj ,U2,0)∂u0

∣∣∣u0=U0

− ∂C0,1(u0,U1,0)∂u0

∣∣∣u0=U0

+∂C(u0,U1,0,U2,0)

∂u0

∣∣∣u0=U0

1− ∂C0,2(u0,U2,0)∂u0

∣∣∣u0=U0

− ∂C0,1(u0,U1,0)∂u0

∣∣∣u0=U0

+∂C(u0,U1,0,U2,0)

∂u0

∣∣∣u0=U0

(59)for a investor default.The inputs required are defined as:

U j,i = 1− eΛj(τi) (60)

Ui = 1− eΛi(τi) (61)

uj = 1− e−xj−Y1(τi)−Ψ1(Tk) (62)

The derivation of the conditional copulas can be found in Appendix.We assume that the correlation matrix is given by:

Σ =

1 ρ0,1 ρ0,2

ρ1,0 1 ρ1,2

ρ2,0 ρ2,1 1

=

σ11 σ12 σ13

σ21 σ22 σ23

σ31 σ32 σ33

19

Page 25: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

To be able to calculate the conditional copula function there are two differentsurvival probabilities that have to be calculated. The first term is:

Q(U1 < uj |U2) =∂C1,2(uj , u2)

∂u2

∣∣∣∣u2=U2

(63)

This can be calculated by using the univariate normal cumulative distributionfunction at the point Φ−1(uj). The mean and variance is given by:

µcond = ρΦ−1(U2)

and

varcond = (1− ρ2)

Φ−1 is the inverse of the the standard normal cumulative distribution functionand ρ is the correlation. In this example the correlation is between 1 and 2which represents the reference entity and the counterpart.

The second term is:

Q(U0 < u0, U1 < u1|U2) =∂C(u0, u1, u2)

∂u2

∣∣∣∣u2=U2

(64)

This can be calculated by using the bivariate normal cumulative distributionfunction with mean 0 and covariance matrix Σ at the point [Φ−1(u0),Φ−1(u1)].The conditional covariance Σ is defined as:

Σ = Σ11 − Σ12Σ−122 Σ21 (65)

For the calculation of Equation (64), the correlation parameters are given by:

Σ11 =

(σ11 σ12

σ21 σ22

),Σ12 =

(σ13

σ23

),Σ12 =

(σ31 σ32

),Σ22 = σ33

If we instead wants to calculate the probability of an investor default

Q(U1 < u1, U2 < u2|U0) =∂C(u0, u1, u2)

∂u0

∣∣∣∣u0=U0

(66)

the correlation parameters are given by:

Σ11 =

(σ22 σ23

σ32 σ33

),Σ12 =

(σ21

σ31

),Σ12 =

(σ12 σ13

),Σ22 = σ11

and the bivariate cumulative distribution function is evaluated at [Φ−1(u1),Φ−1(u2)]instead.

20

Page 26: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

4 Results

This section presents the results from the three different implementations ex-plained in the method. The first implementation consists of bootstrapping thepiecewise constant hazard rates from the given market spreads of a CDS andthen calculating the survival probabilities. The second implementation consistsof calculating the CVA for a CDS in the unilateral case, which means that onepart is seen as risk free. In the third and last implementation, the CVA for aCDS is calculated but in this case, all parts are considered default risky. 1

4.1 Survival Curve Construction from Market Spreads

The survival curve construction implementation was made on two different setsof market spreads. The data that was needed for the implementation is pre-sented in Appendix A.2 CDS Data. The results from the implementation con-sists of a hazard rate for every tenor and a corresponding survival probability.The hazard rates are assumed to be piecewise constant and a linear interpolatorwas used to obtain the discount curve and the survival probability curve.

The captions in Table 1 and Table 2 are the following:

• Tenor: Time until the CDS expires.

• Hazard: The hazard rates calculated from the market spreads.

• Implementation: The survival probabilities calculated from the hazardrates.

• Article: The survival probabilities given by the article.

• Matlab: The survival probabilities calculated in Matlab from the marketspreads and the zero curve.

• Error: The percentage error between the implemented survival probabil-ities and the survival probabilities given by the article.

The results from the first set of spreads are presented in Table 1.

Table 1: Results from implementation of the 4Y data.

Tenor Hazard Implementation Article Matlab Error6M 0.01665 0.99148 0.99150 0.99148 -0.002%1Y 0.02003 0.98149 0.98164 0.98150 -0.015%2Y 0.02171 0.96018 0.96030 0.96021 -0.012%3Y 0.02523 0.93594 0.93616 0.93602 -0.024%4Y 0.02897 0.90885 0.90924 0.90906 -0.043%

From Table 1 we can see that the survival probability decrease when the tenorincreases. We can also see that the error is small but increasing with the tenor.

1Note that the CVA values in this report are presented in basis points and not as a spread.

21

Page 27: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Figure 7 shows the resulting survival probability curve for the first set of marketspreads.

Figure 7: The survival probability curve for the 4Y data.

The results from the second set of spreads are presented in Table 2.

Table 2: Data 2

Tenor Hazard Implementation Article Matlab Error6M 0.01319 0.99316 0.99307 0.99307 0.009%1Y 0.01319 0.98661 0.98645 0.98644 0.017%3Y 0.02431 0.93980 0.93915 0.93910 0.069%5Y 0.04278 0.86274 0.86259 0.86259 0.017%7Y 0.04482 0.78867 0.78866 0.78868 0.001%10Y 0.04399 0.69108 0.69051 0.69054 0.082%

From Table 2 we can see that there are more and larger tenors in this case.The survival probabilities are decreasing when the tenors are increasing. Thetrend of the error is the same as in the previous implementation but with afew exceptions. Figure 8 shows the resulting survival probability curve for thesecond set of market spreads.

22

Page 28: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Figure 8: The survival probability curve for the 10Y data.

4.2 Unilateral CVA

In this section, the behavior of the unilateral CVA for a 5 year CDS with quar-terly payments is presented. The results come from simulations and by averagingthe replacement costs, which is the values of the contract at default, of 10 000scenarios. The CIR++ parameters that have been used is presented in Table 12in Appendix A.3. Notice that these parameters are given by (Milwidsky, 2012)and are not calibrated from market data in this implementation. Three differentcases are considered where the level of riskiness is altered for the counterpartand the reference entity. In every case, the reference entity volatility (ν1) andthe correlation (ρ) is varied to find the behavior of the CVA2. The volatility forthe counterpart (ν2) is assumed to be 0.1 for every case and the LGD for everypart is assumed to be 75%.

In the first case, the reference entity is assumed to be at low risk and thecounterpart at high risk. In Figure 9, the behavior of the unilateral CVA valuesare shown.Figure 9 shows that the CVA for the long position increases when the correla-tion increases. This is expected because the long position, which is from thebuyer side of the protection, the protection becomes more valuable. The priceof a similar protection becomes more expensive after a default of the counter-part. When the correlation is negative, if the counterpart defaults, the referenceentity is most likely to survive at least until maturity but if the correlation ispositive, the reference is most likely do default as well.For the short position, the seller side of the contract, the CVA increases fornegative correlations. This is expected as well because value of the protectionincreases for the seller when the default risk of the reference entity decreases.

2Notice that the volatility parameter (ν1) from (Milwidsky, 2012) is not used. Instead area few arbitrary values used.

23

Page 29: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

-1 -0.5 0 0.5 1

correlation

0

100

200

300

400

500

600

CV

A (

bp

)

Short position, v1 = 0.05

Short position, v1 = 0.3

Short position, v1 = 0.6

Long position, v1 = 0.05

Long position, v1 = 0.3

Long position, v1 = 0.6

Figure 9: Reference entity: low risk, counterpart: high risk.

In the second scenario,the reference entity is assumed to be at medium risk andthe counterpart at low risk. In Figure 10, the behavior of the unilateral CVAvalues are shown.

-1 -0.5 0 0.5 1

correlation

0

20

40

60

80

100

120

140

160

180

200

CV

A (

bp

)

Short position, v1 = 0.05

Short position, v1 = 0.3

Short position, v1 = 0.6

Long position, v1 = 0.05

Long position, v1 = 0.3

Long position, v1 = 0.6

Figure 10: Reference entity: medium risk, counterpart: low risk.

Figure 10 shows the same behavior as in the previous case but for low hazard ratevolatilities on for the reference entity (ν1), the long position tends to decreasefor high positive correlations. This happens because the counterpart has a lowerlevel of risk than the reference entity. Because of this, the default time of the

24

Page 30: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

reference entity will occur before the counterpart more often and therefore, theCVA value will be lower. When the volatility is higher, this will happen lessoften and there will be no decrease in CVA when the correlation increases.In the third scenario, the reference entity is assumed to be at high risk and thecounterpart at low risk. In Figure 11, the behavior of the unilateral CVA valuesare shown.

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

correlation

0

10

20

30

40

50

60

70

80

90

100

CV

A (

bp

)

Short position, v1 = 0.05

Short position, v1 = 0.3

Short position, v1 = 0.6

Long position, v1 = 0.05

Long position, v1 = 0.3

Long position, v1 = 0.6

Figure 11: Reference entity: high risk, counterpart: low risk.

Figure 11 shows that for higher positive correlations, the long position decreases.The explanation for this is the same as in the previous case, but in this case,the reference entity is a lot more risky than the counterpart. For very highcorrelations and low hazard rate volatility, the reference entity always defaultsbefore the counterpart which will give a zero CVA value. For higher volatilities,the CVA value will increase but there will still be a decrease in the CVA valuesfor high positive correlations.

25

Page 31: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

4.3 Bilateral CVA

In this section the bilateral CVA for the 5 year CDS with quarterly paymentsis presented. The formula for the bilateral CVA is given by Equation (16) andcan be seen as:

BCVA(t) = CCVA−DVA

where CCVA is the part of the CVA that comes from the counterpart risk andDVA is the part that comes from the investor risk. The results are obtained byaveraging the replacement costs of 10 000 simulated scenarios. Five differentcases are considered where the level of riskiness on the three parts of the CDScontract are altered. For every case, the correlations between the three partsare varied to visualize the behavior of the BCVA. The hazard rate volatilities(νi) for all parts are held constant at 0.1 and the LGD is assumed to be 75%for all parts.In the first case, the level of riskiness is assumed to be medium for all three parts.The correlation between the investor and the counterpart is held constant at 0.Table 3 shows the BCVA values for a short and long position and for differentcombinations of correlations.

Table 3: Investor, reference entity and counterpart: medium risk, ρ0,2 = 0.

Short positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 54 33 1 0 0-0.3 56 33 1 0 00 44 28 -6 -6 -4

0.3 -7 -29 -60 -61 -590.6 -87 -99 -137 -137 -138

Long positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 -57 -56 -46 10 92-0.3 -32 -34 -26 26 1040 -1 -1 6 57 130

0.3 0 0 6 60 1360.6 0 0 4 58 138

Let us take a look at the short position. For a given correlation between theinvestor and the reference entity, (ρ0,1), we can see that the BCVA decreaseswhen the correlation between the counterpart and the reference entity increases.This is the same trend that was observed in the unilateral case. For the longposition, the BCVA increases when the correlation between the counterpart andthe reference entity increases. Again, the results shows the same trend as in theunilateral case.In the unilateral case, the CVA values can never be negative. However, thisis not the case in the bilateral case. Because the BCVA is the risk of thecounterpart minus the risk of the investor, the BCVA value will be negative ifthe investor is considered more risky.

26

Page 32: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 4: Investor and reference entity: medium risk, counterpart: low risk,ρ0,2 = 0.

Short positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 36 23 1 0 0-0.3 36 24 1 0 00 29 15 -7 -6 -5

0.3 -28 -44 -62 -58 -640.6 -111 -113 -142 -138 -148

Long positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 -57 -63 -53 -11 34-0.3 -36 -32 -29 8 550 -2 -2 3 43 86

0.3 0 0 4 42 920.6 0 0 3 39 94

In the second case, the level of riskiness of the counterpart is lowered frommedium to low. Table 4 shows the BCVA values for the second case. For theshort position, this will have the effect that the CCVA value will be reducedwhile the DVA is unchanged compared to the first case. The CCVA is highestfor the left side of the table which explains why the BCVA values decreases inquadrant 2 and 3 while the BCVA values are almost unchanged in quadrant 1and 4.For the long position, the BCVA values are lowered in quadrant 1 and 4 andalmost unchanged in quadrant 2 and 3.

Table 5: Investor and counterpart: medium risk, reference entity: low risk,ρ0,2 = 0.

Short positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 36 22 0 0 0-0.3 36 22 0 0 00 29 14 -6 -6 -4

0.3 -17 -30 -49 -45 -460.6 -87 -89 -112 -121 -129

Long positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 -35 -36 -27 20 88-0.3 -22 -21 -15 29 990 0 0 6 49 112

0.3 0 0 6 51 1180.6 0 0 3 43 120

In the third case, the risk level of the reference entity is lowered from medium

27

Page 33: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

to low and the risk level of the counterpart is raised back to medium from low.Table 5 shows the BCVA values for the third case. For the short position,the effects compared to the first case are that the BCVA values in the secondquadrant will be lower while the BCVA values in the fourth quadrant will behigher. The reason for this is that when the reference entity will be safer, boththe CCVA and the DVA will be reduced. In quadrant 2, the CCVA has largereffects than the DVA which leads to a larger BCVA value while in the fourthquadrant, the DVA has larger effects than the CCVA so the BCVA will be lower.For the long position, the BCVA values in quadrant 2 are larger while the valuesin quadrant 4 are lower.

Table 6: Investor, reference entity and counterpart: medium risk, ρ0,2 = −0.6.

Short positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 2 0 0-0.3 36 2 0 00 51 28 -7 -8 -8

0.3 -1 -29 -68 -650.6 -83 -104 -147

Long positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 -50 5 84-0.3 -36 -29 32 1140 -2 -2 6 60 147

0.3 0 0 8 610.6 -9 0 8

In the fourth case, the only difference from case one is that the correlationbetween the investor and the counterpart is changed from 0 to −0.6. Table 6shows the BCVA values for the fourth case. If we compare the results in thefourth case with the first case, the differences are small and no clear trend canbe seen.

28

Page 34: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 7: Investor, reference entity and counterpart: medium risk:, ρ0,2 = 0.6.

Short positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 45 26 0-0.3 50 26 0 00 33 17 -5 -2 0

0.3 -27 -54 -50 -390.6 -124 -120 -117

Long positionρ0,1/ρ1,2 -0.6 -0.3 0 0.3 0.6

-0.6 -51 -50 -36-0.3 -23 -28 -21 350 0 0 5 54 108

0.3 0 2 49 1020.6 0 37 109

In the fifth and last case, the correlation in case four between the investor andthe counterpart is changed to 0.6. Table 7 shows the BCVA values for the fifthcase. For the short position, the BCVA values are larger in quadrant 2 andlower in quadrant 4. For the long position, quadrant 2 have lower values andquadrant 4 have larger.

29

Page 35: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

5 Discussion

In this section, the results will be discussed together with possible improvementsin future work.

5.1 Survival Curve Construction from Market Spreads

When the survival curve construction was implemented, the results differed alittle from the values in the articles and also with the Matlab implementation.The most probable reason for this is the interpolation method that was used toobtain the discount curve. Matlab uses a cubic spline method while I have useda linear interpolator. None of the articles have mentioned what method thathave been used but the conclusion from the results tells that they have beenused the same as Matlab in the second case and a different method from bothme and Matlab in the first case.Linear interpolation is not the best for curve interpolation but in this case it wasgood enough. The reason for the increasing errors for larger tenors is probablyalso depending of the interpolation method. The interval gets larger and thenthere will be larger differences between a linear and a cubic spline interpolationfor example as long as the true curve is not linear.

5.2 Unilateral and Bilateral CVA

One important detail to mention is that the CVA value in this thesis is presentedas a stand-alone value in basis points instead of a spread as in (Milwidsky, 2012).To convert the calculated CVA value to a spread, it has to be divided by a riskyannuity that depends on the time of maturity and the exposure of the contract.The risky annuity represents the value of receiving a unit amount in each periodas long as the counterparty does not default, (Gregory, 2012). Observe that thisis an approximation.If the CVA calculations are performed on a portfolio with several different CDSor even other types of contracts, it is necessary to express the CVA as a spread.If all risk values are given as spreads, the portfolio can be valued as a portfolioand not just contract by contract. However in this thesis, the behavior of theCVA for a CDS is investigated and therefore the result can be expressed as anstand-alone value.

When comparing the results with the article, (Milwidsky, 2012), the behav-ior is the same in both the unilateral and bilateral case. As mentioned, thevalues differs but the factor that differs is almost the same in all simulation. Wecan also see that the wrong way risk is captured by the model. In the unilateralcase, when the correlation increases towards 1, the CVA for the long positionincreases and the same when the correlation decreases towards −1 short posi-tion. In the bilateral case, the behavior is the same as in the unilateral case andhence the wrong way risk is captured. Notice also that changing the correla-tion between the investor and the counterpart have much smaller effects on theBCVA values than the correlations with the reference entity have. Only with apositive correlation, the BCVA values differs significantly.

30

Page 36: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

5.3 Future Work

5.3.1 Adjoint Algorithmic Differentiation.

CVA is usually calculated through Monte Carlo simulations but because so manyscenarios are simulated, this requires a lot of computational power. Recently anew tool to speed up the calculation of CVA was developed. Adjoint algorithmicdifferentiation (AAD) is a powerful technique that allows the user to computethe CVA closer to real time. The AAD method shows a lot of promise and isexplained in more detail by (Henrard, 2011). A next step in calculating theCVA could be to implement the AAD to speed up the simulations.

5.3.2 Interest Rate Swaps

The most traded type of derivative on the OTC market is the interest rate swap(IRS). An IRS is an agreement, usually between two companies that agrees toexchange interest rate cash flow, which is based on a specified notional amountfrom either a fixed or a floating interest rate. IRS are explained in more detailby (Hull and White, 2000).

5.3.3 Collateralized CVA

The CVA is driven by three parts. The loss given default, the probabilityof default and the exposure of the contract at default. (Brigo, Capponi, andPallavicini, 2012) presents a study of how the counterparty risk exposure canbe reduced by using collateral. The model for calculation of the CVA could beextended in some future work to include collateral.

5.3.4 Calibration of Intensity Process Parameters

One major step in the calculation of the CVA value is the simulation of the in-tensities for every company. These intensities are simulated by using a CIR++process. The parameters of the process have to be calibrated to the term struc-ture of the CDS. The CIR++ parameters are obtained by minimizing the dif-ferences between the hazard rate curve and the forward rate of the CIR process,(Milwidsky, 2011). This is not a trivial problem to solve because the functionto minimize depends of four parameters.

31

Page 37: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

References

[1] Beinstein, E. and Scott, A. 2006. Credit Derivatives Handbook - Detailingcredit default swap products, markets and trading strategies. CorporateQuantitative Research. [Online]. Available at:http://www.acting-man.com/blog/media/2011/12/JPM-Credit-Derivatives.pdf [Accessed 15 Sep. 2016].

[2] Brigo, D. and Capponi, A. 2009. Bilateral counterparty riskvaluation with stochastic dynamical models and application toCredit Default Swaps. Working paper. [Online]. Available at:https://arxiv.org/pdf/0812.3705.pdf [Accessed 12 Sep. 2016].

[3] Brigo, D., Capponi, A. and Pallavicini, A. (2012). Arbitrage-Free Bilateral Counterparty Risk Valuation under Collateralizationand Application to Credit Default Swaps. Working paper. [Online].http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.397.6552&rep=rep1&type=pdf [Accessed 29 Nov. 2016].

[4] Brigo, D. and Mercurio, F. 2006. Interest Rate Models: Theory and Practice- with Smile, Inflation and Credit. 2nd ed, Berlin: Springer-Verlag.

[5] Capponi, A. 2009. Credit Risk and Nonlinear Filtering: ComputationalAspects and Empirical Evidence. PhD., California Institute of Technology.

[6] Cojocaru, I.G. and Militaru, I.A. 2014. Credit Valuation Adjustment Mod-eling for Credit Default Swaps with Affine Jump Diffusions. MSc., AarhusUniversity.

[7] Glasserman, P. (2003). Monte Carlo Methods in Financial Engineering.New York: Springer-Verlag.

[8] Gregory, J. 2012. Counterparty Credit Risk and Credit Value Adjustment- A Continuing Challenge for Global Financial Markets. 2nd ed, Croydon:John Wiley & Sons Ltd.

[9] Henrard, M. (2011). Adjoint Algorithmic Differentiation: Calibrationand Implicit Function Theorem. OpenGamma Quantitative Research n.1.[Online]. Available at:http://www.opengamma.com/sites/default/files/adjoint-algorithmic-differentiation-opengamma1.pdf [Accessed 4 Nov. 2016].

[10] Hoffman, F. (2011). Credit Valuation Adjustment. MSc., University of Ox-ford.

[11] Hull, J., and White, A. 2000. Valuing Credit Default Swaps I: NoCounterparty Default Risk. Working paper. [Online]. Available at:https://www.researchgate.net/publication/2355505 Valuing Credit DefaultSwaps I No Counterparty Default Risk [Accessed 4 Nov. 2016].

[12] Milwidsky, C. 2011. Credit valuation adjustments with application to creditdefault swaps. MSc., University of Pretoria.

[13] Mosegard Svendsen, N. 2014. Counterparty Credit Risk - Credit Value Ad-justment and Wrong-Way Risk. MSc., University of Copenhagen.

32

Page 38: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

[14] Norman, L. and Chen, G. 2013. CVA for Interest Rate Swaps in a CIR-framework. MSc., University of Gothenburg.

[15] O’Kane, D. and Turnbull, S. 2003. Valuation of Credit Default Swaps.Finance and Stochastics 8(3). [Online]. Available at:https://www.researchgate.net/publication/228872070 Valuation of creditdefault swaps [Accessed 13 Sep. 2016].

[16] Rodriguez, G. (2010). Chapter 7 Survival Models. Princeton University.Available at:http://data.princeton.edu/wws509/notes/c7.pdf [Accessed 25 Sep. 2016].

[17] Schonbucher, P.j. (2003). Credit Derivatives Pricing Models - Models, Pric-ing and Implementation. West Sussex: Wiley.

[18] White, R. (2014). The Pricing and Risk Management of Credit DefaultSwaps, with a Focus on the ISDA Model. OpenGamma QuantitativeResearch n.16. [Online]. Available at:http://www.opengamma.com/sites/default/files/pricing-and-risk-management-credit-default-swaps-opengamma.pdf [Accessed 25 Sep.2016].

[19] Pykhtin, M. and Zhu, S. (2007). A guide to modeling counterparty creditrisk. GARP Risk Review, July/August:16–22.

33

Page 39: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

A Appendix

A.1 Derivation of Conditional Copula

The conditional copula given a counterpart default is defined and derived as:

C1|0,2(uj , U2) = Q(U1 < uj |U2, U1 > U1,2, U0 > U0,2) =

Q(U1 < uj , U1 > U1,2|U2, U0 > U0,2)

Q(U1 > U1,2|U2, U0 > U0,2)

(67)

Numerator = Q(U1 < uj , U1 > U1,2|U2, U0 > U0,2) =

Q(U1 < uj , U1 > U1,2, U0 > U0,2|U2)

Q(U0 > U0,2|U2)=

Q(U1 < uj , U0 > U0,2|U2)−Q(U1 < U1,2, U0 > U0,2|U2)

Q(U0 > U0,2|U2)=

Q(U1 < uj |U2)−Q(U1 < uj , U0 < U0,2|U2)

Q(U0 > U0,2|U2)−

Q(U1 < U1,2|U2)−Q(U1 < U1,2, U0 < U0,2|U2)

Q(U0 > U0,2|U2)

∂C1,2(uj ,u2)∂u2

∣∣∣u2=U2

− ∂C(U0,2,uj ,u2)∂u2

∣∣∣u2=U2

− ∂C1,2(U1,2,u2)∂u2

∣∣∣u2=U2

+∂C(U0,2,U1,2,u2)

∂u2

∣∣∣u2=U2

Q(U0 > U0,2|U2)(68)

Denominator = Q(U1 < uj , U1 > U1,2|U2, U0 > U0,2) =

Q(U1 < uj , U1 > U1,2, U0 > U0,2|U2)

Q(U0 > U0,2|U2)=

Q(U1 > U1,2, U0 > U0,2|U2)

Q(U0 > U0,2|U2)=

1−Q(U0 < U0,2|U2)−Q(U1 < U1,2|U2) +Q(U0 < U0,2, U1 < U1,2|U2)

Q(U0 > U0,2|U2)=

1− ∂C0,2(U0,2,u2)∂u2

∣∣∣u2=U2

− ∂C1,2(U1,2,u2)∂u2

∣∣∣u2=U2

+∂C(U0,2,U1,2,u2)

∂u2

∣∣∣u2=U2

Q(U0 > U0,2|U2)(69)

Notice that the denominator in both terms are equal so we can write the copulaas:

C1|0,2(uj , U2) =

∂C1,2(uj ,u2)∂u2

∣∣∣u2=U2

− ∂C(U0,2,uj ,u2)∂u2

∣∣∣u2=U2

−∂C1,2(U1,2,u2)∂u2

∣∣∣u2=U2

+∂C(U0,2,U1,2,u2)

∂u2

∣∣∣u2=U2

1− ∂C0,2(U0,2,u2)∂u2

∣∣∣u2=U2

− ∂C1,2(U1,2,u2)∂u2

∣∣∣u2=U2

+∂C(U0,2,U1,2,u2)

∂u2

∣∣∣u2=U2

(70)

34

Page 40: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

The derivation for a investor default is similar and can be written as:

C1|2,0(uj , U0) =

∂C0,1(u0,uj)∂u0

∣∣∣u0=U0

− ∂C(u0,uj ,U2,0)∂u0

∣∣∣u0=U0

− ∂C0,1(u0,U1,0)∂u0

∣∣∣u0=U0

+∂C(u0,U1,0,U2,0)

∂u0

∣∣∣u0=U0

1− ∂C0,2(u0,U2,0)∂u0

∣∣∣u0=U0

− ∂C0,1(u0,U1,0)∂u0

∣∣∣u0=U0

+∂C(u0,U1,0,U2,0)

∂u0

∣∣∣u0=U0

(71)

A.2 CDS Input Data

The first data set is the 4Y data which comes from (O’Kane and Turnbull,2003). The recovery rate is 0.4, there are quarterly payments, the day countconvention is ACT/360 and the valuation date is 19 June 2003. Table 8 presentsthe data that is needed for calculation of the hazard rate.

Table 8: Data from (O’Kane and Turnbull, 2003).

Tenor Maturity Spread (bps) Day count Year fraction Zero Rates (%)6M 22 Dec 2003 100 185 0.5139 1.351Y 21 Jun 2004 110 367 1.0194 1.432Y 20 Jun 2005 120 731 2.0306 1.903Y 20 Jun 2006 130 1096 3.0444 2.474Y 20 Jun 2007 140 1461 4.0583 2.9365Y 20 Jun 2008 150 1827 5.0750 3.311

The second data set is the 10Y data which comes from (White, 2014). Therecovery rate is 0.4, there are quarterly payments, the day count convention isACT/365 and the valuation date is 13 June 2011. Table 9 presents the datafrom the article.

Table 9: Data from (White, 2014).

Tenor Maturity Spread (bps) Day count Year fraction Zero Rates (%)6M 20 Dec 2011 79.27 190 0.521 1.7781Y 20 Jun 2012 79.27 373 1.022 2.0823Y 20 Jun 2014 122.39 1103 3.022 1.9985Y 20 Jun 2016 169.79 1833 5.025 2.5127Y 20 Jun 2018 192.71 2564 7.025 2.82210Y 20 Jun 2021 208.60 3660 10.027 3.104

The discount factors that will be interpolated to obtain the monthly discountfactors are presented in Table 10 for the 4Y data and in Table 11 for the 10Ydata.

35

Page 41: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 10: Discount factors and day counter for the 4Y data.

Tenor Discount factor Day count3M 0.99649 946M 0.99311 1859M 0.98953 2761Y 0.98583 3671Y3M 0.98084 4581Y6M 0.97523 5491Y9M 0.96899 6402Y 0.96218 7312Y3M 0.95450 8232Y6M 0.94630 9142Y9M 0.93754 10043Y 0.92800 10963Y3M 0.91879 11883Y6M 0.90931 12793Y9M 0.89946 13694Y 0.88899 1461

Table 11: Discount factors and day counter for the 10Y data.

Tenor Discount factor Day count6M 0.9908 1901Y 0.9790 3733Y 0.9117 11035Y 0.8513 18337Y 0.7916 256410Y 0.7334 3660

36

Page 42: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

A.3 CVA Input Parameters

In the calculation of the both the unilateral and bilateral CVA, there are someimportant parameters that are necessary. The CIR++ parameters are presentedin Table 12.

Table 12: CIR++ parameters for the different levels of riskiness.

Parameter Low Med Highκ 0.500 0.500 0.500µ 0.026 0.039 0.080ν 0.050 0.050 0.055y0 0.001 0.014 0.054

The market spreads for the CDS and the corresponding hazard rates are pre-sented in Table 13.

Table 13: Market spreads and hazard rates for different maturities and level ofriskiness.

Tenor Spread(bp) Hazard RateLow Med High Low Med High

1 81 181 481 0.011 0.024 0.0642 109 209 509 0.026 0.032 0.0803 130 230 530 0.020 0.037 0.0744 144 244 544 0.030 0.039 0.0855 155 255 555 0.024 0.041 0.078

A.4 Unilateral CVA Simulation Results

Table 14 shows the results from the simulation of the CVA for a CDS withquarterly payments for different times of maturity compared to the values from(Milwidsky,2011). The reason for the difference in the results is because theresults from the article are presented as a spread while the calculated values arepresented as a stand-alone value, (Gregory, 2012).

37

Page 43: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 14: Reference entity: medium risk, counterpart: low risk

Short position Long positiontenor Article Calculated Article Calculatedρ 1 2 5 1 2 5 1 2 5 1 2 5

-0.99 1 3 8 0.4 3.6 43.4 0 0 0 0 0 0-0.9 1 3 8 0.5 3.4 43.9 0 0 0 0 0 0-0.7 1 3 8 0.5 3.5 41.0 0 0 0 0 0 0-0.5 1 3 7 0.5 3.6 35.1 0 0 0 0 0 0-0.3 1 2 5 0.5 3.0 26.7 0 0 0 0 0 0-0.1 0 1 2 0.2 1.2 8.1 0 0 0 0 0 1.50 0 0 0 0 0.1 1.2 0 1 1 0 0.4 5.5

0.1 0 0 0 0 0 0.2 1 2 3 0.4 5.5 17.30.3 0 0 0 0 0 0 2 6 9 1.9 8.2 47.00.5 0 0 0 0 0 0 5 11 15 3.4 15.6 83.80.7 0 0 0 0 0 0 9 17 21 8.3 25.7 120.90.9 0 0 0 0 0 0 11 18 24 11.2 32.5 139.50.99 0 0 0 0 0 0 2 6 11 2.0 16.1 81.7

The results from the simulations of the unilateral CVA is presented in Table 15to Table 17. The CVA values for the short position are presented in regular styleand the long position in bold for different combinations of correlation, hazardrate volatilities and level of riskiness of the counterpart and the reference entity.

Table 15: Reference entity: low risk, counterpart: high risk.

ρ/v1 0.05 0.3 0.6-0.99 84.3 90.2 88.3

0.0 0.0 1.9-0.7 84.2 83.5 82.9

0.0 1.6 3.6-0.3 43.5 45.3 30.9

0.3 6.2 7.20 0.2 5.4 2.9

15.1 25.9 51.30.3 0.0 2.0 1.3

93.1 97.0 147.10.7 0.0 1.7 1.4

274.8 255.2 318.60.99 21.5 17.5 17.2

525.2 476.3 516.2

38

Page 44: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 16: Reference entity: medium risk, counterpart: low risk.

ρ/v1 0.05 0.3 0.6-0.99 41.8 43.9 44.4

0.0 0.0 0.0-0.7 45.7 41.8 41.0

0.0 0.1 0.8-0.3 25.9 26.1 27.9

0.0 1.6 3.20 0.2 6.5 9.2

4.7 8.1 7.10.3 0.0 0.4 1.0

46.7 41.1 35.20.7 0.0 0.0 0.0

122.1 102.5 98.40.99 0.0 0.2 1.2

78.1 140.7 185.7

Table 17: Reference entity: high risk, counterpart: low risk.

ρ/v1 0.05 0.3 0.6-0.99 91.8 97.0 87.2

0.0 0.0 0.5-0.7 84.1 81.8 80.7

0.0 0.1 1.0-0.3 44.4 47.6 55.7

0.0 2.1 3.60 0.7 13.0 23.0

5.3 10.6 11.10.3 0.2 1.4 4.7

51.1 44.0 31.50.7 0.0 0.0 0.4

98.7 91.9 74.60.99 0.0 0.0 0.2

0.0 22.6 62.9

39

Page 45: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

A.5 Simulation Verification Results

The tables in this section shows the results from comparison of the defaultratio and the average default times for the implementation in Java with theimplementation in Matlab from (Milwidsky, 2011). The results from the Javaimplementation is shown without parentheses and the implementation in Matlabis shown inside parentheses.

A.5.1 Risk Free Investor

The average default time in this section is the average default time for thecounterpart given that the reference entity haven’t yet defaulted. The defaultratio is the number of early defaults for the counterpart given that the referenceentity haven’t yet defaulted per number of simulations. The volatility and theriskiness of the counterpart and the reference entity is varied. ν2 = 0.1.

Table 18: Reference entity: low risk, counterpart: high risk, ν1 = 0.05.

ρ Default ratio Average default time-0.9 0.3199 2.4298

(0.3200) (2.4623)-0.4 0.3175 2.4431

(0.3133) (2.4552)0 0.3038 2.4221

(0.3037) (2.4057)0.4 0.2936 2.4259

(0.2927) (2.4682)0.9 0.3068 2.4454

(0.3106) (2.4675)

Table 19: Reference entity: medium risk, counterpart: high risk, ν1 = 0.05.

ρ Default ratio Average default time-0.9 0.3108 2.4673

(0.3110) (2.4655)-0.4 0.3081 2.4296

(0.3116) (2.4186)0 0.2905 2.3924

(0.2881) (2.4025)0.4 0.2823 2.4067

(0.2883) (2.3733)0.9 0.2878 2.4817

(0.2850) (2.5002)

40

Page 46: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 20: Reference entity: medium risk, counterpart: low risk, ν1 = 0.05.

ρ Default ratio Average default time-0.9 0.1029 2.7432

(0.1101) (2.7517)-0.4 0.1015 2.7125

(0.1050) (2.7253)0 0.0968 2.6858

(0.0935) (2.7088)0.4 0.0853 2.6505

(0.0837) (2.7355)0.9 0.0473 2.7525

(0.0457) (2.6278)

Table 21: Reference entity: high risk, counterpart: low risk, ν1 = 0.055.

ρ Default ratio Average default time-0.9 0.1044 2.7337

(0.1016) (2.7027)-0.4 0.1002 2.7198

(0.1067) (2.6453)0 0.0858 2.5869

(0.0866) (2.6364)0.4 0.0673 2.5157

(0.0672) (2.5274)0.9 0.0121 2.5149

(0.0106) (2.4953)

Table 22: Reference entity: low risk, counterpart: high risk, ν1 = 0.7.

ρ Default ratio Average default time-0.9 0.3235 2.4462

(0.3186) (2.4425)-0.4 0.3028 2.4450

(0.3128) (2.4074)0 0.3077 2.4582

(0.2970) (2.4105)0.4 0.2974 2.3846

(0.2986) (2.4352)0.9 0.3079 2.4321

(0.3021) (2.4352)

41

Page 47: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 23: Reference entity: medium risk, counterpart: high risk, ν1 = 0.07.

ρ Default ratio Average default time-0.9 0.3103 2.4592

(0.3112) (2.4172)-0.4 0.3070 2.4435

(0.3100) (2.3988)0 0.2978 2.4363

(0.2985) (2.3955)0.4 0.2873 2.4008

(0.2881) (2.4127)0.9 0.2855 2.4205

(0.2817) (2.4031)

Table 24: Reference entity: medium risk, counterpart: low risk, ν1 = 0.7.

ρ Default ratio Average default time-0.9 0.1020 2.7605

(0.1044) (2.7071)-0.4 0.1043 2.7163

(0.0985) (2.6830)0 0.0975 2.7222

(0.0988) (2.6239)0.4 0.0856 2.6353

(0.0868) (2.7826)0.9 0.0704 2.8016

(0.0699) (2.7832)

Table 25: Reference entity: high risk, counterpart: low risk, ν1 = 0.7.

ρ Default ratio Average default time-0.9 0.1047 2.7537

(0.1017) (2.7472)-0.4 0.0998 2.7474

(0.0987) (2.7456)0 0.0875 2.6415

(0.0908) (2.6836)0.4 0.0746 2.6784

(0.0713) (2.6649)0.9 0.0381 2.8379

(0.0392) (2.6977)

42

Page 48: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

A.5.2 All Parts Risky

The default ratios in this section is for counterpart/investor. The default ratiois the number of defaults for the counterpart/investor given that the referenceentity haven’t yet defaulted and that the default of the counterpart/investor isthe earliest default. The average default time is the average time of default forthe counterpart/investor given that the reference entity haven’t yet defaultedand that the default time for the counterpart/investor is the earliest time ofdefault per number of earliest default times. The volatility, correlation and theriskiness is varied.

Table 26: Investor, reference entity and counterpart: medium risk, ρ02 = 0.

ρ01/ρ12 Default ratio Average default time-0.5/-0.5 0.1424/0.1434 2.6284/2.5902

(0.1400/0.1392) (2.5960/2.5836)-0.5/0 0.1342/0.1427 2.5763/2.6727

(0.1357/0.1446) (2.5296/2.5495)-0.5/0.5 0.1175/0.1397 2.4366/2.5682

(0.1105/0.1428) (2.5390/2.6272)0/-0.5 0.1466/0.1355 2.5777/2.5738

(0.1442/0.1317) (2.5907/2.5776)0/0 0.1408/0.1377 2.5323/2.5440

(0.1391/0.1353) (2.5468/2.5116)0/0.5 0.1147/0.1368 2.5221/2.4940

(0.1165/0.1296) (2.4921/2.4848)0.5/-0.5 0.1446/0.1149 2.5990/2.5031

(0.1382/0.1120) (2.6344/2.4576)0.5/0 0.1435/0.1234 2.5738/2.5353

(0.1307/0.1137) (2.5670/2.5060)0.5/0.5 0.1162/0.1225 2.6413/2.5885

(0.1191/0.1208) (2.4777/2.5297)

43

Page 49: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 27: Investor: low risk, reference entity and counterpart: medium risk,ρ02 = 0.

ρ01/ρ12 Default ratio Average default time-0.5/-0.5 0.1508/0.0954 2.5715/2.7346

(0.1461/0.0906) (2.5517/2.6778)-0.5/0 0.1386/0.0911 2.5542/2.6512

(0.1426/0.0976) (2.5363/2.6608)-0.5/0.5 0.1157/0.0966 2.5402/2.6969

(0.1116/0.0940) (2.5332/2.6073)0/-0.5 0.1428/0.0885 2.6208/2.5458

(0.1449/0.0880) (2.5674/2.5268)0/0 0.1434/0.0855 2.6488/2.7019

(0.1350/0.0851) (2.5595/2.6226)0/0.5 0.1203/0.0892 2.5714/2.5991

(0.1237/0.0826) (2.5429/2.6451)0.5/-0.5 0.1437/0.0726 2.6103/2.5611

(0.1515/0.0687) (2.6293/2.5337)0.5/0 0.1391/0.0726 2.5715/2.5853

(0.1394/0.0707) (2.5813/2.5346)0.5/0.5 0.1253/0.0767 2.5711/2.5868

(0.1208/0.0768) (2.6072/2.5728)

Table 28: Investor and reference entity: medium risk, counterpart: low risk,ρ02 = 0.

ρ01/ρ12 Default ratio Average default time-0.5/-0.5 0.0959/0.1430 2.6881/2.6390

(0.0940/0.1459) (2.6520/2.5661)-0.5/0 0.0906/0.1466 2.5545/2.6414

(0.0847/0.1479) (2.5692/2.6186)-0.5/0.5 0.0687/0.1471 2.5816/2.6192

(0.0714/0.1441) (2.5784/2.6056)0/-0.5 0.0989/0.1315 2.6606/2.5728

(0.1002/0.1318) (2.6346/2.5970)0/0 0.0884/0.1292 2.5666/2.6224

(0.0841/0.1361) (2.6191/2.5632)0/0.5 0.0774/0.1408 2.6282/2.6053

(0.0707/0.1357) (2.5854/2.6359)0.5/-0.5 0.0984/0.1222 2.7073/2.6011

(0.0935/0.1136) (2.6668/2.5372)0.5/0 0.0947/0.1252 2.6467/2.5950

(0.0874/0.1142) (2.6062/2.4860)0.5/0.5 0.0781/0.1260 2.6731/2.5288

(0.0731/0.1262) (2.5596/2.5019)

44

Page 50: Credit Risk Modeling and Implementation Report 1.2

Johan Gunnars ([email protected]) February 4, 2017

Table 29: Investor and counterpart: medium risk, reference entity: low risk,ρ02 = 0.

ρ01/ρ12 Default ratio Average default time-0.5/-0.5 0.1433/0.1461 2.6175/2.6057

(0.1454/0.1436) (2.5996/2.5815)-0.5/0 0.1345/0.1444 2.5353/2.6000

(0.1364/0.1411) (2.5315/2.5894)-0.5/0.5 0.1204/0.1423 2.5502/2.5759

(0.1254/0.1469) (2.5232/2.6142)0/-0.5 0.1504/0.1326 2.5666/2.5456

(0.1455/0.1390) (2.5503/2.5384)0/0 0.1439/0.1420 2.5881/2.5947

(0.1349/0.1405) (2.5117/2.5391)0/0.5 0.1334/0.1356 2.5729/2.6259

(0.1222/0.1370) (2.4806/2.5659)0.5/-0.5 0.1437/0.1249 2.5936/2.4884

(0.1415/0.1255) (2.6046/2.5015)0.5/0 0.1473/0.1275 2.5650/2.5346

(0.1422/0.1228) (2.5967/2.4517)0.5/0.5 0.1309/0.1332 2.5738/2.6023

(0.1298/0.1322) (2.5476/2.4873)

Table 30: Investor, reference entity and counterpart: medium risk, ρ02 = -0.6.

ρ01/ρ12 Default ratio Average default time-0.5/0 0.1453/0.1533 2.6642/2.6514

(0.1391/0.1534) (2.6047/2.6503)-0.5/0.5 0.1292/0.1541 2.5479/2.6833

(0.1245/0.1481) (2.5780/2.5915)0/-0.5 0.1568/0.1398 2.6745/2.6288

(0.1599/01431) (2.6874/2.5877)0/0 0.1478/0.1436 2.6324/2.6019

(0.1448/0.1410) (2.5603/2.5715)0/0.5 0.1272/0.1429 2.5215/2.5814

(0.1267/0.1455) (2.5423/2.6284)0.5/-0.5 0.1610/0.1234 2.6857/2.6031

(0.1585/0.1243) (2.6247/2.6461)0.5/0 0.1450/0.1279 2.6322/2.5367

(0.1416/0.1256) (2.5233/2.5291)

45