I was using the Smarket data in the ISLR package for logistic regression (in R) and find the error below. If I use the following command, I get the error (warning):
glm.fit1 = glm(Direction~. - Direction, data=Smarket, family="binomial")
Warning messages: 1: glm.fit: algorithm did not converge
2: glm.fit: fitted probabilities numerically 0 or 1 occurred
However if I run the following command, I do not see any error:
glm.fit = glm(Direction∼Lag1+Lag2+Lag3+Lag4+Lag5+Volume, data=Smarket,
family=binomial)
Although both the commands looks same to me (excluding the direction), the outputs are different. So, my questions are
- Why am I getting the warning if both the commands are same?
- Why is the output also different?