[R] no true negative data, need roc curve

Jessica Streicher j.streicher at micromata.de
Fri Aug 17 10:08:46 CEST 2012


Okay, first of a point in ROC space is spanned by true positive rate and false positive rate.
Now you need to decide if you want to plot a curve for each image or maybe a curve for the complete data (add all together).

In your case you only have 2 thresholds, so that makes the "curves" a little awkward because you only have 4 points total, but whatever.

Lets say you want a curve for image1:
tp1<-1066
fp1<-70
fn1<-116
tn1<-0
tpr1<-tp1/(tp1+fn1)
fpr1<-fp1/(fp1+tn1)

tp2<-446
fp2<-41
fn2<-55
tn2<-0
tpr2<-tp2/(tp2+fn2)
fpr2<-fp2/(fp2+tn2)

plot(0,0,type="n",ylim=c(0,1),xlim=c(0,1))
points(c(0,fpr1,fpr2,1),c(0,tpr1,tpr2,1))
lines(c(0,fpr1,fpr2,1),c(0,tpr1,tpr2,1))

Now i have to say though, after taking a look at that data you provided: THE DATA IS WRONG
If you add up all values (tp+tn+fp+fn), the number in threshold 2 is lower than in threshold 1.

It needs to be the same, so what the hell have you DONE? ^^

greetings 
Jessi

On 16.08.2012, at 17:49, Jessica Streicher wrote:

> To clarify:
> 
> Is TN = 0 or do you not know TN (N)?
> 
> On 16.08.2012, at 11:51, vjyns wrote:
> 
>> Hi,
>> 
>>  I want to plot ROC curve for my detection algorithm which detects
>> features in different images at two different thresholds.
>> 
>> 6 different images used and obtained tp, fp and fn. No tn in my case.
>> 
>> in first threshold run i obtained 6 values of tp,fp and fn. In second
>> threshold run agian i got 6 more.
>> 
>> i had calculated tpr and fpr. How to plot ROC in this case. 
>> 
>> Is this possible to plot ROC curve in this case? If s, please guide me to
>> plot that.
>> 
>> thank you.
>> 
>> http://r.789695.n4.nabble.com/file/n4640474/in1.png 
>> 
>> 
>> 
>> --
>> View this message in context: http://r.789695.n4.nabble.com/no-true-negative-data-need-roc-curve-tp4640474.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.
> 
> ______________________________________________
> 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