Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #logistic regression
- mylogit3<-glm(candidatebinary~rrscale+econscale+ideologyscale,data=informedvoters,family="binomial")
- #probability calculation
- prob<-predict(mylogit3,informedvoters,type="response")
- #new data frame
- newdata<-data.frame(probability=prob,rrscale=informedvoters$rrscale)
- #ggplot visualization
- ggplot(NULL,aes(rrscale,probability))+
- geom_smooth(data=newdata,aes(col="blue"),method="glm",method.args = list(family = "binomial"),se=F)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement