Hazard and survival of one covariate profile from a Cox baseline and linear predictor

The linear predictor adds each coefficient times its covariate value, the risk score is its exponential, and the hazard of the profile is the baseline hazard times the risk score. Two covariates are written out, and further covariates add further terms to lp. With a single treatment covariate at 1, RS is the hazard ratio of HE-FM-HR-002 and h_x is HE-FM-HR-001 solved for the treatment hazard; this record adds covariates of any scale and any number. The last part takes the form of HE-FM-HR-003, which computes it for a treatment hazard ratio; Bradburn and colleagues print the same form for any covariate values, S(t) = S_0(t)^exp(gamma). The baseline is the profile with every covariate at zero, so absolute hazards and survival need it, and a coefficient alone gives only a relative effect.

Signature

lp = beta_1 * x_1 + beta_2 * x_2; RS = exp(lp); h_x = h_0 * RS; S_x = S_0^RS
Inputs
InputsDefinitionUnit
beta_1Log hazard ratio for a one-unit increase in the first covariate with the second held fixedlog hazard ratio per unit of x_1
x_1Value of the first covariate for this person, for example 1 for treatment and 0 for the comparatorthe covariate's own unit
beta_2Log hazard ratio for a one-unit increase in the second covariate with the first held fixedlog hazard ratio per unit of x_2
x_2Value of the second covariate for this person, for example age above a reference age in units of 10 yearsthe covariate's own unit
h_0Hazard at time t for a person whose covariates are all zero, left unspecified by the modelevents per person per unit of time
S_0Probability that a person whose covariates are all zero remains event free beyond time tprobability
Output
lpSum of each Cox coefficient times its covariate value, gamma in Bradburn and colleagueslog hazard ratio, no unit
RSExponential of the linear predictor, the factor by which the profile's hazard exceeds the baseline hazardratio, no unit
h_xHazard at time t for a person with the stated covariate valuesevents per person per unit of time
S_xProbability that a person with the stated covariate values remains event free beyond time tprobability

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.

    View source →

  • 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.

    View source →

  • 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.

    View source →

  • 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.

    View source →

Canonical Identity

This formula 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/formula/hazard-and-survival-of-one-covariate-profile-from-a-cox-baseline-and-linear-predictor

Hazard and survival of one covariate profile from a Cox baseline and linear predictor | HealthEconomics.wiki