Logistic Regression is used to predict probabilities like certain thing will happen or not Yes/No, true or false etc.
Logistic regression line is the best fitting line which we get by following the equation,like we get slope using linear regression.
Logistic Regression Equation:
log(p/1-p) = b0 + b1*x
Now for points below 0.5 we will take ans as 0 and above 0.5 as 1. So we can get 2 things out of logistic regression i.e. probabilities & predicted values for dependent variable.
It is doing same thing as linear regression, it is fitting line , though it’s not straight but its fitting line, we are trying to fit best curve to our data.
- Form of regression analysis used for prediction of discrete variables using a mix of continuous and discrete predictors.
- Logistic regression is used when the research objective is focused on whether or not an event occurred, rather than when it occurred i.e. time course information is not used.
- In logistic regression, instead of building a predictive model for “Y(Response)” directly, the approach models log odds(Y); hence the name logistic or logit.
Logistic regression is used when:
Dependent variable: categorical
Independent variable: continuous or categorical
- What we have on the Y axis is a probability.
- If we use a linear regression model, the predicted values are unbounded – ∞ to + ∞ (- infinity to + infinity) . But probability values are restricted to 0 to 1.
- One way to solve this problem is to take an odds ratio (p/1-p) and then take the log
It is a standard statistical term that denotes probability of success to probability of failure .i.e. p/(1-p)
Note: p/(1-p) – It can take values of 0 to ∞ , log (p/1-p) can take values of – ∞ to +∞ and p can take values from 0 to 1 only.
So if p is 0, p/1-p = 0
if p is 1, p/1-p is infinity
Odds ratio of probability of success -> p/(1-p)
Logistic regression equation with credit example:
log(p/1-p) = B0 +B1 * credit history + B2 * loan amount + B3 * Income level + e
where, p = prob. of default