2
$\begingroup$

Suppose a logistic regression model has three binary explanatory variables $x_1$, $x_2$ and $x_3$ used to estimate the probability of success. This model includes all three main effects, the three $2$- way interactions, and the one $3$-way interaction.

Derive the odds ratio to examine the odds of a success across two levels of one of the explanatory variables, say $x_1$, and derive its variance.

I assume you start by:

$\log(\frac{\pi}{1-\pi}) = \beta_1x_1 + \beta_2x_2 + \beta_3x_3 +\beta_4x_1x_2 + \beta_5x_1x_3 + \beta_6x_2x_3 + \beta_7x_1x_2x_3$

and then taking exponetials on both sides:

$\frac{\pi}{1-\pi} = e^{\beta_1x_1 + \beta_2x_2 + \beta_3x_3 +\beta_4x_1x_2 + \beta_5x_1x_3 + \beta_6x_2x_3 + \beta_7x_1x_2x_3}$

However I am not sure how to proceed.

$\endgroup$
0
$\begingroup$

Think of odds ratio as, keeping all else constant what difference does change by 1 in this variable do.

If you want to find the odds ratio between x1 = 0 and x1 = 1, you can simply keep all other variables in their base cases and find the ratio between expected odds when x1= 0 and x1 = 1

from the step

$\frac{\pi}{1-\pi} = e^{\beta_1x_1 + \beta_2x_2 + \beta_3x_3 +\beta_4x_1x_2 + \beta_5x_1x_3 + \beta_6x_2x_3 + \beta_7x_1x_2x_3}$

set $x_2$ = E($x_2$) and $x_3$ = E($x_3$). When $x_1$ = 1 you have

$\frac{\pi}{1-\pi} = e^{\beta_1 + \beta_2E(x_2) + \beta_3E(x_3) +\beta_4E(x_2) + \beta_5E(x_3) + \beta_6E(x_2)E(x_3) + \beta_7E(x_2)E(x_3)}$

when $x_1$ = 0

$\frac{\pi}{1-\pi} = e^{\beta_2E(x_2) + \beta_3E(x_3) + \beta_6E(x_2)E(x_3) }$

dividing the two, you get

odds ratio = $ e^{\beta_1 + \beta_4E(x_2) + \beta_5E(x_3) + \beta_7E(x_2)E(x_3) }$

As you can see, all the terms that don't contain the variable x1 simplifies.

In almost all statistical software, the odd ratio is calculated using the "base case", i.e. when all other explanatory variables are 0. This means plugging 0 to E($x_i$) It yields to a much faster runtime and a nicer looking formula of:

odds ratio = $e^{(β_1)}$

Keep in mind, this also ignores the interaction between variables.

For the variance, you can derive it from the final equation using the variance of the coefficients

Hope it helps

Edit: edited for latex

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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