Skip to main content

Logistic Regression using R

 

1. What is Logistic Regression?

Logistic Regression is one of the machine learning algorithms used for solving classification problems. It is used to estimate probability whether an instance belongs to a class or not. If the estimated probability is greater than threshold, then the model predicts that the instance belongs to that class, or else it predicts that it does not belong to the class as shown in fig 1. This makes it a binary classifier. Logistic regression is used where the value of the dependent variable is 0/1, true/false or yes/no.


Example 1

Suppose we are interested to know whether a candidate will pass the entrance exam. The result of the candidate depends upon his attendance in the class, teacher-student ratio, knowledge of the teacher and interest of the student in the subject are all independent variables and result is dependent variable. The value of the result will be yes or no. So, it is a binary classification problem.


Why Logistic Regression, Not Linear Regression

Linear Regression models the relationship between dependent variable and independent variables by fitting a straight line.

In Linear Regression, the value of predicted Y exceeds from 0 and 1 range. As discussed earlier, Logistic Regression gives us the probability and 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 the base of the natural logarithms and value is the actual numerical value that you want to transform. The output of this function is always 0 to 1.

The equation of linear 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 so that the linear term is on the right 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 called odds ratio.

Comments

  1. Amazing Article! I would like to thank you for the efforts you had made for writing this awesome article. I will suggest you to check articles related to best data science course, at Learnbay.co website.

    ReplyDelete

Post a Comment

Popular posts from this blog

Understanding Logistic Regression using R

  1. What is Logistic Regression? Logistic Regression is one of the machine learning algorithms used for solving classification problems. It is used to estimate probability whether an instance belongs to a class or not. If the estimated probability is greater than threshold, then the model predicts that the instance belongs to that class, or else it predicts that it does not belong to the class as shown in fig 1. This makes it a binary classifier. Logistic regression is used where the value of the dependent variable is 0/1, true/false or yes/no. Example 1 Suppose we are interested to know whether a candidate will pass the entrance exam. The result of the candidate depends upon his attendance in the class, teacher-student ratio, knowledge of the teacher and interest of the student in the subject are all independent variables and result is dependent variable. The value of the result will be yes or no. So, it is a binary classification problem. Practical Implementation of Logistic Regres

Data science: A Blend of These Data Components

Data Science Course ExcelR offers Data Science course, the most comprehensive Data Science course in the market, covering the complete Data Science lifecycle concepts from Data Collection, Data Extraction, Data Cleansing, Data Exploration, Data Transformation, Feature Engineering, Data Integration, Data Mining, building Prediction models, Data Visualization and deploying the solution to the customer. Skills and tools ranging from  Statistical Analysis , Text Mining, Regression Modelling, Hypothesis Testing, Predictive Analytics,  Machine Learning ,   Deep Learning, Neural Networks, Natural Language Processing, Predictive Modelling, R Studio, XLMiner,  Tableau , Spark, Hadoop, Minitab, programming languages like R programming ,  Python are covered extensively as part of this Data Science training. ExcelR is considered as the best Data Science training institute which offers services from training to placement as part of the Data Science training program with over 400+ participant

Knowledge Science, Enterprise Analytics Programs

Increase your analytics career with highly effective new Microsoft® Excel abilities by taking this Business Analytics with Excel course, which includes Energy BI coaching. Information Science is a area which is consistently evolving and constantly making manner for brand new technologies to be picked up. Many firms and professionals are mastered to stay ahead within the competition. Course Content (Score 4.5): The core course contains Statistics and likelihood, R and Python for Information Science, Hadoop, big information with Apache Spark, machine studying for information science, IBM Watson analytics, enterprise use instances of big information and data science and much more. College students had been enlightened by his profound information and business experience on Digital Advertising. This Big Information provides problem in term of storage and further analysis in rest of in real time. Information science is a combination of statistics, mathematics, computers, algorithms and a