apply_hazard_ratio
survival.apply_hazard_ratio(curve, hazard_ratio)Proportional-hazards transform: multiply the hazard by a constant.
Scales the cumulative hazard directly, cumulative_hazard(t) * hazard_ratio, so a hazard ratio below 1 lowers the hazard and extends survival. Applied to exponential, this reproduces the closed form exactly: the discounted life expectancy under a hazard ratio r on a constant hazard h is 1 / (discount_rate + r * h).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| curve | SurvivalCurve | The comparator curve. | required |
| hazard_ratio | float |
Multiplicative factor on the hazard. Must be positive. | required |
Returns
| Name | Type | Description |
|---|---|---|
| SurvivalCurve | A new SurvivalCurve with the scaled hazard. |
Example
from heormodel.survival import apply_hazard_ratio, exponential treated = apply_hazard_ratio(exponential(rate=0.2), hazard_ratio=0.5) round(float(treated.survival(5.0)), 5) 0.60653