Credit Spread In Finance And Their Probability Distributions In Data Science

Using Python To Demonstrate Financial Credit Spreads And Hazard Rates

Farhad Malik
Jun 11 · 8 min read

This is a special article that will explain the famous credit spread risk and will explain how data science can help there.

If an investor wants to take more risk then it is only natural for the investor to expect to gain higher return. You can invest your money in a local company and buy its corporate bond or you can invest in buying a government bond. Government bonds are less riskier than the local companies. The riskier the company, the higher the yield interest rate it would offer to attract you into buy its product.

Credit spread is the difference in yields between your target security such as a corporate bond and a reference security such as a government bond.

Please read disclaimer

Photo by Sharon McCutcheon on Unsplash
  • Then I will provide an overview of how we can utilise the statistical measures that are widely used in the field of data science.

Scenario For The Article

This article will explain the concepts that revolve around this scenario:

Spread is all about interest rates.

Photo by Magda Fou on Unsplash

What Is Credit Spread?

Now the way plain vanilla bond works is that you lend your money for a period of time and you get timely payments in return. On the time of maturity, you get all of your original money back. The timely (monthly, semi-annually, annually) payments are based on the yield rate that the borrower offers. The borrower of the money is known as the issuer as it is issuing the bond.

  • The credit spread is therefore the difference in risk premiums of the instruments with same maturity and different credit quality.

What Are The Different Spread Measures?

There are a number of spread measures. I am going to briefly outline the common measures:

  1. i-Spread: The “i” refers to the mechanism of interpolation. It is the difference between the yield to maturity of a risky and linearly interpolated yield to maturity on the benchmark bond. It is calculated when the maturities of the instruments is not the same.
  2. z-Spread: The z-spread is constructed by adding the basis points on the spot rate of the benchmark curve to get the desired bond price.
  3. CDS Spread: This is the premium of CDS of issuer bond to protect from any of the credit events. CDS spreads are observable in market. Plus, liquid CDS contracts are available in market for a large number of maturities. Hence CDS spreads are commonly used.
  4. Option Adjusted Spread (OAS): If you take the z-Spread and adjust it for the optionality of the options then it becomes OAS.
Photo by Vidar Nordli-Mathisen on Unsplash

What Is Spread’01 In Finance?

Spread’01 is known as DVCS.

  1. Then the z-spread is shocked down by 0.5 basis points and the corporate bond is priced.
  2. The difference in the price tells you how sensitive the bond is to the z-spread by 1 basis point.
  3. This measure is known as Spread’01 or DVCS.

Spread’01 measures the credit spread sensitivity.

The marginal change in the spread ’01 decreases when the spread is increased.

It is very similar to DV01. Read this article to get a good understand of the DV01 Bond Risk concepts:

What Are Hazard Rates?

Now that you have bought the corporate bond, there is always a risk that the corporate might default before the maturity date of the bond. The analysts in the financial firms estimate the probability of default and the probability of survival.

  • The probability of survival over time dt is 1-λdt.
  • λ is known as the hazard rate. The hazard rate is the rate of the default of the company.
  • Usually the probability of default increases with time.
Photo by Louis Reed on Unsplash

Let’s Concentrate On Data Science Aspect

Now that we have gained the foundation understanding of the credit spread, let’s analyse its distribution and see if we can model it correctly.

Data Science Field Revolves Around Probability Distributions Of The Variables

How Binomial Distribution Can Be Used To Measure Default Risk

A binomial distribution is the distribution where the values in a sample can only take one of the two values. It is binary in nature, such as success or failure.

Bernoulli trial is memory-less just like a flip of coin is

We know that a company can default. The default of a company over time can be modeled using the binomial distribution. If we represent the default as π then the the mean and variance of a Bernoulli distribution is equal to π and π(1 − π).

Binomial Distribution In Python

Numpy offers a module that can generate samples drawn from the binomial distribution:

samples = numpy.random.binomial(number_of_trials, probability_of_success, size)

Exponential Distribution And Company Default

The exponential distribution is not mentioned as often as the other distributions.

Exponential Distribution In Python

Numpy offers an exponential module that can generate samples drawn from the exponential distribution:

numpy.random.exponential(rate_inverse, size=None)

But how will we measure the total number of defaults over a time?

Use Poisson Distribution

Poisson distribution, on the other hand, can measure the total number of defaults over a specified time.

Poisson Distribution In Python

Numpy offers an Poisson module that can generate samples drawn from the Poisson distribution:

numpy.random.poisson(interval_expectation, size=None)
Photo by Ksenia Makagonova on Unsplash


The publication FinTechExplained is created to explain complex financial, mathematical and technological concepts in simple terms. It also aims to concentrate on the intersection of the three fields.


This blog aims to bridge the gap between technologists, mathematicians and financial experts and helps them understand how fundamental concepts work within each field. Articles

Farhad Malik

Written by

Explaining complex mathematical, financial and technological concepts in simple terms. Contact:


This blog aims to bridge the gap between technologists, mathematicians and financial experts and helps them understand how fundamental concepts work within each field. Articles