# 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?

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)?

• Thank you. 1. I had included four other variable in my actual model, simplified it for purposes of posting. 2. Yes, data was collected up to 6-months for each patient (from admission to six-months). I have read about using logistic regression for dichotomous outcomes i.e. death at 6-months (1=alive, 0=dead), however, there will be some right-censored data in the dataset which I believe makes logistic regression invalid? Jul 22, 2020 at 8:36
• @FrenchToast it depends on what "right-censored" means here. Complete follow-up on all cases out to 6 months is OK with logistic regression; the question is yes/no about death before 6 months. You lose information about times to death but the PH problem goes away. Loss to follow up (other than death) before 6 months would be considered censoring in survival analysis. For logistic regression, however, it could be missing-outcome data amenable to analysis with multiple imputation.
– EdM
Jul 22, 2020 at 15:29

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.