DEV Community

priyaexcelr
priyaexcelr

Posted on

Logistic Regression using R

Logistic Regression is one among the machine learning algorithms used for solving classification problems. it’s wont to estimate probability whether an instance belongs to a category or not. If the estimated probability is bigger than threshold, then the model predicts that the instance belongs thereto class, alternatively it predicts that it doesn’t belong to the category as shown in fig 1. This makes it a binary classifier. Logistic regression is employed where the worth of the variable is 0/1, true/false or yes/no.
Image for post

  1. Why Logistic Regression, Not rectilinear regression Linear Regression models the connection between variable and independent variables by fitting a line as shown in Fig 4. Image for post In rectilinear regression , the worth of predicted Y exceeds from 0 and 1 range. As discussed earlier, Logistic Regression gives us the probability and therefore the value of probability always lies between 0 and 1. Therefore, Logistic Regression uses sigmoid function or logistic function to convert the output between [0,1]. The logistic function is defined as: 1 / (1 + e^-value) Where e is that the base of the natural logarithms and value is that the actual numerical value that you simply want to rework . The output of this function is usually 0 to 1. The equation of rectilinear regression is Y=B0+B1X1+…+BpXp Logistic function is applied to convert the output to 0 to 1 range P(Y=1)=1/(1+exp(?(B0+B1X1+…+BpXp))) We need to reformulate the equation in order that the linear term is on the proper side of the formula. log(P(Y=1)/1?P(Y=1))= B0+B1X1+…+BpXp where log(P(Y=1)/1?P(Y=1)) is named odds ratio. Resources Box:- This article is inspired by Logistic Regression explained (https://www.excelr.com/blog/data-science/regression/understanding-logistic-regression-using-r)of Excelr Solutions.

Top comments (3)

Collapse
 
teknikog profile image
Tekniko Global

Tekniko Global is the best mobile app development company in Delhi, which has the expert app developers for iOS, Android, hybrid app development.

Collapse
 
mccurcio profile image
Matt Curcio

Bummer bunkie, your link is broken.
I love reading about Logit.

Collapse
 
larajames1003 profile image
larajames1003

Such an amazing post on Logistic Regression. I really enjoyed reading. Thanks! Azure AI Fundamentals (AI-900).