Hi, I ran below code
Dat = read.csv('https://raw.githubusercontent.com/sam16tyagi/Machine-Learning-techniques-in-python/master/logistic%20regression%20dataset-Social_Network_Ads.csv') head(Dat) Model = glm(Purchased ~ Gender, data = Dat, family = binomial()) head(predict(Model, type="response")) My_Predict = 1/(1+exp(-1 * (as.vector(coef(Model))[1] * as.vector(coef(Model))[2] * ifelse(Dat['Gender'] == "Male", 1, 0)))) head(My_Predict) However, My_Predict and predict(Model, type="response")) are differing when I tried to manually calculate prediction. Could you please help to identify what was the mistake I made? ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.