I'm using the model ReLogit from the package Zelig in R. ReLogit is a logistic regression for rare events data. After having estimated the model on the training set, I want to calculate the AUC (Area under the ROC Curve) of this model in the test set. How can I do this with this package?
I think the easiest way to do this is using the
Zelig I think you can use
rocplot or something to extract the statistic.
Let's say we estimate
m1, then one way to calculate the AUC is:
library(pROC) library(Zelig) data(mid) # Data on Militarized Interstate Disputes from King & Zeng (2001) m1<-relogit(conflict~.,mid) auc(as.numeric(m1$model>0),as.vector(fitted(m1))) Area under the curve: 0.9235
And now we're at it, it's also easy to plot the ROC: