Session 15-Logistic Regression
Session 15-Logistic Regression
Session 15-Logistic Regression
Note: Content used in this PPT has copied from various source.
Introduction
Probability
(event)
Probability (Event)
z
Mathematical Interpretation of Logistic Regression
Where
Mathematical Interpretation of Logistic Regression
Mathematical Interpretation of Logistic Regression…
Model Fit
Therefore, one by one predictor variables are added, whichever gives most
decrease in -2LL
library(readxl)
library(MASS)
mydata<-read_excel("Brand_Loyalty_Data.xlsx")
#Print Data Frame
mydata
summary(mymodel)
#mymodel$linear.predictors #Use this to see the z-values
#mymodel$coefficients #Use this to see the coefficients
Logistic Regression in R (2of3)
Output
Predicting a case
#Predicting a case : Brand=1, Product=3, Shopping=2
l1=list("Brand"=1, "Product"=3, "Shopping"=2) #One can use data frame instead of a list
z<-predict(mymodel, newdata = l1)
z
prob=1/(1+exp(-z))
prob Output
PredictedValue=1/(1+exp(-z))>0.5
PredictedValue