# How Does Cox Proportional Hazard Model Describe Interaction between Covariates

I have read STDHA and the documentation for the coxph() function in R. I understand that the cox PH model explores how different covariates simultaneously impact survival. Based on the Lung data example in STDHA, a covariate can seem significantly influential in univariate analysis, but not in multivariate analysis. Following the lung data example, "age" is no longer significant in the multivariate cox model. Quite literally, this means that age does not impact survival when you account for sex and ph.ecog. However, how does the cox PH model evaluate and decide this? Under the hood, does the cox ph model stratify groups by sex, then evaluate if age is still impactful on survival (and then repeat for ph.ecog)? My intuition says no, because I don't think you can do that with continuous variables (so, in turn, how would the model stratify by age and then test if sex still impacts survival)? I don't need a deeply mathematical explanation, as I'm just a coder!

Ultimately, I want to understand if I can run coxph() on the female and male group separately, or if these results would be redundant since we have already added "sex" as a covariate when analyzing all patients.

This is a conceptual question, but please let me know if I can provide any code. If it means anything, I am using surv & survminer in R.

The simple answer is that Cox PH is a flavor of multiple regression. Multiple regression does indeed try to subtract off the estimated effect of each covariate and look for associations of all other independent variables. Whether this works well in practice is anyone's guess. For a somewhat philosophical high-level discussion see here.

One notable issue is that "significant" is not necessarily a great way to think about statistics, according to professional statistical societies. So, like, if a p-value goes up or down a little bit that's kind of expected when you adjust for other variables, it's not really notable. For one thing, it's closely related to questions of power, driven largely by your sample size.

In simple terms, I would urge you to put all of your data in the model, find some set of independent variables and covariates that you think makes sense before you start analyzing the data, and then build your model accordingly. I don't think that anyone objects to e.g. plotting raw data or model residuals separately in males and females to demonstrate some point, but most associations that are worth caring about will be obvious in a combined dataset.

You can try to explicitly test for an interaction effect in the model. This can be interesting if there's some reason to expect it to be the case, or if there is very compelling evidence that there exists some interaction, but it has the negative of adding to model complexity and further reducing power.

"Under the hood" a Cox model doesn't stratify, consistent with your intuition. It iteratively solves a partial-likelihood vector score function as a function of regression-coefficient values.

It tries to minimize the sum, over all event times, of the difference between each covariate value for the case having the event and a risk-weighted average of the values for all at risk at that event time. The "risk-weighting" is a function of all current regression-coefficient estimates within an iteration. Iteration continues until regression-coefficient estimates are effectively constant. This nicely handles predictors of all types you might use in a multiple-regression model, including interaction terms, while also allowing for individuals that drop out of the study before experiencing the event.

There thus is nothing to be gained by doing separate models for different groups, as Maximilian Press also says in another answer. Stratified models are often used if the proportional hazards assumption doesn't hold, but those model all the data together and often are structured to provide the same regression-coefficient estimates for all strata while allowing for different baseline survival curves among strata.

I also recommend including as many predictors as possible that you might expect to be associated with outcome in your model, but with one caveat. You risk overfitting if you have fewer than 10-20 events per unpenalized predictor in your model (including levels beyond the first of categorical predictors and any interaction or nonlinear terms). So you might have to make some careful choices or use a penalized approach like ridge regression.

For further information, there are nearly 900 answered questions about Cox models on the Cross Validated site.