LearnCox Regression: Survival Analysis with Covariates
Advanced10 min readSource-backed

Cox Regression: Survival Analysis with Covariates

Learn how the Cox proportional hazards model extends Kaplan-Meier analysis to multiple covariates, how to interpret hazard ratios, and how to check the proportional hazards assumption.

You'll learn

How to model time-to-event outcomes with multiple covariates and correctly interpret hazard ratios.

Use this when

You need to adjust a survival analysis for confounders or model multiple predictors simultaneously.

Try this in VibeResearch

Why Cox Regression?

Kaplan-Meier curves compare survival between groups defined by a single variable. Cox regression allows you to model survival while adjusting for multiple covariates simultaneously — age, sex, disease severity, and treatment group at the same time.

📖 The hazard function

The hazard h(t) is the instantaneous rate at which events occur at time t, given survival up to that point. Cox regression models the log of this hazard as a linear function of covariates: log h(t) = log h₀(t) + β₁X₁ + β₂X₂ + ... The baseline hazard h₀(t) is left unspecified — this is why Cox regression is called a semiparametric model.

Interpreting the Hazard Ratio

The hazard ratio (HR) is the exponent of the Cox regression coefficient: HR = e^β. It represents the ratio of hazard rates between two groups, holding all other covariates constant.

HR valueInterpretation
HR = 1.0No difference in hazard between groups
HR = 0.60Treatment group has 40% lower hazard than reference at any given moment
HR = 2.30Exposed group has 2.3× higher hazard than unexposed — 130% increased hazard
HR = 0.75 (95% CI: 0.55–1.02)Borderline — CI crosses 1, not statistically significant at α=0.05

⚠️ HR is NOT a risk ratio

The hazard ratio is often colloquially described as a "relative risk," but this is imprecise. The HR is a ratio of instantaneous rates at any moment in time, not the ratio of cumulative risks over the follow-up period. For rare events with short follow-up they are approximately equal, but for common events or long follow-up they diverge.

The Proportional Hazards Assumption

Cox regression assumes that the hazard ratio between groups is constant over time — the hazard curves never cross. This is called the proportional hazards (PH) assumption and must be checked before trusting your results.

  • Graphical check: plot log(−log(survival)) vs log(time) for each group — parallel lines support PH
  • Scaled Schoenfeld residuals: these should show no trend over time; a significant trend indicates PH violation
  • Statistical test: cox.zph() in R tests PH for each covariate
  • If PH is violated: consider stratified Cox model, time-varying coefficients, or restricted mean survival time (RMST)

💡 Crossing KM curves always violate PH

If Kaplan-Meier curves for two groups cross, the hazard ratio is not constant over time — PH is violated. Do not proceed with a standard Cox model in this situation.

Reporting Cox Regression Results

For every covariate in the model, report: the unadjusted HR, the adjusted HR, and the 95% CI. Clearly state which variables were included in the final model and why.

  1. 1.Report unadjusted (univariable) and adjusted (multivariable) HRs separately
  2. 2.State which confounders were included and whether selection was a priori or data-driven
  3. 3.Report the number of events and total follow-up time
  4. 4.State whether the PH assumption was checked and whether it was satisfied
  5. 5.Report the concordance index (C-statistic) as a measure of model discrimination

Practice with your own dataset

Fit a Cox proportional hazards model with multiple covariates.

Required variables

  • Time variable
  • Event indicator (0/1)
  • One or more covariate variables
  1. 1.Upload a dataset with time, event (0/1), and covariate variables
  2. 2.Select Analyze → Cox Regression
  3. 3.Specify time variable, event variable, and covariates
  4. 4.Review the hazard ratios, 95% CIs, and p-values for each covariate
  5. 5.Check the log-minus-log plot for proportional hazards assumption

Read next

Survival Analysis

Analyze time-to-event data using Kaplan-Meier curves, the log-rank test, and Cox proportional hazards regression — essential methods for clinical and epidemiological research.

Advanced12 min read
Read next