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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 25, 2005 4:23 PM
To: [email protected]
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]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to