cds {CreditRisk} | R Documentation |
Calculates Credit Default Swap rates
Description
Calculates CDS rates starting form default intensities.
Usage
cds(t, int, r, R = 0.005, RR = 0.4, simplified = FALSE)
Arguments
t |
premium timetable. |
int |
deterministic default intensities vector. |
r |
spot interest rates. |
R |
constant premium payments, value that the buyer pays in each |
RR |
recovery rate on the underline bond, default value is 40%. |
simplified |
logic argument. If FALSE calculates the CDS rates using the semplified version of calculations, if TRUE use the complete version. |
Details
Premium timetable is
t_i; i=1,...,T
. The vector starts fromt_1\le 1
, i.e. the first premium is payed at a year fraction in the possibility that the bond is not yet defaulted. Since premium are a postponed payment (unlike usual insurance contracts).Intensities timetable have domains
\gamma_i; i=t_1,...,T
.spot interest rates of bond have domain
r_i; i=t_1,...,T
. The function transforms spot rates in forward rates. If we specify that we want to calculate CDS rates with the simplified alghoritm, in each period, the amount of the constant premium payment is expressed by:\pi^{pb}=\sum_{i=1}^Tp(0,i)S(0,i)\alpha_i
and the amount of protection, assuming a recovery rate
\delta
, is:\pi^{ps}=(1-\delta)\sum_{i=1}^Tp(0,i)\hat{Q}(\tau=i)\alpha_i
If we want to calculate same quantities with the complete version, that evaluate premium in the continous, the value of the premium leg is calculated as:
\pi^{pb}(0,1)=-\int_{T_a}^{T_b}P(0,t)\cdot(t-T_{\beta(t)-1}) d_t Q (\tau\geq t)+\sum_{i=a+1}^bP(0,T_i)\cdot\alpha_i * Q(\tau\geq T_i)
and the protection leg as:
\pi_{a,b}^{ps}(1):=-\int_{t=T_a}^{T_b}P(0,t)d*Q(\tau\geq t)
In both versions the forward rates and intensities are supposed as costant stepwise functions with discontinuity in
t_i
Value
cds
returns an object of class data.frame
with columns, for esch date
t_i
the value of survival probability, the premium and protection leg, CDS rate
and CDS price.
References
David Lando (2004) Credit risk modeling.
Damiano Brigo, Massimo Morini, Andrea Pallavicini (2013) Counterparty Credit Risk, Collateral and Funding. With Pricing Cases for All Asset Classes
Examples
cds(t = seq(0.5, 10, by = 0.5), int = seq(.01, 0.05, len = 20),
r = seq(0,0.02, len=20), R = 0.005, RR = 0.4, simplified = FALSE)