Understanding Logistic Regression using R

Spread the love

1. What is Logistic Regression?

Logistic Regression is one of the AI calculations utilized for taking care of grouping issues. It is utilized to appraise the likelihood of an occurrence has a place with a class. In the event that the assessed likelihood is more noteworthy than the limit, at that point the model predicts that the occurrence has a place with that class, or, in all likelihood, it predicts that it doesn’t have a place with the class as demonstrated in fig 1. This makes it a paired classifier. Calculated relapse is utilized where the estimation of the reliant variable is 0/1, valid/bogus, or yes/no.

Example 1

Assume we are intrigued to know whether an applicant will breeze through the placement test. The aftereffect of the up-and-comer relies on his participation in the class, educator understudy proportion, information on the instructor, and interest of the understudy in the subject are largely autonomous factors and the result is needy variable. The estimation of the outcome will be yes or no. Along these lines, it is a parallel order issue.

Example 2

Assume we need to anticipate if an individual is experiencing Covid-19. The manifestations of the patient incorporate windedness, muscle throbs, sore throat, runny nose, migraine, and chest torment are altogether autonomous factors and the presence of Coronavirus (y) is a needy variable. The estimation of the reliant variable will be yes or no, valid or bogus, and 0 or 1.

2. Why Logistic Regression, Not Linear Regression

Linear Regression models the connection between subordinate variables and free factors by fitting a straight line as demonstrated in Fig 4.

In Linear Regression, the estimation of anticipated Y surpasses from 0 and 1 territory. As examined before, Logistic Regression gives us the likelihood and the estimation of likelihood consistently lies somewhere in the range of 0 and 1. In this manner, Logistic Regression utilizes sigmoid capacity or strategic capacity to change over the yield between [0,1]. The calculated capacity is characterized as:

1 / (1 + e^-value)

Where e is the base of the common logarithms and worth is the genuine mathematical worth that you need to change. The yield of this capacity is consistently 0 to 1.

The equation of linear regression is

Y=B0+B1X1+…+BpXp

Calculated capacity is applied to change the yield over to 0 to 1 territory

P(Y=1)=1/(1+exp(?(B0+B1X1+…+BpXp)))

We need to reformulate the condition so the straight term is on the correct side of the recipe.

log(P(Y=1)/1?P(Y=1))= B0+B1X1+…+BpXp

where log(P(Y=1)/1?P(Y=1)) is called odds ratio.

Related Topic- Practical Implementation of Logistic Regression.

Leave a Reply

Your email address will not be published. Required fields are marked *