# Calculating the Hazard Ratio for a Cox-regression model stratified by a variable (R)

I have built a Cox-regression model for 6 month mortality. When I created the original Kaplan–Meier curve, grouped by my variable of interest (hospital-acquired infection, Present vs Absent) the lines crossed – suggesting non-proportionality if used in a Cox regression model [subsequently confirmed via Schoenfeld residuals).

Therefore, I created a stratified Cox-regression model (adjusted for age):

coxph(Surv(Time, Status) ~ age + strata(HAI), data = survival)

The resultant summary of the above function, provides only co-efficients for age.

However, the co-efficient (and hence hazard ratio) I am interested in is for the stratified variable.

I appreciate stratification gives different baseline hazard ratios, but is there a way to generate a given HR for HAI?

Cross Validated Asked by FrenchToast on November 14, 2021

In general one cannot stratify by a variable and report its effect.

Consider trying the restricted mean survival time, which can handle situations where the proportional hazards assumption does not hold. Obtaining adjusted measures using this method is complicated, but possible.

Answered by Todd D on November 14, 2021

If there aren't proportional hazards then no single hazard ratio adequately summarizes the results. The hazard ratio between the two groups is changing with time.

A vignette for the R survival package on time-dependent survival models covers both time-dependent covariates and how to deal with time-dependent coefficients/hazard ratios. Start there for ideas about handling specific time periods differently (which might have a reasonable rationale for HAI) or developing a function of time informed by the changes in scaled Schoenfeld residuals over time.

A couple more notes. For one, it's possible that some of your problem might be coming from important predictors that aren't included in your model. I suspect that there are many variables besides age and HAI that contribute to mortality. You often want to include as many predictor variables as possible as you can in a Cox model without overfitting the data. Also, there's a little ambiguity in the way you phrased the question: you do a Cox regression but speak of "6-month mortality," which sounds more like a logistic regression. Does that mean simply that you didn't collect data longer than 6 months from study entry for an individual (however you defined the study entry time)?

Answered by EdM on November 14, 2021

## Related Questions

### Eacf table interpretation in R

2  Asked on December 8, 2020

### log-odds and it’s standard error as priors in logistic regression

1  Asked on December 8, 2020 by r_user

### What is the difference between $beta_1$ and $hat{beta}_1$?

3  Asked on December 8, 2020 by stan-shunpike

### Interpret credible intervals / HPD following posterior sampling

1  Asked on December 8, 2020 by walterb

### Why GEE estimates are smaller than GLMM?

1  Asked on December 7, 2020

### Help with the prior distribution

1  Asked on December 7, 2020 by dom-jo

### Conservative confidence interval for linear combination of parameters

0  Asked on December 7, 2020

### Neural network based on twitter followers, what would be my features?

5  Asked on December 6, 2020 by sharki

### Check if residuals are IID (timeseries)

4  Asked on December 5, 2020 by mgr

### How to split dataset for time-series prediction?

5  Asked on December 4, 2020 by tobip

### What are some existing techniques for pose estimation angle normalization?

1  Asked on December 4, 2020 by tbizzy0808

### ARIMA model with multiple covariates, XREG

1  Asked on December 3, 2020 by bromideh

### Measure of rater agreements for rank order?

1  Asked on December 3, 2020 by cdalitz

### Which distribution to use in the following scenario?

1  Asked on December 3, 2020 by arindam-bose

### Comparing a random sample and a non random sample extracted from a finite population

1  Asked on December 1, 2020 by alessandro-jacopson

### Logistic Regression cost function for joint optimization based on relevance and profit

0  Asked on December 1, 2020 by marsellus-wallace

### Calculate R² from regression estimates (beta coefficients, variances of variables etc.)

0  Asked on December 1, 2020 by phx

### ARIMA(0,0,0) model but residuals not white noise

0  Asked on November 30, 2020 by mathias-schinnerup-hejberg

### How do we come up with the SVM Kernel giving $n+dchoose d$ feature space?

1  Asked on November 30, 2020 by shiladitya-basu

### Conditional Multivariate Gaussian Identity

1  Asked on November 29, 2020 by statian

### Ask a Question

Get help from others!