# Is it possible to calculate conditional PD / unconditional PD from Hazard Rate?

I'm just wondering that can I convert hazard rate to probability of default? Suppose I have the lifetime table data as per below:

Time Total Default Non-Default At Risk
0 - - - 356,335
1 5,587 1,544 4,043 356,335
2 5,613 1,421 4,192 350,748
3 5,670 1,332 4,338 345,135
4 5,755 1,251 4,504 339,465

The total is the number of observation at time t. It combines event and non-event (right censoring) at time t.

Basically, I can calculate the Cumulative PD by sum of default at time(t) and divided by initial (356,335) observation and the Marginal PD by default at time(t) divided by initial observation (356,335). Also, the Conditional PD by default at time(t) divided by number of observation at time(t) with cumulative of Non-Default. The example is per below:

Cumulative PD at time 2 = (1,544 + 1,421) / 356,335 = 0.83%
Marginal PD PD at time 2 = 1,421 / 356,335 = 0.40%
Conditional PD at time 2 = 1,421 / (350,748 + 4,043) = 0.40%


I have used NelsonAalenFitter() to calculate the cumulative hazard rate. The formula used to calculate hazard rate is -1 * [log(At Risk - Default) - log(At Risk)] and cumulative sum to get cumulative hazard rate. For example:

Hazard rate at time 2 = -1 * [log(350,748 - 1,421) - log(350,748)] = 0.41%


I wonder that is it possible to convert the Hazard rate of 0.41% to either Conditional PD of 0.40% or Marginal PD of 0.40%?

Thank you.

• Please edit your question to clarify what the "non-default" and "total" numbers mean. In typical survival analysis, you would have a number at risk (as you do) and the number who experienced the event (default), so the meaning of the extra "non-default" cases at each time point is unclear. What makes those cases different from the others at risk who didn't default? You might need a multi-state model to handle this correctly. Please add that information by editing the question, as comments are easy to overlook and can be deleted.
– EdM
Commented Jan 1, 2022 at 18:41
• @EdM I have revised it. It is the right censoring from the data. Commented Jan 2, 2022 at 13:40
• Why is default plus non-default not adding up to at risk of previous period? Is the other category closures?
– S S
Commented Dec 18, 2023 at 8:18

I can calculate the Cumulative PD* by sum of default at time(t) and divided by initial (356,335) observation and the Marginal PD** by default at time(t) divided by initial observation (356,335).

Those calculations would only be correct if there were no censoring. In your situation with such a large number of cases relative to events and censored cases you might not notice the difference, but your calculations are incorrect as you have censoring.

In general you need to do these calculations by working with the numbers at risk within each time interval. Using the initial numbers at risk at Time = 0 in the denominators is incorrect if there is censoring.

Also, the Conditional PD** by default at time(t) divided by number of observation at time(t) with cumulative of Non-Default.

Your example for time 2 is:

 1,421 / (350,748 + 4,043) = 0.40%


If 350,748 + 4,043 were at risk during the period between Time = 1 and Time = 2 and 1421 defaulted during that period, that is simply the hazard/probability of default during that period. (It's not clear from your question whether that corresponds precisely to the way that you have coded your data.)

For me, and for Klein and Moeschberger (2nd edition, page 32, equation 2.3.8), the simplest way to estimate the cumulative hazard for discrete-time data like yours is to add up the hazards of all the time periods through the time of interest. If $$h(t_j)$$ is the hazard for time period $$j$$, you can write:

$$H(t)=\sum_{t_j \le t} h(t_j)$$

There's an alternate estimate of cumulative hazard for discrete times, Equation 2.3.9 in Klein and Moeschberger:

$$H(t)=-\sum_{t_j \le t} \ln[1-h(t_j)].$$

When you say

The formula used to calculate hazard rate is -1 * [log(At Risk - Default) - log(At Risk)] and cumulative sum to get cumulative hazard rate,

you are taking the difference in cumulative survival calculated that way between two adjacent time periods. With low hazard rates like yours there won't be much difference between the two estimates. These equations show how you can convert between the two types of estimates. In general it's best to choose one method, stick with it, and specify the choice that you made to your audience.

*I assume that by "PD" you mean "probability of default."

**I don't think that your use of the words "Marginal" and "Conditional" is standard. See Wikipedia. A "marginal" probability means some type of average over a sample; a "conditional" probability takes the values of other variables into account.

• 1. Is it necessary in the survival analysis that the cumulative PD is only applied with no censoring data. If so, this means every observation must be defaulted at some points, doesn't it? 2. If the hazard/conditional PD are the same for you, why the twos calculations are not provided the same results? For me the conditional PD is the rate of default at time given condition of survived from time t-1. Commented Jan 3, 2022 at 7:17
• @SasiwutChaiyadecha 1. It's a fundamental principle of survival analysis that a censored case must be removed from the risk set for calculations after its last observation time, when it no longer provides information about who's at risk for an event at later times. If there is at most one event per individual, all cases do eventually leave the risk set.
– EdM
Commented Jan 3, 2022 at 14:32
• @SasiwutChaiyadecha 2. That use of the term "conditional PD" isn't standard. In discrete-time survival analysis, what you describe is the simplest way to define the hazard for that time period. Your alternate version from lifelines, with slightly different values, comes from a form of discrete cumulative hazard $H(t)$ that, unlike the simple calculation, retains the relationship to survival $S(t)$ seen in continuous-time analysis, $S(t)=\exp (-H(t))$. As lifelines seems mainly oriented towards continuous-time analysis, I suspect that's why you got results from the second calculation.
– EdM
Commented Jan 3, 2022 at 14:42