Coefficients and Categorical Variables

Suppose that a categorical variable $X$ can take three values: $0$,$1$ or $2$. If we run a Cox proportional hazards model and get an estimate of $\beta_1$, how would we interpret this? So we get:

$$\log[\text{HR}]= \log[h_{0}(t)]+ \beta_{1}X$$

Would $\exp(\beta_1)$ give the hazard ratio between $X=2$ vs $X=1$? It would also give the hazard ratio between $X=1$ vs. $X=0$?

Would $\exp(2 \beta_1)$ give the hazard ratio between $X=2$ vs $X=0$?

• If you treated your variable as continuous, yes, that would be the interpretation. However, categorical variables with more than 2 categories aren't modeled with a single covariate, but generally $n-1$ variables. – Affine Mar 10 '14 at 14:30
• In this case you'd have 2 variables that cover for the 3 possible values of $X$. I can't find an explanation of the coding of categorical variables in regression on this site, so I'll link this. Generally dummy coding tends to be the most common, so you'd have $\beta_1$ comparing $X=1$ to $X=0$ and $\beta_2$ comparing $X=2$ to $X=0$ – Affine Mar 10 '14 at 14:35