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):
$$
logbigg(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.
- Log Odds for $X_1 = 3$ for each group.
- Odds for $X_1 = 3$ for each group.
- 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.
Best Answer
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.27times X_1 + 0.732times X_2 \ &= 0.3211 + 0.27times 3 + 0.732times 1 \ &= 0.3211 + 0.81quadquad + 0.732 \ &= 1.8631 \ \ text{log odds}(X_1 = 3; B) &= 0.3211 + 0.27times X_1 + 0.732times X_2 \ &= 0.3211 + 0.27times 3 + 0.732times 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.)
Similar Posts:
- Solved – Looking for a layman’s explanation of how to manually calculate log odds
- Solved – Looking for a layman’s explanation of how to manually calculate log odds
- Solved – Connection between Hazard Ratios, Survival, and Probability
- Solved – P(A|B) and P(A|C) known, what is P(A|BC)
- Solved – P(A|B) and P(A|C) known, what is P(A|BC)