2
$\begingroup$

If you have a categorical variable with $k$ levels (so $k-1$ indicator variables), is there an easy way to calculate the odds ratio? Suppose the first level is the reference level. The model would be $$ \frac{p(x_{2},\dots, x_{k-1})}{1-p(x_{2}, \dots, x_{k-1})} = \text{exp}(b_0+b_{2}x_2 + \dots + b_{k-1}x_{k-1})$$

So if we want to compare the odds between two groups, just plug into the RHS and divide? For example, comparing the odds between $x_2$ and the reference: $\exp(b_0+b_2)$ and $\exp(b_0)$ are the odds? So then just divide them to get the odds ratio?

$\endgroup$
1
  • 1
    $\begingroup$ Please, don't forget to register your account. It's already your 5th question, and it will prove helpful for tracking responses to your questions (you'll get system notification, etc.), and voting. Also, remember to accept responses when you feel they are appropriate. $\endgroup$
    – chl
    Commented Nov 7, 2011 at 17:56

1 Answer 1

2
$\begingroup$

The odds ratio between level $j$ and the reference level is just $e^{b_j}$ since

$$ \frac{e^{b_0+b_j}}{e^{b_0}} = e^{b_j} $$

thus the odds ratio between levels $j$ and $k$ is

$$ \frac{e^{b_0+b_j}}{e^{b_0+b_k}} = e^{b_j-b_k} $$

$\endgroup$
3
  • $\begingroup$ Does it matter whether you take the reciprocal of the odds ratio? In other words, does it matter what the numerator or denominator is? Could we instead have $\frac{e^{b_0}}{e^{b_{0}+b_{j}}}$ and $e^{b_{k}-b_{j}}$? $\endgroup$
    – James
    Commented Nov 8, 2011 at 18:54
  • $\begingroup$ No, it doesn't matter, but you have to be sure to specify when you report the number that you get (since it will be different) which direction the ratio represents. In other words for the above you would say the odds ratio of $b_j$ with respect to $b_k$ is 0.5 or something like that. Or something like $b_j$ is half as likely as $b_k$. If you flipped it you'd have an OR of 2 and would say that $b_k$ is twice as likely as $b_j$. $\endgroup$ Commented Nov 9, 2011 at 17:57
  • $\begingroup$ How would you interpreat this $\frac{e^{b_0+b_j}}{e^{b_0+b_k}} = e^{b_j-b_k}$ difference of odd ratios? $\endgroup$
    – Mario GS
    Commented Jan 20, 2023 at 20:47

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.