# cdsbootstrap

Bootstrap default probability curve from credit default swap market quotes

## Syntax

``````[ProbData,HazData] = cdsbootstrap(ZeroData,MarketData,Settle)``````
``````[ProbData,HazData] = cdsbootstrap(___,Name,Value)``````

## Description

example

``````[ProbData,HazData] = cdsbootstrap(ZeroData,MarketData,Settle)``` bootstraps the default probability curve using credit default swap (CDS) market quotes. The market quotes can be expressed as a list of maturity dates and corresponding CDS market spreads, or as a list of maturities and corresponding upfronts and standard spreads for standard CDS contracts. The estimation uses the standard model of the survival probability.```

example

``````[ProbData,HazData] = cdsbootstrap(___,Name,Value)``` adds optional name-value pair arguments.```

## Examples

collapse all

This example shows how to use `cdsbootstrap` with market quotes for CDS contracts to generate `ProbData` and `HazData` values.

```Settle = '17-Jul-2009'; % valuation date for the CDS Spread_Time = [1 2 3 5 7]'; Spread = [140 175 210 265 310]'; Market_Dates = daysadd(datenum(Settle),360*Spread_Time,1); MarketData = [Market_Dates Spread]; Zero_Time = [.5 1 2 3 4 5]'; Zero_Rate = [1.35 1.43 1.9 2.47 2.936 3.311]'/100; Zero_Dates = daysadd(datenum(Settle),360*Zero_Time,1); ZeroData = [Zero_Dates Zero_Rate]; format long [ProbData,HazData] = cdsbootstrap(ZeroData,MarketData,Settle)```
```ProbData = 5×2 105 × 7.343360000000000 0.000000233427859 7.347010000000000 0.000000575839968 7.350670000000000 0.000001021397017 7.357970000000000 0.000002064539982 7.365280000000000 0.000003234110940 ```
```HazData = 5×2 105 × 7.343360000000000 0.000000232959886 7.347010000000000 0.000000352000512 7.350670000000000 0.000000476383354 7.357970000000000 0.000000609055766 7.365280000000000 0.000000785241515 ```

## Input Arguments

collapse all

Zero rate data, specified as a `M`-by-`2` vector of dates and zero rates or an `IRDataCurve` object of zero rates.

When `ZeroData` is an `IRDataCurve` object, `ZeroCompounding` and `ZeroBasis` are implicit in `ZeroData` and are redundant inside this function. In this case, specify these optional parameters when constructing the `IRDataCurve` object before using the `cdsbootstrap` function.

For more information on an `IRDataCurve` (Financial Instruments Toolbox) object, see Creating an IRDataCurve Object (Financial Instruments Toolbox).

Data Types: `double`

Bond market data, specified as a `N`-by-`2` matrix of dates and corresponding market spreads or `N`-by-`3` matrix of dates, upfronts, and standard spreads of CDS contracts. The dates must be entered as serial date numbers, upfronts must be numeric values between `0` and `1`, and spreads must be in basis points.

Data Types: `double`

Settlement date, specified as a serial date number or a date character vector. The `Settle` date must be earlier than or equal to the dates in `MarketData`

Data Types: `double` | `char`

### Name-Value Arguments

Specify optional pairs of arguments as `Name1=Value1,...,NameN=ValueN`, where `Name` is the argument name and `Value` is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose `Name` in quotes.

Example: `[ProbData,HazData] = cdsbootstrap(ZeroData,MarketData,Settle,'RecoveryRate',Recovery,'ZeroCompounding',-1)`

Note

Any optional input of size `N`-by-`1` is also acceptable as an array of size `1`-by-`N`, or as a single value applicable to all contracts. Single values are internally expanded to an array of size `N`-by-`1`.

Recovery rate, specified as the comma-separated pair consisting of `'RecoveryDate'` and a `N`-by-`1` vector of recovery rates, specified as a decimal from `0` to `1`.

Data Types: `double`

Premium payment frequency, specified as the comma-separated pair consisting of `'Period'` and a `N`-by-`1` vector with values of `1`, `2`, `3`, `4`, `6`, or `12`.

Data Types: `double`

Day-count basis of the contract, specified as the comma-separated pair consisting of `'Basis'` and a positive integer using a `NINST`-by-`1` vector.

• 0 = actual/actual

• 1 = 30/360 (SIA)

• 2 = actual/360

• 3 = actual/365

• 4 = 30/360 (PSA)

• 5 = 30/360 (ISDA)

• 6 = 30/360 (European)

• 7 = actual/365 (Japanese)

• 8 = actual/actual (ICMA)

• 9 = actual/360 (ICMA)

• 10 = actual/365 (ICMA)

• 11 = 30/360E (ICMA)

• 12 = actual/365 (ISDA)

• 13 = BUS/252

Data Types: `double`

Business day conventions, specified as the comma-separated pair consisting of `'BusinessDayConvention'` and a character vector. The selection for business day convention determines how non-business days are treated. Non-business days are defined as weekends plus any other date that businesses are not open (for example, statutory holidays). Values are:

• `'actual'` — Non-business days are effectively ignored. Cash flows that fall on non-business days are assumed to be distributed on the actual date.

• `'follow'` — Cash flows that fall on a non-business day are assumed to be distributed on the following business day.

• `'modifiedfollow'` — Cash flows that fall on a non-business day are assumed to be distributed on the following business day. However if the following business day is in a different month, the previous business day is adopted instead.

• `'previous'` — Cash flows that fall on a non-business day are assumed to be distributed on the previous business day.

• `'modifiedprevious'` — Cash flows that fall on a non-business day are assumed to be distributed on the previous business day. However if the previous business day is in a different month, the following business day is adopted instead.

Data Types: `char`

Flag for accrued premiums paid upon default, specified as the comma-separated pair consisting of `'PayAccruedPremium'` and a `N`-by-`1` vector of Boolean flags that is `true` (default) if accrued premiums are paid upon default, `false` otherwise.

Data Types: `logical`

Number of days to take as time step for the numerical integration, specified as the comma-separated pair consisting of `'TimeStep'` and a nonnegative integer.

Data Types: `double`

Compounding frequency of the zero curve, specified as the comma-separated pair consisting of `'ZeroCompounding'` and an integer with values:

• `1` — Annual compounding

• `2` — Semiannual compounding

• `3` — Compounding three times per year

• `4` — Quarterly compounding

• `6` — Bimonthly compounding

• `12` — Monthly compounding

• `−1` — Continuous compounding

Data Types: `double`

Basis of the zero curve, specified as the comma-separated pair consisting of `'ZeroBasis'` and an integer with values that are identical to `Basis`.

Data Types: `double`

Dates for probability data, specified as the comma-separated pair consisting of `'ProbDates'` and a `P`-by-`1` vector of dates, given as serial date numbers or date character vectors.

Data Types: `double` | `char`

## Output Arguments

collapse all

Default probability values, returned as a `P`-by-`2` matrix with dates and corresponding cumulative default probability values. The dates match those in `MarketData`, unless the optional input parameter `ProbDates` is provided.

Hazard rate values, returned as a `N`-by-`2` matrix with dates and corresponding hazard rate values for the survival probability model. The dates match those in `MarketData`.

Note

A warning is displayed when non-monotone default probabilities (that is, negative hazard rates) are found.

## Algorithms

If the time to default is denoted by τ, the default probability curve, or function, PD(t), and its complement, the survival function Q(t), are given by:

`$PD\left(t\right)=P\left[\tau \le t\right]=1-P\left[\tau >t\right]=1-Q\left(t\right)$`

In the standard model, the survival probability is defined in terms of a piecewise constant hazard rate h(t). For example, if h(t) =

λ1, for `0`tt1

λ2, for t1 < tt2

λ3, for t2 <t

then the survival function is given by Q(t) =

${e}^{-\lambda 1t}$, for `0`tt1

${}^{{e}^{-\lambda 1t-\lambda 2\left(t-t1\right)}}$, for t1 < tt2

${}^{{e}^{-\lambda 1t1-\lambda 2\left(t2-t1\right)-\lambda 3\left(t-t2\right)}}$, for t2 < t

Given n market dates t1,...,tn and corresponding market CDS spreads S1,...,Sn, `cdsbootstrap` calibrates the parameters λ1,...,λn and evaluates PD(t) on the market dates, or an optional user-defined set of dates.

## References

[1] Beumee, J., D. Brigo, D. Schiemert, and G. Stoyle. “Charting a Course Through the CDS Big Bang.” Fitch Solutions, Quantitative Research, Global Special Report. April 7, 2009.

[2] Hull, J., and A. White. “Valuing Credit Default Swaps I: No Counterparty Default Risk.” Journal of Derivatives. Vol. 8, pp. 29–40.

[3] O'Kane, D. and S. Turnbull. “Valuation of Credit Default Swaps.” Lehman Brothers, Fixed Income Quantitative Credit Research, April 2003.

## Version History

Introduced in R2010b