Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Relative hazard function

g(h_T(t),h_C(t)) = HR(t)

Maps the hazards of an event in a treatment group and a comparator group at the same time t to their ratio. Under proportional hazards the ratio is constant over time, and it can then be applied to a baseline survival curve or a baseline transition probability to obtain absolute outcomes for the treatment group.

  • Hazard ratio from a Cox regression coefficient

    HR = exp(beta)

    Converts the estimated coefficient for a binary treatment covariate in a Cox or other proportional hazards regression into the hazard ratio. The function exp is the exponential function.

  • Treatment survival from a baseline curve under proportional hazards

    S_T = S_C^HR

    Applies a constant hazard ratio to the comparator survival probability at time t to give the treatment survival probability at the same time. It follows because the cumulative hazard of the treatment group is HR times that of the comparator. The comparator curve supplies the absolute level; the ratio alone cannot.

  • Treatment-arm transition probability from a hazard ratio

    p_T = 1 - (1 - p_C)^HR

    Applies a hazard ratio to a comparator transition probability for one model cycle. The comparator probability is converted to a rate, the rate is multiplied by the hazard ratio, and the result is converted back, which reduces to a single power. The conversions are set out on the Transition Probability page.

  • Hazard ratio from event counts and person-time under constant hazards

    HR = (d_T / PT_T) / (d_C / PT_C); SE_beta = sqrt(1 / d_T + 1 / d_C)

    Estimates each arm's hazard as its number of events divided by its person-time at risk and divides the treatment rate by the comparator rate, which gives the rate ratio. Under an exponential model each hazard is constant, so the rate ratio estimates the hazard ratio, and the approximate standard error of its natural logarithm depends only on the two event counts. The time unit cancels, so person-years and person-months give the same ratio when both arms use the same unit. The interval around the estimate follows HE-FM-HR-006.

  • Approximate confidence interval for a hazard ratio from the log scale

    HR_L = exp(beta - z * SE_beta); HR_U = exp(beta + z * SE_beta)

    Builds the interval on the natural log scale, where ratio measures are analysed, by adding and subtracting z standard errors to the log hazard ratio, and exponentiates the two limits. The interval is symmetric about the log hazard ratio and asymmetric about the hazard ratio itself. The log hazard ratio and its standard error come from a Cox model (HE-FM-HR-002) or from event counts and person-time (HE-FM-HR-005); z is 1.96 for a 95% interval.

  • Standard error of a log hazard ratio recovered from a reported confidence interval

    SE_beta = (log(HR_U) - log(HR_L)) / (2 * z)

    Recovers the standard error of the log hazard ratio from a published interval: the difference between the natural logs of the upper and lower limits divided by twice the z value for the interval's coverage, 3.92 for a 95% interval. It is the inverse of HE-FM-HR-006 and supplies the standard error wherever a model or a meta-analysis on the log scale needs one but the report gives only the hazard ratio and its interval.

This set of formulae is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).

Author: Dr Darrin Baines · Publisher: Intelligent Parameters Ltd · Identifier: https://healtheconomics.wiki/concept/hazard-ratio/formulae