cds {CreditRisk} | R Documentation |
Calculates CDS rates starting form default intensities.
cds(t, int, r, R = 0.005, RR = 0.4, simplified = FALSE)
t |
premium timetable. |
int |
deterministic default intensities vector. |
r |
spot interest rates. |
R |
constant premium payments, value that the buyer pays in each t_i. |
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. |
Premium timetable is t_i; i=1,...,T. The vector starts from t_1≤ 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 γ_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:
π^{pb}=∑_{i=1}^Tp(0,i)S(0,i)α_i
and the amount of protection, assuming a recovery rate δ, is:
π^{ps}=(1-δ)∑_{i=1}^Tp(0,i)\hat{Q}(τ=i)α_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:
π^{pb}(0,1)=-\int_{T_a}^{T_b}P(0,t)\cdot(t-T_{β(t)-1}) d_t Q (τ≥q t)+∑_{i=a+1}^bP(0,T_i)\cdotα_i * Q(τ≥q T_i)
and the protection leg as:
π_{a,b}^{ps}(1):=-\int_{t=T_a}^{T_b}P(0,t)d*Q(τ≥q t)
In both versions the forward rates and intensities are supposed as costant stepwise functions with discontinuity in t_i
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.
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
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)