0
$\begingroup$

I have begun studying survival analysis and am using R packages survival and survminer. Verbal descriptions of statistical concepts can be “sloppy” and I’m trying to understand these concepts using crystal-clear language. I’ve worked through a Cox Proportional Hazards model example using http://www.sthda.com/english/wiki/cox-proportional-hazards-model using univariate Cox regression and the lung cancer data provided in the “lung” dataset of the survival package. I am trying to interpret the coxph() output as illustrated below. Are my interpretations shown below, correct? And as asked below in brackets, how does one tell which variable is used as the baseline and which is the comparison variable? How can you tell from the below coxph() output that it is the female sex variable with the lower hazard rate?

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ Are you sure the sex variable is a factor? Usually the coefficient in the output will be named as e.g. "male" so you know the baseline is female or vice versa. One of the two should be the baseline. Your interpretations are correct, and to your question of whether you can get any more information from the coefficient, the Cox model kind of skips making any statements about the form of the survival function, so the estimates can really only be interpreted as far as effects on the hazard $\endgroup$
    – fmtcs
    Commented Mar 11, 2023 at 9:37
  • 1
    $\begingroup$ I would maybe add to your interpretation that the model makes the constraint of proportional hazards over time, so for example, if the estimate is for being male compared to a female baseline, then males have exp($\beta$) times the hazard of females in general, so at any point in time. This is unless you have time varying effects, which are valid but in which case you can't compare two general individuals anymore as the hazard ratio does not apply across all time $\endgroup$
    – fmtcs
    Commented Mar 11, 2023 at 9:43
  • $\begingroup$ Yes, I'm sure the sex variable is a factor. The ouput image posted is from sthda.com/english/wiki/cox-proportional-hazards-model , but I ran it myself in R and get the same output Call: coxph(formula = Surv(time, status) ~ sex, data = lung) with no indication of which is the baseline set and which is the comparison set. $\endgroup$ Commented Mar 11, 2023 at 9:44
  • 2
    $\begingroup$ I might try lung$sex=ifelse(lung$sex==1,"male","female") and then fit the model again using coxph(formula = Surv(time, status) ~ as.factor(sex), data = lung) (as.factor might not even be needed) and just see what you get $\endgroup$
    – fmtcs
    Commented Mar 11, 2023 at 11:01
  • $\begingroup$ OK that works and as.factor() isn't needed; also, the output row name is a little cleaner without using as.factor(). Note that this makes the female subset the baseline and the male subset presented as the comparison in the output. $\endgroup$ Commented Mar 11, 2023 at 16:19

1 Answer 1

3
$\begingroup$

The interpretation of coefficients depends on how the predictor variables are coded. In this example, with male = 1 and female = 2, the software will assume that the values are numeric.

On that basis, the coefficient for sex will be just what you would have for a continuous numeric predictor variable: the change in log-hazard per unit increase in the "numeric" sex variable. With only 2 possible values of the "numeric" sex variable, that unit increase is for the change from male to female. That's equivalent to having male as the reference level, and the coefficient being the extra log-hazard associated with female.

As comments suggest, you can resolve any ambiguity by explicitly coding sex as a factor. That allows you to choose the reference level. The R default when reporting coefficient values in that case is to append the specific non-reference level to the overall predictor name.

Even in that case, however, you have to be careful. The default "treatment" or "dummy" coding of factors in R is to treat the first level as the reference/baseline. I recall that SPSS (or some other software that I don't use) treats the last level as the reference instead. Also, even within R, you can choose different types of coding for categorical predictors that will affect the interpretation of coefficients.

$\endgroup$
4
  • $\begingroup$ That works, and when running coxph(formula = Surv(time, status) ~ as.factor(sex), data = lung), while leaving the sex variables as numerics, the output correctly specifies that the coefficients et al apply to code = 2 for female; thus, it is made clear that female in this case is the comparison and male the baseline. $\endgroup$ Commented Mar 11, 2023 at 16:27
  • 1
    $\begingroup$ @Village.Idyot for completeness, your interpretations are OK. Be careful with terminology; "univariate" is now typically used to describe a single type of outcome, not a single predictor, with "multivariate" meaning different types of outcomes. I will, however, confess to having used "multivariate" to describe a multiple-predictor model in at least one publication. $\endgroup$
    – EdM
    Commented Mar 11, 2023 at 16:40
  • $\begingroup$ Thanks! Are there terms currently in use for single and multiple predictors, respectively? In lieu of univariate/multivariate I used in my OP? $\endgroup$ Commented Mar 11, 2023 at 16:51
  • $\begingroup$ @Village.Idyot "single-predictor" versus "multiple-predictor" in general or, in the regression context with multiple predictors, "multiple regression." $\endgroup$
    – EdM
    Commented Mar 11, 2023 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.