Logistic Regression
1. Explain logistic regression.
2. Explain the main difference between linear regression and logistic regression.
3. Why can’t we use the Ordinary Least Squares (OLS) method to estimate the best-fitting line for logistic regression?
4. Given the logistic regression equation . Where, is the weight and we are trying to estimate the log(odds of obesity). What is the log(odds of obesity) when ?
- If
is 0, the log(odds of obesity) is -2.
5. Given the logistic regression equation . Where, is the weight and we are trying to estimate the log(odds of obesity). Interpret the slope 1.5.
- For every one unit of weight gained, the log(odds of obesity) increases by 1.5.
6. Provide the logistic regression.
The logistic regression is a sigmoid function that compresses the space from 0 to 1. This allows the output to be interpreted as the probability of belonging to a specific class.
7. State the method to estimate the best-fitting line for logistic regression.
8. For logistic regression, provide the steps to estimate the best fitting line.
- Transform the probabilities into log(odds) to enable linear modelling.
- Fit a line in the logit space (aka log-odds space).
- Project the original data points onto the line to calculate the log(odds) values.
- Transform the log(odds) into probabilities.
- Calculate the log likelihood for the observed status.
- Repeat the steps 1-5:
- Iterate until the maximum likelihood is found and that would be the best fitted line.
9. In logistic regression, what is the purpose of transforming the probabilities into log(odds)?
10. Provide the formula to transform the probabilities into log(odds).
The probability is transformed to the log(odds) scale
Where,
11. Given the log of odds function , we need to predict the probabilities instead of the log of odds. Detail the steps to convert log(odds) into probabilities.
-
Exponentiate both sides:
- Using the rule:
, we get
- Using the rule:
-
Rearrange the equation to solve for
12. Given that the log(odds) = -3.48, convert the log(odds) into a probability.
13. Transform the equation into sigmoid function, which is the generalised logistic regression equation.
- Knowing that
- Substitute
with
Supplementary questions to help you understand the concepts better.
1. What is the log(odds) when the probability of an outcome is 1?
2. What is the log(odds) when the probability of an outcome is 0?
3. Explain the use-case of maximum likelihood estimator (MLE).
4. Explain odds and provide the equation.
Odds provide a measure of the likelihood of a particular outcome by expressing the likelihood of an event happening compared to the likelihood of it not happening.
5. Explain the difference between odds and probabilities
6. Explain why do we use log odds?
-
To solve the asymmetric issues in odds. Odds that are against will be bounded to 0 and 1. However odds are in favour can range between 1 to infinity.
-
Therefore, using log of odds makes the final values symmetric. making it easier to interpret and perform statistical analysis on the values.
-
For example, applying log to the odds are against 1 to 6 and odds are in favour 6 to 1, will have result..