Math calculator

Cox Regression Calculator

Hazard over time.

Hazard over time

A hundred and eighty subjects, a hundred and seventeen events. Treatment has a hazard ratio of 0.4602 (95% CI 0.315 to 0.673, p = 0.000061) and age 1.0238 per year (1.006 to 1.042, p = 0.0087). The likelihood ratio against the null model is 19.955 on 2 degrees of freedom, and the concordance is 0.6320. The part that makes those numbers usable is the Schoenfeld test: p = 0.2899 for treatment and 0.7437 for age, with a global p of 0.5414. Proportional hazards holds, so the hazard ratios mean what they appear to mean.

180 subjects · 117 events · 63 censored · 58.5 events per covariate

Likelihood ratio 19.955 on 2 df, p = 4.643e-5

The concordance is 0.6320 and the global Schoenfeld test gives p = 0.5414, so proportional hazards holds and the ratios below mean what they appear to mean.

Global PH test

0.5414

the assumption holds

Concordance

0.6320

pairs ordered correctly

Events per covariate

58.5

comfortable

Likelihood ratio

19.955

p = 4.64e-5

Hazard ratios, with the assumption tested

Each covariate with its hazard ratio, interval, p-value and proportional-hazards test
CovariateHazard ratio95% intervalpSchoenfeld ρPH pVerdict
treatment0.46020.315 to 0.6736.08e-50.09740.2899constant over time
age1.02381.006 to 1.0420.0087-0.03020.7437constant over time

The Schoenfeld correlation is between that covariate’s residuals and the order of the event times. A significant value means the hazard ratio is not one number — it is drifting, and the single figure to its left is an average over a quantity that moves.

The model is fitted by Newton-Raphson on Breslow’s partial likelihood, converging in 4 iterations. There are 2 tied events in this data; Breslow’s handling of ties is the simplest of the three standard options and is slightly biased towards zero when ties are numerous.

A Cox model says nothing about the baseline hazard, so it cannot produce a survival probability on its own. It gives ratios, not risks — and a hazard ratio is not a risk ratio: it compares instantaneous rates among those still at risk, which is a different population at every moment.

Assumption tested Partial likelihood Concordance reported Ratios, not risks

What this tool shows

On the second preset the model reports a hazard ratio of 0.8624, an interval of 0.692 to 1.075 and p = 0.1887 — no significant difference. The Schoenfeld residual test on the same fit gives p = 0.0000000000000131. The hazards cross: the treated group fails faster early and far more slowly later, and the ratio averaged those two opposing periods into something near 1. The concordance is 0.4641, below chance. That is why the assumption test runs on every fit here rather than being an optional extra.

  • Cox proportional hazards by Newton-Raphson on the partial likelihood, with hazard ratios and Wald intervals
  • The Schoenfeld residual test for every covariate, plus a global test, computed on every fit
  • Harrell’s concordance, which says whether the model orders subjects better than chance
  • A likelihood ratio test against the null model, and events per covariate
  • A preset where the assumption holds and one where it fails decisively on a confident-looking result
  • Why a hazard ratio is not a risk ratio and cannot produce a survival probability on its own
Assumption tested Partial likelihood Concordance reported Ratios, not risks

A hazard ratio is an average over the whole follow-up.

Updated 13 September 2026 · Works in any browser, no installation

Cox regression models how covariates multiply the instantaneous rate of an event, without ever specifying what that rate is. That is its strength and the source of its one fragile assumption: the multiplier has to be the same at every moment of follow-up. When it is not — when a treatment harms early and helps later — the fitted hazard ratio is an average of opposing effects, and it can land near 1 while the survival curves are nothing alike.

At a glance

Formula shown
h(t | x) = h₀(t)·exp(β₁x₁ + … + βₖxₖ). The baseline h₀(t) cancels out of the partial likelihood ∏ exp(βᵀxᵢ) / Σ_{j at risk} exp(βᵀxⱼ), taken over the event times, so β is estimated without ever modelling it. exp(βⱼ) is the hazard ratio per unit of xⱼ. The Schoenfeld residual at each event is the covariate value minus the risk-set weighted mean; correlating those with time tests whether the ratio is constant.
Scenario support
Comparing survival between groups while adjusting for covariates, estimating the effect of a continuous predictor on time to an event, checking whether a published hazard ratio rests on an assumption that holds, and screening a dataset before a more elaborate survival model.
Educational estimate
Planning support from the values you enter — not professional advice.

When the hazard ratio describes nothing

The second preset produces the result a paper would report as negative, on data where the two groups could hardly differ more.

Hazard ratio 0.8624, interval 0.692 to 1.075, p = 0.1887. Read on its own, that is “no evidence of an effect”.

The Schoenfeld test gives p = 0.0000000000000131. The ratio is not constant; it reverses during the follow-up.

The concordance is 0.4641, below chance. The risk score orders subjects slightly worse than a coin flip, which is what averaging a reversal produces.

The fix is not a bigger sample. It is to stop reporting one number — split the follow-up into periods, or use a measure that does not assume proportionality, such as the restricted mean survival time on the Kaplan-Meier page.

What the residual test is actually doing

The test is simpler than its reputation, and understanding it makes the output readable rather than oracular.

At each event, compare the covariate of the subject who failed against the weighted average among those still at risk. That difference is the Schoenfeld residual.

Under proportional hazards those residuals have no relationship with time. The model is equally right early and late.

So correlating them with the order of the event times is the test. On the first preset that correlation is 0.0974 for treatment, p = 0.2899 — nothing.

On the second it is −0.3836. A clear drift, meaning the effect early in follow-up is not the effect later, and the sign says which way.

A hazard ratio is not a risk ratio

The two get used interchangeably and they are different quantities, computed over different populations.

A risk ratio compares the proportion who have the event by some time. A fixed denominator, everyone included.

A hazard ratio compares instantaneous rates among those still at risk. The denominator shrinks, and shrinks differently in each group.

So a constant hazard ratio implies a risk ratio that moves. A hazard ratio of 0.5 corresponds to risk ratios that drift towards 1 as events accumulate.

And it cannot produce a survival probability at all, because the baseline hazard cancels out of the likelihood. The model gives ratios and the curve has to come from somewhere else.

Events per covariate, not subjects

Sample size for a Cox model is measured in events, and the distinction matters more here than almost anywhere.

A thousand subjects with twelve events supports about one covariate. The censored subjects contribute to the risk sets and almost nothing to the estimate.

Ten events per covariate is the conventional floor, and the page reports the ratio rather than the sample size for that reason.

Below it the coefficients are unstable and the intervals unusable, in the same way they are for a logistic model with too few events.

Which is also why the study-design question is about events: the number needed is a function of the hazard ratio alone, and the sample-size page computes it.

Tied event times are a modelling choice

The partial likelihood assumes a strict ordering of event times, and real data rarely supplies one.

Times recorded in whole days or months produce ties by construction. The second preset has forty-three of them.

Breslow’s approximation is used here, which treats tied events as if they occurred in any order within the same risk set.

It biases coefficients slightly towards zero when ties are numerous. Efron’s approximation is more accurate and is the default in most packages.

The count is printed for that reason. With few ties the choice is immaterial; with many, expect a modest difference from a package using Efron, in the conservative direction.

Concordance measures something the p-value does not

A significant hazard ratio says an effect exists. Concordance says whether the model can tell two subjects apart.

It is the share of comparable pairs the risk score orders correctly. The survival analogue of an area under the ROC curve.

0.5 is chance and 1 is perfect ordering. Values above 0.7 are strong for survival data, where much of the variation is irreducible.

A single binary covariate caps it well below 1, because every pair sharing that covariate is a coin flip — the first preset reaches 0.6320 with a hazard ratio of 0.46.

And below 0.5 means the model orders worse than chance, which the second preset manages at 0.4641 — a second signal, independent of the Schoenfeld test, that the fitted ratio is not describing the data.

Reporting a Cox model

Four items, and the second is the one whose absence makes a hazard ratio uninterpretable.

Give the number of events, not just the sample size. It determines whether the coefficients are estimable at all.

Give the proportional-hazards test. A hazard ratio without it is a number whose meaning has not been checked.

Give the concordance. Significance and discrimination are different things, and a model can have one without the other.

And say which tie-handling method was used when ties are common, since Breslow and Efron differ and the difference is systematic.

Sources and methodology

References for the model and its diagnostics.

Method. The model is fitted by Newton-Raphson on Breslow’s partial likelihood, with the risk sets accumulated backwards through the sorted event times so the fit is linear rather than quadratic in the sample size. The Schoenfeld residual test is computed for every covariate on every fit — not offered as an option — because a hazard ratio from a model whose hazards cross is an average of opposing effects. The verification suite checks the fit against simulated data with a known hazard ratio, requiring recovery inside the reported interval on at least seven of eight samples of six hundred subjects, and separately checks the assumption test at both extremes: it must stay quiet on proportional hazards in at least seventeen of twenty samples and fire on crossing hazards in at least eighteen. It also asserts the identity that the fitted log-likelihood never falls below the null, which checks the risk-set accumulation. That engine is verified on every change against 128 assertions. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Kaplan-MeierSurvival with censoring handled, and the naive count printed beside it: five events in twenty subjects give 25.0000% by the plain count and a 30.1202% cumulative incidence by Kaplan-Meier.
Survival Sample SizeSchoenfeld's event requirement converted to an enrolment target, with the sensitivity to the hazard ratio and the power achieved at every event count.
Competing RisksAalen-Johansen cumulative incidence with the naive 1 − Kaplan-Meier beside it for every cause, and the probability identity printed as a check on both.
Log-Rank TestObserved minus expected accumulated at every event time, so the crossing-hazards blind spot is visible: a running total that peaks at +3.2652 and ends at -1.4717 gives p = 0.458065.
Hazard RatioBoth standard formulas from one log-rank output — Peto one-step 3.1899 and O/E 2.6554 — with a note on which of them is guaranteed to agree with the p-value beside it.
Logistic RegressionLogistic regression with odds ratios converted to risk ratios at your own event rate, a likelihood ratio test, AUC, and separation reported rather than hidden.

More in Math, or browse all calculators.

Educational use disclaimer

An educational tool. A hazard ratio is an average over the whole follow-up and is meaningless when the hazards cross — the Schoenfeld test on this page is what detects that, and it can reject decisively on a fit whose hazard ratio looks confidently null. Ties are handled by Breslow’s approximation, which biases coefficients slightly towards zero when ties are numerous.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (5 updates)

Published 13 September 2026

  1. Published proportional hazards by Newton-Raphson on the partial likelihood.
  2. Computed the Schoenfeld residual test for every covariate on every fit, not as an option.
  3. Shipped a preset where the hazard ratio looks null and the assumption test rejects at 1.3e-14.
  4. Added Harrell concordance, which falls below chance on that preset.
  5. Stated that a hazard ratio is not a risk ratio and cannot produce a survival probability.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.