# Logistic Regression in R | Machine Learning Algorithms | Data Science Tutorial | Intellipaat

Hey Guys, welcome to yet another interesting

session by Intellipaat and today we are going to look at Logistic Regression. So, we will start off by understanding what

exactly is Regression, then we will understand what is Logistic Regression and finally we will

implement the concept of logistic regression in R.

So, let’s get started!!! Let’s take this scenario, where we have

three employees: Sam, whose age is 20 and earns $50,000

Bob, who is 35yrs old and earns $75,000 and Matt, who is 50yrs old and earns $100,000

Now, I will introduce a new employee to you, whose age is 28 and ask you what is his salary. What would you do? You would look at the general trend between

the age and salary and understand that as age of the employee increases, his salary

also increases. This is nothing but regression, where you

are trying to understand how does a person’s age affect his salary based on the historical

data. Over here “salary” is the dependent variable

and “age” is the independent variable i.e. you are trying to ascertain the salary

of employee, with respect to the age. Let’s look at the second scenario:

Here, we have two students, Rachel and Ross. They appear for an exam and Rachel manages

to pass the exam, while Ross fails. Now, what if another student, Monica, takes

the same test? Would she be able to clear the exam? Well, you will again look at the data provided

to you and see that Rachel being a girl, was able to pass the exam, while Ross being a

guy, failed to clear it and on the basis of this data you’d say there is a good probability

for Monica to clear the exam as well. This again is regression, where you’re finding

out if the student has cleared the exam based on their gender and hence “result” is

the dependent variable over here and “gender” is the independent variable. So, in simple terms, regression helps you

to understand the extent of relationship between two variables. Now that we have understood what exactly is

regression, it’s time to understand logistic regression.

Logistic Regression is a regression technique, where the dependent variable is categorical

i.e we determine the probability of the observation belonging to a particular category. Let’s look at an example to understand this

better.. Over here, we are trying to determine the

probability of raining, based on independent variables such as “temperature” and “humidity”. Or in other words, we are choosing a category,

namely “yes” or “no” for the question, will it rain?

Right, now, we will head on and understand the difference between linear regression and

logistic regression. In linear regression, we fit a straight line. I.e. for a given value of “x”, there definitely

exists a “y” value which falls on the line.

Is logistic regression mainly used for regression?

Got a question on Logistic Regression? Do write it in the comment and you will get a response immediately by our expert. For Data Science with R Programming training & certification, call us at US: 1800-216-8930 (Toll Free) or India: +917022374614.

You can also write us at [email protected]

Good introductory video. I wanted to know if i can fit a linear line with logistic regression?

Thanks.

Wonderful Tutorial on R….

How can I evaluate the model’s accuracy in R?

The video is so much informative and simplified.

Can I use more than one dependent variable in the ‘glm()’ formula?

Straight to the point and easy to follow. Thank you

Thank you so much for the effort.

this kind of videos are really informative.

Amazing video.

Your description very useful keep it up …thank you intellipaat

Thank you for a great content a great video.

Excellent Tutorial :very comprehensive and to the point delivering the value.

Its really nice. Its kind of summary.

great lecture!!!

Really Awesome presentation…

Exactly what I needed. Thanks for making this video.

Thanks a lot!!I have spent days looking for this ..

Interesting Video.

Great video. It was explained very well.

Perfect explanation !! Thanks

Some interesting tips, thanks!

Great video! very simple and straight to the point!

thanks for such informative videos .

Nice video well explained everything.

This is really good video. Thank you so much

thank you so much for providing this excellent video

Great video… well paced

..