2011-06-10 23:17:06| 分类: R&Bioconductor | 标签: |举报 |字号大中小 订阅
INTRODUCTION
ROC is a technique with which one can visualize, organize and select classifiers on the bases of its qualities and performances. The ROC is represented graphically by plotting relationship between true positive and false positive rate where as true positive rate (sensitivity) is placed on x-axis and false positive rate (1-specificity) on y-axis. The ROC curve is analyzed keeping two important points in mind that is area under curve and shape of the curve. If the ROC curve rises toward upper left corner then the larger would be a value of area under curve and test performance is good(true positive rate is high). Area under curve would have values between 0 and 1. If the curve decline from upper left corner to lower right corner it means the test performance is bad(flase positive rate is high).[1-3]
MATERIAL AND METHOD
The code for the ROC curve module was taken from the website which was written in R language. RGui is used as an interface for running the code. First of all ROCR package and Verification package was installed on R interface which are needed to run the code.
In order to install the packages internet connection was enabled then in RGui interface install. packages(“ROCR”) command was used and it was installed automatically. The same procedure was followed for the verification package.
ROC CURVE MODULE IN R
# it allows two different plots in the same frame
par(mfrow = c(1,2))
# plot a ROC curve for a single prediction run
# and color the curve according to cutoff.
library(ROCR)
data(ROCR.simple)
pred <- prediction(ROCR.simple$predictions, ROCR.simple$labels)
perf <- performance(pred,"tpr", "fpr")
plot(perf,colorize = TRUE)
# plot a ROC curve for a single prediction run
# with CI by bootstrapping and fitted curve
library(verification)
roc.plot(ROCR.simple$labels,ROCR.simple$predictions, xlab = "False positive rate",
ylab = "True positive rate", main = NULL, CI = T, n.boot = 100, plot = "both", binormal = TRUE)
(auc <- as.numeric(performance(pred, measure = "auc", x.measure = "cutoff")@y.values))
[4]
RESULTS
DISCUSSION
The arguments and functions used in the code are as following:
Par: A function use to access and modify the graphic parameters
mfrow: A graphic parameter use in par function which means multiple figures in row
library(ROCR): Command for loading ROCR package in code
ROCR.simple: Data set for prediction sets and class labels
Prediction: A function that converts the input data into standardized format
pred <- prediction: Prediction function is assigned to pred object.
ROCR.simple$predictions: Vector numerical prediction
ROCR.simple$labels: Vectors for true class labels
Performance: A function to make predictor elevation
"tpr", "fpr": Performance measures
Colorize=TRUE: The curve is colorized according to cutoffs
Plot: A function for plotting R objects. To show different plots parameters are assigned like “both”, ”binorm” and ”emp”(default).
roc.plot: A function that plots a ROC for a given model
xlab, ylab: Label the x and y axes as false positive and true positive rate
main: Title for plot
CI: Confidence Intervals
n.boot: Number of bootstarp sample
binormal: If its set to true then binormal roc curve is calculated
auc: Area under curve
as.numeric: Generic function that attempts to change arguments to “double”
measure=”auc”: auc is a performance measure use for an evaluation
x.measure = "cutoff": It’s different form of performance measure where x.measure is taken as a unit on x axis and measure is taken
as a unit on y axis and two dimensional curve is obtained which is parameterize with the cutoff.
y.values: A list in which each entry contains the y values of the curve
APPLICATIONS OF ROC CURVE
REFRENCES
[1] ROC Curve (OriginPro only).OrignLab Available at http://www.originlab.com/www/helponline/Origin8/en/origin.htm#stats/roc_... .Accessed on August 20,2009
[2] SIB-ROC Available at www.toodoc.com/ROC-curve-ppt.html .Accessed on August 20,2009
[3] ROC Curves & Wilcoxon and Mann-Whitney Tests Available at www.utstat.toronto.edu/.../ROC%20Curves%20&%20Wilcoxon%20and%20Mann-Whit... .Accessed on August 20,2009
[4] ROC curve in ROCR and Verification package. One R tip a day Available at http://onertipaday.blogspot.com/2007/08/receiver-operating-characteristi... .Accessed on August 20,2009
[5] ROC curve. OrignLab Available at http://www.originlab.com/index.aspx?s=8&lm=322&pid=1076 .Accessed on August 20,2009
[6] Receiver operating characteristic. Wikipedia The Free Encyclopedia Available at http://en.wikipedia.org/wiki/Receiver_operating_characteristic .Accessed on August 20,2009
评论