Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #logistic regression
  2. mylogit3<-glm(candidatebinary~rrscale+econscale+ideologyscale,data=informedvoters,family="binomial")
  3. #probability calculation
  4. prob<-predict(mylogit3,informedvoters,type="response")
  5. #new data frame
  6. newdata<-data.frame(probability=prob,rrscale=informedvoters$rrscale)
  7. #ggplot visualization
  8. ggplot(NULL,aes(rrscale,probability))+
  9. 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