Deriving default probability from CDS spread via stripping

I am currently trying to derive the cumulative probability of default from a CDS spread where the LGD is 30% and there are quarterly premiums including the accrued premium.

Maturity        1Y,      3Y,     5Y,     7Y,    10Y
CDS spread  140bps, 160 bps, 180bps, 200bps, 225bps

The risk-free interest rate term structure equals 2% continuously compounding. I am aware that there are many different CDS pricing formulas, but the formula we are using in school to price the CDS is as follows: (see image) To derive the survival probability and consequently the hazard rates, I need to solve for the parts in the boxes. The first part of the formula represents the premium paid. Thus, $$P(0,T_i)$$ is the discounted value, which is calculated by the $$\mathrm{notional} \times \exp\{-\textrm{risk-free rate} \times \textrm{time period}\}$$. $$(T_i – T_{i-1})$$ represents the time period in which the premium is paid and the part in the box is the survival probability.

The second part of the formula is the accrued premium. This is the integral of the following components: $$P(0,u)$$ is the discounted value at the time of default. $$(u – Ty(u))$$ represents the difference between the default time and the last Ti prior to default. The part in the box denotes the probability density function of the default time \$tau$.

The last part of the formula is the protection leg. This is the LGD * the integral of the discounted value at default * the probability density function. However, I do not understand how you can know when the bond has defaulted between two periods and how you quantify this (the default could happen anywhere between two periods, so how does the probability density function help with this?).

I do not simply want the answers of the probability of default and hazard rates, but I want to understand the thought behind this formula. If someone could explain this clearly (like you would explain to a 5-year old) it would be very much appreciated.

• Can you comment, why you have two terms for the premium leg ? I understand the first integral, which is today's NPV of future premia paid, weighted with the probability that they will be made (i.e. contingent on non-default), but then I do not quite get what the first term (the summation) does. – ZRH Mar 9 at 10:59
• Basically, the spread is paid after each quarter. So, the summation basically sums all the premium paid over each period given that there is no default. If the CDS defaults after 3 quarters, the summation sums the premium paid over the first 3 quarters. The second part (starting from the integral) represents the accrued premium, which is the premium that must be paid if the CDS defaults between two periods. (u - Ty(u)) represents the time of default minus the last payment prior to default. The difference * spread is the accrued premium. The greek letter tau represents the default time. – Darryl Paalvast Mar 9 at 11:15

I think the idea behind this is to obtain the default probability given the CDS spread (premium) at each time period $$t$$. Let´s check how.
First, at $$t=0$$, the CDS contract has a value of zero (cost nothing to get in to the contract). So, the cash flow for the buyer and the seller of the contract should be the same (premium leg = protective leg).
So, if you get the CDS spread at specific time ($$t$$), you can get the $$harzad$$ for that a period of time (hazard for first year). Then, you move on to the next period ($$t+1$$) and use all the information you have (including $$hazard_t$$). You do this until the end (bootstrapping methodology).