Menu
numiqo
Statistics made easy

Statistics made easy

8th revised edition (March 2026) - many illustrative examples - only €8.99

Free sample

Cox Regression

Author: Dr. Hannah Volk-Jesussek
Updated:

Load example data Cox Regression

What is Cox Proportional Hazards Survival Regression, or Cox Regression for short? Cox regression is used in survival time analysis to determine the association between different variables and the rate at which an event occurs.

The variables can be any mixture of continuous, binary, or categorical data. The Cox proportional hazards model is semi-parametric: it estimates predictor coefficients without requiring a particular mathematical form for the baseline hazard over time.

Cox regression allows us to estimate the association of multiple predictor variables with a time-to-event outcome, either to test hypotheses about the predictors or to build a predictive model. These associations are not automatically causal effects.

Survival Time Analysis

What is survival analysis? In survival time analysis, the survival times of test subjects are recorded and a survival curve is generated. Usually, the subjects have a particular disease.

The survival curve then shows how many of the subjects remain alive over time. The considered time does not have to have anything to do with the actual "survival time", nevertheless one speaks of the Survival Time and Survival Time Analysis.

Therefore the survival time analysis considers a variable that has a start time and an end time when a certain event occurs.

Survival Time Analysis

The time between the start time and the event is considered in the survival time analysis. This can be measured in days, weeks or months, for example.

Censoring

There is now the problem that a study cannot last indefinitely. This results from limited time and financial resources and from the fact that one would like to publish the results at some point. Therefore, each study has a start date and an end date. If there is no clear event date for a case, it is referred to as "censoring".

Survival Time Analysis Censoring

Several methods have been developed to deal with this issue. You are welcome to have a look at the tutorial on the Kaplan Meier curve.

Cox Regression Example

Let's go back to the Cox regression. For example, if you want to analyze the survival time after the detection of a disease, you are often not interested in the survival time itself, but in what influences the survival time.

So we want to know if the survival time depends on one or more factors, called "predictors" or "independent variables".

For simple situations with a single factor with only two values, the Log Rank Test can be used. For example, you can test whether survival curves differ between people given two different drugs.

If you want to include the age of the subjects, a special type of regression is needed. This is the Proportional Hazards Survival Regression. This regression is then used to estimate the association of each predictor with the hazard while accounting for the other predictors in the model.

Cox Regression example

In our example, we have as predictors, on the one hand, the drug used and, on the other hand, the age of the subjects. We want to know what effect these variables have on the survival time curve. To do this, we use Cox regression.

We will now look at the steps of Cox regression using an example. Let's assume we have the following data and want to analyse it.

Calculate Cox Regression

Each row describes a patient with the corresponding disease. The time indicates when the event occurred or when the observation was censored; the status variable distinguishes these two cases. We also have information about which drug was used and the age of the subjects.

Calculate Cox Regression

Load example data Cox Regression

The first step is to calculate the Cox regression, we will do this online using numiqo, then we will go through how to interpret the results. Please load the data above.

To calculate the Cox Proportional Hazards Survival Regression with your own data, simply go to the Cox Regression Calculator and copy and paste your data into the table as you would in Excel.

Now we click on "Survival Analysis." Depending on which variables you want to select, different methods of survival analysis will be calculated. If you select only the "Time" and the "Status", the Kaplan Meier curve will be displayed.

If you now click on the drug, you will get the log rank test. If you also select the age, the Cox regression will be calculated.

Cox Regression online calculator

Interpreting Cox Regression

The first column contains the names of the variables. The first row shows the variable drug and the second row shows the age of the persons.

Interpreting Cox Regression

The coefficient is the log hazard ratio. Its exponential, Exp(B), is the hazard ratio. A hazard ratio above 1 indicates a higher hazard, a value below 1 indicates a lower hazard, and a value of 1 indicates no difference. Interpret categorical predictors relative to the displayed reference category and metric predictors per one-unit increase.

Report the hazard ratio together with its 95% confidence interval and p-value. A confidence interval containing 1 is compatible with no hazard difference at the corresponding confidence level. The p-value tests the null hypothesis that the coefficient is zero, but it does not describe the size or clinical importance of the association.

In the case of drug, the p-value is less than 0.05, so the drug coefficient differs significantly from zero. Its hazard ratio and confidence interval describe the direction and size of the estimated association.

In the case of age, we obtain a p-value of 0.221, which is greater than 0.05. Therefore, the null hypothesis is not rejected. These data do not provide sufficient evidence that age is associated with the hazard after accounting for the other variables; this does not prove that age has no association.

Proportional hazards diagnostics

Proportional Hazards Assumption: The proportional hazards assumption is the central assumption of Cox regression. It states that the hazard ratio (the ratio of the hazard rates between two groups) remains constant over time. In other words, the effect of the predictor variables on the hazard function is assumed to be constant over time.

numiqo checks this assumption using scaled Schoenfeld residuals. It reports a test for each predictor term and a global test for the model. A small p-value provides evidence that an effect changes over time. A large p-value means that no violation was detected; it does not prove proportionality.

The residual plots should be considered together with the tests. A roughly horizontal pattern supports a time-constant effect, whereas a systematic trend or curvature can indicate that a single hazard ratio is not adequate across follow-up.

Other Cox regression assumptions

Independence Assumption: Cox regression assumes that the survival times of individuals are independent of each other, given the values of the predictor variables. This means that the survival time of one individual should not influence the survival time of another individual.

Linearity Assumption: Cox regression assumes that the relationship between the continuous predictor variables and the log hazard is linear, unless nonlinear terms such as splines are included. This means that a one-unit change has the same multiplicative effect on the hazard across the predictor's range, not that the hazard itself changes linearly.

Multicollinearity: Perfect multicollinearity prevents separate coefficients from being estimated. Strong, but imperfect, relationships among predictors can make estimates unstable and their confidence intervals wide.

Non-informative censoring: Conditional on the variables in the model, censoring should be independent of the unobserved event time. If people at greater event risk are systematically censored earlier for reasons not represented in the model, the estimates may be biased.

Influential observations: Individual observations can have a large effect on the fitted coefficients. Unusual covariate patterns and influential cases should be checked, especially in small samples or sparse categorical groups.

Time-dependent predictors and effects that change over time require an extended Cox model and data arranged appropriately. Tied event times are handled using an approximation such as Efron's method; the chosen method can matter when many events occur at the same recorded time.

The number of observed events, rather than only the total sample size, limits how many predictor terms can be estimated reliably. Sparse data or too many terms can produce unstable estimates, so confidence intervals and the model's overall test should be considered alongside individual p-values. Interactions and important confounders must be specified explicitly; adjustment does not by itself establish causality.

For prediction, the coefficients alone are not enough: absolute survival probabilities also depend on the estimated baseline survival function. Predictive performance and calibration should be checked on new data, especially when predictions extend beyond the follow-up times or predictor ranges used to fit the model.

Cox regression and competing risks

When another event prevents the event of interest, an ordinary Cox model and a Fine-Gray model answer different questions. A cause-specific Cox model concerns the instantaneous hazard among people who remain event-free. Fine-Gray regression concerns the cumulative incidence of the event of interest through the subdistribution hazard.

See the competing risks analysis tutorial when your status variable contains mutually exclusive event types.

The Cox calculations and proportional hazards diagnostics in numiqo are covered by automated numerical comparisons with reference output from R's survival package, including cox.zph results for tied event times.


Statistics made easy

  • many illustrative examples
  • ideal for exams and theses
  • statistics made easy on 464 pages
  • 8th revised edition (March 2026)

Only €8.99

Free sample
numiqo

"Super simple written"

"It could not be simpler"

"So many helpful examples"

Cite numiqo: numiqo Team (2026). numiqo: Online Statistics Calculator. numiqo e.U. Graz, Austria. URL https://numiqo.com