Machine Learning | Logistic Regression in R

The Logistic Regression is a regression model in which the response variable (dependent variable) has categorical values such as True/False or 0/1. It actually measures the probability of a binary response as the value of response variable based on the mathematical equation relating it with the predictor variables.

Lets load the remission dataset and understand the logistic regression.
Lets understand the dataset by summarizing 
str function used to view the datatypes of each feature in the dataset and dim function returns the observation and feature counts as shown below.
Logistic reg equation :
LOG P /1-P = B0+B1X1+B2X2+B3X3+BNXN:
B0 : intercept
B1: Slope for x1 : First independent variable in your data (cell)
X1 : First independent variable, cell
B2 : Slope for x2 : Second independent variable (smear)
X2 : Second independent variable, smear

Now lets built the model. In order to create a logistic regression model glm() function is used as shown below.

In the summary, as the p-value in the for most variable is more than 0.05 and we consider them to be insignificant in contributing to the value of the variable "Remiss". Only LI impacts the "Remiss" value in this regression model.

Now lets predict for observations and try to plot graph as shown below.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.