# Converting a Continuous variable to categorical for Cox regression

In a Cox regression model where our variable of interest is continuous (e.g., a lab measurement);

If we want to obtain something other than a unit risk ratio for that variable (e.g., the hazard ratio of mortality among people who are in Quartile 4 (>75 percentile) vs Quartile 1 (< 25 percentile) for the lab measurement based on distribution of the measurements in our cohort), what would be the best way to integrate this variable into our model?

Would it be okay to create another column in our data which would indicate the quartile that person falls into and subsequently add that to the model?

Or is it better to run the model by keeping the variable as continuous, and then use the beta coefficient we find to calculate the hazard ratio by subtracting median values of different quartiles, multiplying them by the beta and exponentiation?

• What do you mean by "subtracting median values of different quartiles"? – Michael M Apr 2 '18 at 6:38
• I meant if the median for the lab measurement in Quartile 4 is a and median in Quartile 1 is b, then I would calculate the hazard ratio for Quartile 4 (Quartile 1 : reference group) as exp(beta * (a-b)). I'm not sure if this would be the correct way of doing it. – Ozan Dikilitas Apr 2 '18 at 14:07
• @OzanDikilitas Yes that would be the correct way to obtain that value from a continuous covariate. The important thing--what I sensed in your question and what I based my answer on--is for modeling an exposure not to go about slicing it into arbitrary cutpoints if it is not a hypothesis driven approach. – AdamO Apr 6 '18 at 14:35

If your variable of interest is continuous, you almost always lose information by splitting the variable into a categorical effect. The way you lose information is: choosing cutpoints based on the data rather than hypotheses, not borrowing information across adjacent groups, spending more degrees of freedom. Adjusting for the continuous effect is better in all these respects. This is a general modeling principle that has been recommended in linear, logistic, Cox, and other models.

The interpretation of a continuous variable in a Cox model is: a hazard ratio comparing groups differing by one unit in the variable. The interpretation you give in the second paragraph is the wrong interpretation unless that variable is scaled by it's range * 1.5. I would not recommend doing this. Dividing by range makes the effect a unitless quantity. Laboratory experts who interpret your analyses will be keenly interested to know the scale of effect, because they can well interpret the units, whether they are mmol/dL, mmHg, mg/kg or some other, contextualizing factor.

• But what if the linearity assumption is violated ? Shouldn't a continuous variable be splited into categorical then ? But how to choose cutpoints remains a real problem. – Dan Chaltiel Aug 13 '18 at 14:32
• @DanChaltiel In linear models (Cox/Logistic/Linear), the beta-coefficient is consistent and converges to a weighted average of the piecewise-linear trends. The standard errors may be incorrect. Using robust GEE error estimates will correct the CIs, SEs, and p-values. DOI: 10.2307/2336212 – AdamO Aug 13 '18 at 15:44