04pallav
9/13/2017 - 9:26 PM

Logistic regression

Logistic regression

glm.fit=glm(Direction∼Lag1+Lag2+Lag3+Lag4+Lag5+Volume , data=Smarket ,family=binomial)
summary(glm.fit)

glm.probs=predict(lr.fit,type="response")      #prediction on training data only
glm.pred=rep("Reduce National Debt and Deficit",nrow(trainingdata))
glm.pred[glm.probs >.5]="Spend to Improve Economy"

mean(glm.pred==target )

#Logistic regression is a pretty flexible method. 
#It can readily use as independent variables categorical variables. 
#Most software that use Logistic regression should let you use categorical variables.


contrasts(Direction)