[R] Problems while plotting with ROCR

Heiko Strathmann heiko.strathmann at googlemail.com
Fri Dec 4 12:37:01 CET 2009


Hello all,

I have two problems with the ROCR package.

First Problem:
the add=TRUE option does not work for plotting performance objects

The following code is taken from the reference manual (example for
ROCR.hiv, page2)

data(ROCR.hiv)
attach(ROCR.hiv)
pred.svm <- prediction(hiv.svm$predictions, hiv.svm$labels)
perf.svm <- performance(pred.svm, 'tpr', 'fpr')
pred.nn <- prediction(hiv.nn$predictions, hiv.svm$labels)
perf.nn <- performance(pred.nn, 'tpr', 'fpr')
plot(perf.svm, lty=3, col="red",main="SVMs and NNs for prediction of
HIV-1 coreceptor usage")

now I see some dotted red ROC curves.
Now after the next command:
plot(perf.nn, lty=3, col="blue",add=TRUE)

there happens exactly the same as if i would call:
plot(perf.nn, lty=3, col="blue")

I now see only some dotted blue ROC curves, the red ones and the main
caption of the plot are gone.

Second problem:
the averaging of multiple performance curves does not work correctly

 (using the same example code, skipping some comands)
data(ROCR.hiv)
attach(ROCR.hiv)
pred.svm <- prediction(hiv.svm$predictions, hiv.svm$labels)
perf.svm <- performance(pred.svm, 'tpr', 'fpr')
pred.nn <- prediction(hiv.nn$predictions, hiv.svm$labels)
perf.nn <- performance(pred.nn, 'tpr', 'fpr')

plot(perf.svm, avg="vertical", lwd=3, col="red",
     spread.estimate="stderror",plotCI.lwd=2)

this does not give me an average curve, but multiple ones:
see screenshot:
http://www-stud.uni-due.de/~sfhestra/Bildschirmfoto.png

I already tried reinstalling R and ROCR

thanks for your help

Heiko




More information about the R-help mailing list