[R] Question about subsetting S4 object in ROCR

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon May 27 19:16:01 CEST 2013



On 27.05.2013 16:18, Guido Leoni wrote:
> Dear list
> I'm testing a predictor and I produced nice performance plots with ROCR
> package utilizing the 3 standard command
>
> pred <- prediction(predictions, labels)
> perf <- performance(pred, measure = "tpr", x.measure = "fpr")
> plot(perf, col=rainbow(10))
>
> The pred object and the perfo object are S4
> with the following slots
>
> An object of class "performance"
> Slot "x.name":
> [1] "False positive rate"
>
> Slot "y.name":
> [1] "True positive rate"
>
> Slot "alpha.name":
> [1] "Cutoff"
>
> Slot "x.values":
> [[1]]
>   [1] 0.00 0.00 0.05 0.10 0.10 0.10 0.10 0.10 0.15 0.15 0.15 0.20 0.25 0.25
> 0.25 0.25 0.25 0.30 0.35 0.35 0.35 0.40 0.40 0.45 0.50 0.50 0.55 0.55 0.60
> [30] 0.65 0.65 0.70 0.70 0.75 0.80 0.85 0.90 0.90 0.95 1.00 1.00
>
>
> Slot "y.values":
> [[1]]
>   [1] 0.00 0.05 0.05 0.05 0.10 0.15 0.20 0.25 0.25 0.30 0.35 0.35 0.35 0.40
> 0.45 0.50 0.55 0.55 0.55 0.60 0.65 0.65 0.70 0.70 0.70 0.75 0.75 0.80 0.80
> [30] 0.80 0.85 0.85 0.90 0.90 0.90 0.90 0.90 0.95 0.95 0.95 1.00
>
>
> Slot "alpha.values":
> [[1]]
>   [1]   Inf 33309 32968 31688 31648 31355 31122 31047 30777 30589 30460
> 30395 30305 30159 29841 29101 28734 28657 28393 28196 27740 27662 27373
> 27078
> [25] 26763 26303 25573 25416 25364 25357 24993 23834 23789 23616 22357
> 20669 20092 18720 18136 17323 16665
>
>
> Now i'd like to make a plot (and also compute the AUC) only of the area
> corresponding to  0.80  y.values and 0.40  x.values.
> According to your experience is it possible to subset the perf object to
> the afore mentioned values?

But x=0.4 and y=0.8 is just a point, so I don't get which plot and area 
you are talking about now?

Best,
UWe Ligges






>   Thanks
> Guido
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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