4
$\begingroup$

I will start that I am not as math oriented as I would like to and could use a layman's / non-staticians explanation walk through of how to calculate the log odds.

I am reading Hosmer, Lemeshow, and Sturdivant's Appliged Logistical Regression which is helpful, but I could use a primer / tutorial to help solidify the concepts for me.

Given something like the following equation (values randomly chosen): $$ \log\bigg(\frac \pi {(1-\pi)}\bigg) = 0.3211 + 0.27 X_1 + 0.732 X_2 $$ And the following information:

  • Indicator Variable Group A $X_2 = 1$, Group B $X_2 = 0$.
  • Sample Size 1000
  • Likelihood Value for Model = 0.0598

How would I compute the following from the above information manually without using R or another application.

  1. Log Odds for $X_1 = 3$ for each group.
  2. Odds for $X_1 = 3$ for each group.
  3. Probability $X_1 = 3$ for each group.

If I understand correctly the Log Odds is the $\ln(p/(1-p))$ and log-odds and odds are different; but I am NOT clear on how to apply the above information to calculate the above information and am looking for a step-by-step walk through that covers most of the steps required of how to apply this information and perform the calculation.

Note: While I am utilizing this to assist me in a class it is not part of an assignment or test and the equation is made up by me purely for example purposes as I feel I am in need of a starting point example as I've spent some time reading the book (particularly chapter 3) but it is not clicking like I need it to.

$\endgroup$
1

1 Answer 1

7
$\begingroup$

You are right that the "$\ln(p/(1−p))$" is the log odds. That means all you have to do to calculate the log odds is plug in the values you want for your $X$'s and do the arithmetic. Here is the calculation for #1:
\begin{align} \text{log odds}(X_1 = 3; A) &= 0.3211 + 0.27\times X_1 + 0.732\times X_2 \\ &= 0.3211 + 0.27\times 3\ \ \ + 0.732\times 1 \\ &= 0.3211 + 0.81\quad\quad\ \ + 0.732 \\ &= 1.8631 \\ \ \\ \text{log odds}(X_1 = 3; B) &= 0.3211 + 0.27\times X_1 + 0.732\times X_2 \\ &= 0.3211 + 0.27\times 3\ \ \ + 0.732\times 0 \\ &= 0.3211 + 0.81 \\ &= 1.1311 \\ \end{align} To get the odds from the log odds, you exponentiate the log odds. That means you raise the special number e ($\approx 2.718281828$) to the power of the log odds. Here is the calculation for #2:
\begin{align} \text{odds}(X_1 = 3; A) &= e^{1.8631} \\ &= 6.443681 \\ \ \\ \text{odds}(X_1 = 3; B) &= e^{1.1311} \\ &= 3.099064 \end{align} (Full disclosure: I used R to do the arithmetic on that one.)

To get the probability, you divide the odds by the quantity odds plus one. Here is the calculation for #3:
\begin{align} \text{probability}(X_1 = 3; A) &= \frac{6.443681}{6.443681 + 1} \\ \ \\ &= 0.8656579 \\ \ \\ \text{probability}(X_1 = 3; B) &= \frac{3.099064}{3.099064 + 1} \\ \ \\ &= 0.7560419 \end{align} (I used R for this one, too.)

$\endgroup$
2
  • $\begingroup$ OK, thanks I think this is EXACTLY what I was looking for, though I would appreciate one clarification, is the sample size and likelihood value not utilized at all in the calculations? This is one of the things I got hung up on not being able to place how it is relevant or utilized and just want to be clear on that point. Thanks, I will be sure to mark as answer too! $\endgroup$
    – CRSouser
    Commented Nov 7, 2014 at 22:42
  • $\begingroup$ @CRSouser, no you don't need to use the sample size or likelihood value in these calculations. $\endgroup$ Commented Nov 7, 2014 at 23:26

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.