Search

Search papers and lessons

Hazard Function

Level 3 · 11 min read

The hazard function is the instantaneous failure rate: among things still working at time t, how fast they are failing right then.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Calculus
  • Sign in to see your progress

TL;DR

The hazard function, written h(t)h(t), tells you how fast things are failing at time tt, counting only the things that are still working at tt. It is a rate, not a probability, so its value depends on the time unit and can exceed 1 when the unit is large compared with how fast things fail (per year, say, for parts that last weeks). Given the hazard curve, you can rebuild the whole survival curve, and given the survival curve, you can recover the hazard.

Where you'll see it: in reliability tests that ask whether components wear out or fail early, in clinical studies that compare how fast patients reach an event, and in insurance and churn models that ask how risk changes with age or tenure.

This is an educational explanation, not medical advice. The clinical examples describe how the statistics work and say nothing about any treatment or individual patient.

Intuition

Ask about the survivors

A survival curve answers "how many are still here at time tt?" The hazard asks a sharper question: "of those still here at tt, how many fail in the next tiny moment?" That second question is about the present danger, not about the whole history.

Picture a batch of light bulbs. At the start all of them work, and the first bulbs to burn out are the ones with flaws. Later the bulbs that remain are the tougher ones. The fraction failing in a given week is a fraction of a shrinking group, so a single number for the whole batch hides what is happening. The hazard fixes this by always dividing by the number still working, at the moment you look.

Why a rate, and not a density

The density f(t)f(t) tells you where failures are concentrated over all time. But a density at a late time can be small for two different reasons: few things reach that time, or the things that do reach it rarely fail. The hazard removes the first reason. It only looks at survivors, so it isolates how dangerous the present moment is.

flowchart LR
  A[Units alive at time t] --> B[Fraction failing in the next tiny step]
  B --> C[Divide by the step length]
  C --> D[Hazard h of t: failure rate among survivors]
0246810121400.10.20.3time t (years)hazard h(t) per year
  • constant hazard (exponential)
  • rising hazard (wear-out)
Two hazard curves. The flat one never changes its risk with age; the rising one gets more dangerous the longer a unit has lasted.

The math

Definition

Definition: Hazard function

For a non-negative lifetime TT (a random variable) with density f(t)f(t) and survival function S(t)=P(T>t)S(t) = P(T \gt t), the hazard function is

h(t)=f(t)S(t),S(t)>0.h(t) = \frac{f(t)}{S(t)}, \qquad S(t) \gt 0.

Equivalently, h(t)h(t) is the limit of a conditional probability per unit time:

h(t)=lim⁡Δ→0P(t≤T<t+Δ∣T≥t)Δ.h(t) = \lim_{\Delta \to 0} \frac{P(t \le T \lt t + \Delta \mid T \ge t)}{\Delta}.

Here TT is the lifetime, tt is a time you are standing at, and Δ\Delta is a short step after tt. The numerator in the limit is the probability that the lifetime ends in [t,t+Δ)[t, t+\Delta), given that it has lasted until tt. Dividing by Δ\Delta turns that probability into a rate. The two forms agree because of the conditional probability rule: P(t≤T<t+Δ∣T≥t)=P(t≤T<t+Δ)/P(T≥t)P(t \le T \lt t+\Delta \mid T \ge t) = P(t \le T \lt t+\Delta)/P(T \ge t), and the first term is approximately f(t) Δf(t)\,\Delta for small Δ\Delta.

Hazard and survival are two views of one object

Because SS is the complement of the cumulative distribution function, its derivative is S′(t)=−f(t)S'(t) = -f(t). Substitute into the definition:

h(t)=f(t)S(t)=−S′(t)S(t)=−ddtln⁡S(t).h(t) = \frac{f(t)}{S(t)} = -\frac{S'(t)}{S(t)} = -\frac{d}{dt}\ln S(t).

Integrate both sides from 00 to tt. The left side becomes ln⁡S(t)−ln⁡S(0)\ln S(t) - \ln S(0), and S(0)=1S(0) = 1 because everything works at the start. So

S(t)=exp⁡ ⁣(−∫0th(s) ds).S(t) = \exp\!\left(-\int_0^t h(s)\, ds\right).

The integral H(t)=∫0th(s) dsH(t) = \int_0^t h(s)\, ds is called the cumulative hazard. Survival is the exponential of minus the total hazard collected so far. This is why a hazard curve that stays high for a long time makes the survival curve drop fast. You need the integral only to move between the two views; the hazard itself is a simple ratio.

Constant hazard and the exponential

Take an exponential lifetime with rate λ>0\lambda \gt 0, so f(t)=λe−λtf(t) = \lambda e^{-\lambda t} and S(t)=e−λtS(t) = e^{-\lambda t}. Then

h(t)=λe−λte−λt=λ.h(t) = \frac{\lambda e^{-\lambda t}}{e^{-\lambda t}} = \lambda.

The hazard is the same at every time. This matches the memoryless property. For any tt and ss,

P(T>t+s∣T>t)=S(t+s)S(t)=e−λ(t+s)e−λt=e−λs,P(T \gt t + s \mid T \gt t) = \frac{S(t+s)}{S(t)} = \frac{e^{-\lambda(t+s)}}{e^{-\lambda t}} = e^{-\lambda s},

which depends on ss but not on tt. A constant hazard means the risk of failing next does not depend on how long the unit has already survived. That is a strong and often unrealistic assumption, so it is worth checking.

Other shapes

A family often used for lifetimes is the Weibull distribution, a lifetime model with a shape parameter k>0k \gt 0 and a scale parameter λ>0\lambda \gt 0. Its survival function is S(t)=exp⁡ ⁣(−(t/λ)k)S(t) = \exp\!\left(-(t/\lambda)^k\right), and its hazard is

h(t)=kλ(tλ)k−1.h(t) = \frac{k}{\lambda}\left(\frac{t}{\lambda}\right)^{k-1}.

When k=1k = 1 the hazard is constant and the model reduces to the exponential. When k>1k \gt 1 the hazard rises with time, the signature of wear-out. When k<1k \lt 1 it falls, the signature of early failures that weed out weak units.

Worked examples

Example
1. A hand-computable exponential check

Let the lifetime be exponential with λ=0.5\lambda = 0.5 per year. Check the hazard at t=2t = 2 years.

  1. The density is f(2)=0.5 e−0.5⋅2=0.5 e−1≈0.18394f(2) = 0.5\, e^{-0.5 \cdot 2} = 0.5\, e^{-1} \approx 0.18394.
  2. The survival is S(2)=e−0.5⋅2=e−1≈0.36788S(2) = e^{-0.5 \cdot 2} = e^{-1} \approx 0.36788.
  3. The ratio is h(2)=0.18394/0.36788=0.5h(2) = 0.18394 / 0.36788 = 0.5.

The hazard is 0.50.5 per year at every time, which is just λ\lambda. You can also see it from the cumulative form: ∫020.5 ds=1\int_0^2 0.5\, ds = 1, and e−1e^{-1} is the survival at 2.

Example
2. A discrete count of survivors

A batch of 1000 devices is watched year by year. Deaths and survivors are recorded at the start of each year.

YearAt risk at startFailures in yearHazard (failures divided by at risk)Survivors at end
11000100100 / 1000 = 0.10900
29009090 / 900 = 0.10810
38108181 / 810 = 0.10729
  1. The hazard is the failure count divided by the number still at risk, not by the original 1000. Each year's denominator shrinks.
  2. Every year the hazard is 0.10, so 10 percent of the survivors fail each year.
  3. After three years, 729/1000=0.729=0.93729 / 1000 = 0.729 = 0.9^3. The survival is the product of the yearly survival fractions, 0.9×0.9×0.90.9 \times 0.9 \times 0.9.
  4. The continuous version of the same behaviour is an exponential with e−λ=0.9e^{-\lambda} = 0.9, so λ=−ln⁡0.9≈0.105\lambda = -\ln 0.9 \approx 0.105 per year. The annual hazard of 0.10 and the continuous rate of 0.105 describe the same survival curve, measured on different clocks.

The yearly table is the idea behind the Kaplan–Meier Estimator, which applies this divide-by-those-at-risk rule at every observed event time.

Example
3. A realistic wear-out model

A mechanical part follows a Weibull lifetime with shape k=2k = 2 and scale λ=10\lambda = 10 years. Its hazard is

h(t)=210(t10)=0.02 tper year.h(t) = \frac{2}{10}\left(\frac{t}{10}\right) = 0.02\, t \quad \text{per year}.
  1. At t=5t = 5 years, h(5)=0.02⋅5=0.10h(5) = 0.02 \cdot 5 = 0.10 per year.
  2. At t=10t = 10 years, h(10)=0.02⋅10=0.20h(10) = 0.02 \cdot 10 = 0.20 per year. The risk has doubled, because the hazard is linear in time.
  3. The survival at 5 years is S(5)=exp⁡ ⁣(−(5/10)2)=exp⁡(−0.25)≈0.7788S(5) = \exp\!\left(-(5/10)^2\right) = \exp(-0.25) \approx 0.7788.
  4. The survival at 10 years is S(10)=exp⁡(−1)≈0.3679S(10) = \exp(-1) \approx 0.3679.
  5. Check the integral: H(10)=∫0100.02 s ds=0.01⋅100=1H(10) = \int_0^{10} 0.02\, s\, ds = 0.01 \cdot 100 = 1, and exp⁡(−1)=S(10)\exp(-1) = S(10), as the identity predicts.
  6. Among parts still working at 5 years, the chance of failing in the next 0.1 years is roughly h(5)×0.1=0.01h(5) \times 0.1 = 0.01. Computing it exactly from the survival values gives (0.7788−0.7710)/0.7788≈0.0100(0.7788 - 0.7710)/0.7788 \approx 0.0100, which agrees.

Interpretation: the yearly risk for a surviving part doubles between year 5 and year 10, so the longer a part has lasted, the more dangerous each further year is. A flat exponential model would miss this.

Tradeoffs and failure modes

SituationProblemBetter choice
The risk may change with ageA constant hazard model forces risk to stay flatUse a model with a varying hazard, such as the Weibull with k≠1k \ne 1
You want to compare risks between groups over timeLooking at survival curves alone hides the rate of changeCompare hazards, or use the Cox proportional hazards model
Some units are still working when the study endsSimply counting failures underestimates risk, because the observation was cut shortUse methods built for censored data (units whose failure was not observed before the study ended), such as the Kaplan–Meier Estimator
Data are sparse at late timesThe hazard estimate is noisy where few units remain at riskReport intervals, or pool neighbouring times
A hazard above 1 seems impossiblePeople expect probabilitiesRemember the hazard is a rate per unit time, and it depends on the time unit chosen

The most common mistake is to read a hazard as a probability. The hazard has no upper bound of 1: if the unit of time is long compared with how fast units fail, the number can be large. It also is not the chance of failing over a long period. Over a long interval, the chance comes from the cumulative hazard through the survival function. A second mistake is to divide failures by everyone who started, instead of everyone still at risk at the moment of the failure.

History

Life tables that count how many people of each age survive are much older than the word "hazard". Edmond Halley published a mortality table in 1693 that used age-specific survival to price annuities. Later actuaries wrote the same idea as a force of mortality, which is the hazard under another name. The term "hazard rate" became standard in reliability engineering and biostatistics in the 20th century. Waloddi Weibull's lifetime model appeared in the 1950s and found wide use in engineering because its shape parameter matches early failures, random failures and wear-out with one formula. In 1972, David Cox introduced the proportional hazards regression, which compares groups through their hazards without fixing the shape of the baseline hazard. The approach caught on because it lets a study adjust for many factors while keeping the hazard as the quantity of interest.

Recap

The hazard function h(t)=f(t)/S(t)h(t) = f(t)/S(t) is the failure rate among units still working at time tt. Integrating it gives the cumulative hazard, and the survival function is its exponential with a minus sign. A constant hazard is the exponential distribution and the memoryless property. Varying hazards, rising or falling, are the usual way to model wear-out or early failure, and the Cox model and the Kaplan–Meier estimator both build on this quantity.

Check yourself

QuestionIn words, what does the hazard at time tt measure, and why can it exceed 1?Show answer

It measures how fast units that have survived to time tt are failing at that moment, as a rate per unit of time. It is not a probability over a whole interval. Because it is a rate, its size depends on the time unit: a hazard of 0.1 per year is the same risk as 0.1/365, about 0.0003, per day. A rate can exceed 1 when the unit is large compared with how quickly things fail, for example 2 failures per year among units that typically last a few months.

QuestionA Weibull lifetime has k=2k = 2 and λ=1\lambda = 1, so h(t)=2th(t) = 2t. Find h(0.5)h(0.5) and S(0.5)S(0.5).Show answer

h(0.5)=2×0.5=1h(0.5) = 2 \times 0.5 = 1. The survival is S(0.5)=exp⁡ ⁣(−(0.5)2)=exp⁡(−0.25)≈0.7788S(0.5) = \exp\!\left(-(0.5)^2\right) = \exp(-0.25) \approx 0.7788. Both numbers come straight from the formulas: the hazard from h(t)=2th(t) = 2t and the survival from exp⁡(−H(t))\exp(-H(t)) with H(t)=t2H(t) = t^2.

QuestionWhy does a constant hazard produce the memoryless property?Show answer

Because P(T>t+s∣T>t)=S(t+s)/S(t)P(T \gt t + s \mid T \gt t) = S(t+s)/S(t), and S(t)=exp⁡(−∫0th)S(t) = \exp(-\int_0^t h). With a constant hazard λ\lambda the integral is λt\lambda t, so the ratio becomes e−λse^{-\lambda s}. That expression does not contain tt: the chance of lasting another ss units is the same whatever age the unit already has.

QuestionA batch of machines has a hazard that is high in the first week and then falls to a low, flat level. What does this suggest, and what would you check before relying on it?Show answer

It suggests early failures from manufacturing defects. The weak units fail first, so the survivors are more reliable and the hazard drops. Before relying on this, check that the early hazard is not an artefact of a short observation window or of machines being removed from the study. The flat part should be checked over a long enough period to be trusted.

Sources