Cox’s proportional hazards regression model (also called Cox regression or Cox’s model) builds a survival function which tells you probability a certain event (e.g. death) happens at a particular time t. Once you’ve built the model from observed values, it can then be used to make predictions for new inputs.
The best Cox models are those which include censored data— observations where the event didn’t happen, as well as data from observations where the event actually occurred.
When Should I Use Cox Regression?
Cox’s can analyze multiple risk factors for survival, unlike other methods (e.g. Kaplan-Meier analysis) which can only handle one.
Cox’s regression also tackles the problem of participant heterogeneity. Participant heterogeneity simply means that your participants are different, which could cause issues trying to analyze your data. Ideally, your participants would have similar characteristics (i.e. they would be homogeneous). In real life, however, you rarely find homogeneous samples and Cox’s regression addresses that issue.
Calculating Cox’s Regression
Although it’s popular in survival analysis, Cox regression does have the downside that—compared to other regression methods—it can be difficult to understand. Various technical computations are required, including copious matrix multiplications and inversions. This makes it extremely challenging to calculate by hand, but many statistical packages can handle this particular type of regression.
Step 1: Click Analyze > Survival > Cox Regression.
Step 2: Choose a time variable (the analysis will exclude negative time values).
Step 3: Choose a status variable.
Step 4: Click “Define Event.”
Step 5: Choose your covariates. Optional: select any interacting variables and then click >a*b>.
Coxph (in the survival package) fits data to a Cox model. Syntax is:
coxph(formula, data=, weights, subset,
na.action, init, control,
model=FALSE, x=FALSE, y=TRUE, tt, method, …)
For full explanation of syntax terms, see coxph in the survival package documentation on cran.r-project.org.
Cantor, A. (2003). SAS Survival Analysis Techniques for Medical Research. SAS Institute.
IBM Knowledge Center. Cox Regression Analysis. https://www.ibm.com/support/knowledgecenter/en/SSLVMB_24.0.0/spss/advanced/idh_coxr.html
If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.Comments? Need to post a correction? Please post on our Facebook page.