title: R logistic regression area under curve
body: <p>I am performing logistic regression using this <a href="http://www.ats.ucla.edu/stat/r/dae/logit.htm" rel="noreferrer">page</a>. My code is as below.</p>
  
  <pre><code>mydata &lt;- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
  mylogit &lt;- glm(admit ~ gre, data = mydata, family = "binomial")
  summary(mylogit)
  prob=predict(mylogit,type=c("response"))
  mydata$prob=prob
  </code></pre>
  
  <p>After running this code mydata dataframe has two columns - 'admit' and 'prob'. 
  Shouldn't those two columns sufficient to get the ROC curve? </p>
  
  <p>How can I get the ROC curve.</p>
  
  <p>Secondly, by loooking at mydata, it seems that model is predicting probablity of <code>admit=1</code>. </p>
  
  <p>Is that correct? </p>
  
  <p>How to find out which particular event the model is predicting?</p>
  
  <p>Thanks</p>
  
  <p>UPDATE:
  It seems that below three commands are very useful. They provide the cut-off which will have maximum accuracy and then help to get the ROC curve.</p>
  
  <pre><code>coords(g, "best")
  
  mydata$prediction=ifelse(prob&gt;=0.3126844,1,0)
  
  confusionMatrix(mydata$prediction,mydata$admit
  </code></pre>