See, my old post at
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/61879.html
to see a list of ROC related packages and functions. One of them should
work well for your application. All of them take data in the form:
- x - real number value returned by the classifier
- y - true labels / classes (only 2 levels allowed)
In Case of classification trees it might be hard to get your hands on the
"x" since your function might only return binary labels (classes),
what
gives you only 3 points on your ROC ( (0,0), (1,1) and one point calculated
from returned labels). But you might find function that can return
probabilities of each sample.
For example if you use 'rpart' than:
model = rpart( ytrain~., data = data.frame(cbind(ytrain,xtrain)), ...)
Prob = predict(model, newdata=xtest, type="prob")
x = Prob[,1]
y = ytest
will give you needed probabilities instead of classes.
Jarek Tuszynski
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch [mailto:anjali_karve at yahoo.com]
Sent: Friday, November 25, 2005 4:23 PM
To: r-help at stat.math.ethz.ch
Subject: [R] obtaining a ROC curve
Hello,
I have a classification tree. I want to obtain a ROC curve for this test.
What is the easiest way to obtain one?
-Anjali
---------------------------------
[[alternative HTML version deleted]]
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html