Signature
lp = beta_1 * x_1 + beta_2 * x_2; RS = exp(lp); h_x = h_0 * RS; S_x = S_0^RS
| Inputs | Definition | Unit |
|---|---|---|
beta_1 | Log hazard ratio for a one-unit increase in the first covariate with the second held fixed | log hazard ratio per unit of x_1 |
x_1 | Value of the first covariate for this person, for example 1 for treatment and 0 for the comparator | the covariate's own unit |
beta_2 | Log hazard ratio for a one-unit increase in the second covariate with the first held fixed | log hazard ratio per unit of x_2 |
x_2 | Value of the second covariate for this person, for example age above a reference age in units of 10 years | the covariate's own unit |
h_0 | Hazard at time t for a person whose covariates are all zero, left unspecified by the model | events per person per unit of time |
S_0 | Probability that a person whose covariates are all zero remains event free beyond time t | probability |
lp | Sum of each Cox coefficient times its covariate value, gamma in Bradburn and colleagues | log hazard ratio, no unit |
|---|---|---|
RS | Exponential of the linear predictor, the factor by which the profile's hazard exceeds the baseline hazard | ratio, no unit |
h_x | Hazard at time t for a person with the stated covariate values | events per person per unit of time |
S_x | Probability that a person with the stated covariate values remains event free beyond time t | probability |
Function
Cox proportional hazards model function for hazards, partial likelihood and baseline curves
Maps right-censored survival records with covariates to the coefficients of the Cox model, their standard errors and the estimated baseline curve. HE-FM-CPH-001 gives the hazard and survival of one covariate profile from a baseline and a linear predictor, HE-FM-CPH-002 the partial likelihood over the risk sets, HE-FM-CPH-003 one step of the Breslow baseline cumulative hazard, HE-FM-CPH-004 the Breslow and Efron terms for two tied deaths, and HE-FM-CPH-005 a hazard ratio that changes with log time. HE-CF-CPH-001 maximises the partial likelihood by Newton-Raphson. HE-FM-HR-002 turns a coefficient into a hazard ratio, HE-FM-HR-006 gives its confidence interval, HE-FN-CUMH-001 links a cumulative hazard to survival and HE-FM-HR-003 is the power rule for a survival curve, and none of these is restated here as a formula of its own. Notation follows the Cox Proportional Hazards article.
Try this function
Implementations
Excel
Excel hazard and survival of a Cox covariate profile
With inputs in CoefTreatment, CovTreatment, CoefAge, CovAge, BaselineHazard and BaselineSurvival, the four formulas go in LinearPredictor, RiskScore, ProfileHazard and ProfileSurvival.
=CoefTreatment*CovTreatment+CoefAge*CovAge; =EXP(LinearPredictor); =BaselineHazard*RiskScore; =BaselineSurvival^RiskScore
Assumptions
Covariates act multiplicatively and log-linearly on the Cox hazard
Each covariate multiplies the hazard by a fixed factor per unit at every time, so the hazard in any group is a constant multiple of the hazard in any other, the key assumption Bradburn and colleagues state for the model. PMG36 section 4.6.22 states that the proportional hazards assumption should always be assessed. Where it fails, HE-FM-CPH-005 is one way of letting the hazard ratio vary with time.
Baseline and coefficients come from the same fit with the same covariate coding
h_0 and S_0 describe a person with every covariate at zero under the coding used in the fit. Recoding or centring a covariate changes the baseline, and the coefficients then pair only with the baseline of that coding.
Worked examples
Treated patient 20 years above the reference age with illustrative coefficients
All inputs are illustrative. Treatment lowers the log hazard by 0.5 and each 10 years of age raises it by 0.1. The two effects combine to a risk score of about 0.74, which lowers the baseline hazard of 0.02 per month and raises the baseline survival of 0.7.
beta_1 = -0.5; x_1 = 1; beta_2 = 0.1; x_2 = 2; h_0 = 0.02; S_0 = 0.7; lp = -0.3; RS = 0.7408; h_x = 0.0148; S_x = 0.7678
Article's treated patient at the 5-month comparator survival
The article's estimated coefficient and its comparator survival of 0.1939 at 5 months give the treatment survival of 0.527 in the article's table. The baseline hazard of 0.1 per month is illustrative, since the article's table gives cumulative hazards only.
beta_1 = -0.9406; x_1 = 1; beta_2 = 0; x_2 = 0; h_0 = 0.1; S_0 = 0.1939; lp = -0.9406; RS = 0.3904; h_x = 0.039; S_x = 0.5271
All covariates at zero return the Cox baseline
A limiting case with illustrative baseline values. With every covariate at zero the linear predictor is 0 and the risk score is 1, so the hazard and survival equal the baseline whatever the coefficients.
beta_1 = -0.5; x_1 = 0; beta_2 = 0.1; x_2 = 0; h_0 = 0.02; S_0 = 0.7; lp = 0; RS = 1; h_x = 0.02; S_x = 0.7
Common errors
Treating the default basehaz curve as the all-zero Cox baseline
In the R survival package basehaz returns by default the curve at the covariate means, fit$mean, and returns the all-zero curve only with centered=FALSE. Applying RS for the actual covariate values to the default curve multiplies the cumulative hazard by an extra exp(beta * mean) for a continuous covariate (derived). With an illustrative coefficient of 0.1 per unit and a mean of 6, the cumulative hazard comes out exp(0.6), about 1.82 times too high.
Reading a Cox hazard ratio as a ratio of risks or survival probabilities
A risk score scales the hazard only. In the article's example the hazard ratio is 0.39, while the ratio of the probabilities of having died by 5 months is 0.4729 / 0.8061, about 0.59, and the ratio of survival probabilities is about 2.72. HE-ER-ARR-004 covers the same substitution for relative risk.
Sources
Bradburn and colleagues on the Cox model equation and predicted survival
Bradburn MJ, Clark TG, Love SB, Altman DG. Survival analysis part II: multivariate data analysis, an introduction to concepts and methods. British Journal of Cancer. 2003;89(3):431-436. Section The Cox ('semi-parametric') proportional hazards model prints h(t) = h0(t) x exp{b1x1 + b2x2 + ... + bpxp}, calls h0 the baseline hazard, the value of the hazard if all the xi are equal to zero, and states that the hazard in any group is a constant multiple of the hazard in any other. Section Interpreting the PH model, beyond the hazard ratio, prints S(t) = S0(t)^exp(gamma) with gamma equal to b1x1 + b2x2 + ... + bpxp.
Cox 1972 hazard as covariate function times an arbitrary function of time
Cox DR. Regression models and life-tables. Journal of the Royal Statistical Society Series B (Methodological). 1972;34(2):187-202. The summary states that the hazard function is taken to be a function of the explanatory variables and unknown regression coefficients multiplied by an arbitrary and unknown function of time.
PMG36 section 4.6.22 on assessing proportional hazards for Cox output
National Institute for Health and Care Excellence. NICE technology appraisal and highly specialised technologies guidance: the manual (PMG36). Published 31 January 2022, last updated 13 October 2026. Section 4.6.22 states that hazard ratios may either be constant over time (proportional hazards) or change over time, and that the proportional hazards assumption should always be assessed.
survival package basehaz default curve at the covariate means
Therneau TM. survival: Survival Analysis. R package version 3.8-12, reference manual. 9 September 2026. Entry basehaz, argument centered, says that TRUE returns data from a predicted survival curve for the covariate values fit$mean and FALSE returns a prediction for all covariates equal to zero.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
