[R] Re : ROC Analysis

Pascal Oettli kridox at ymail.com
Mon Mar 26 07:32:31 CEST 2012


Hi Camille,

Probably you have to check wether there is any infinte value in x.

Or calculate something like that for your x-axis:
x[1:(ll-1)]+diff(x)/2


Regards,
Pascal


----- Mail original -----
De : Camille Leclerc <camille.leclerc at ymail.com>
À : r-help at r-project.org
Cc : 
Envoyé le : Lundi 26 mars 2012 0h32
Objet : Re: [R] ROC Analysis

Hi everybody,

Pascal, your code works, but when I want to do the graph I have an error
message. 

here is my code :
x<-rev(unlist(pred at cutoffs))
tpf<-unlist(performance(pred, "tpr")@y.values)
fpf<-unlist(performance(pred,"fpr")@y.values)
ll<-length(x)
p<-(tpf[1:(ll-1)]-tpf[2:ll])/(fpf[1:(ll-1)]-fpf[2:ll])
plot(x,p)

*Erreur dans xy.coords(x, y, xlabel, ylabel, log) : 
'x' and 'y' lengths differ*

So, when I look the lenghts of x and p, I have this :
*x : numeric[1735]
p : numeric[1734]*

On the other hand, it's normal since I have the slope between two points on
the ROC curve and so I have x points and x-1 slope values. How to get the
graph?!

All the best,
Camille

-----
--
Camille Leclerc, Master student
Lab ESE, UMR CNRS 8079
Univ Paris-Sud
Bat 362
F-91405  Orsay Cedex FRANCE
--
View this message in context: http://r.789695.n4.nabble.com/ROC-Analysis-tp4469203p4503354.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list