加关注

# 云之南

## 日志 GACHA精选

### R-ROC曲线

2011-06-10 23:17:06|  分类： R&Bioconductor |  标签： |举报 |字号

下载LOFTER 我的照片书  |
http://chen.yi.bo.blog.163.com/blog/static/150621109201042641952619/
http://rocr.bioinf.mpi-sb.mpg.de/
http://www.molecularsciences.org/statistics_with_R/creating_ROC_curves_using_R

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))


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
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

• Widely used in medicine, radiology, psychology; recently becoming more popular in areas like machine learning and data mining applications to assess classifiers
• ROC analysis provides a tool to select possibly optimal models and to discard suboptimal ones
• Related to cost/benefit analysis of diagnostic decision making
• Used to compare tests/procedures[5-6]

REFRENCES
 ROC Curve (OriginPro only).OrignLab Available at http://www.originlab.com/www/helponline/Origin8/en/origin.htm#stats/roc_... .Accessed on August 20,2009
 SIB-ROC Available at www.toodoc.com/ROC-curve-ppt.html .Accessed on August 20,2009
 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
 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
 ROC curve. OrignLab Available at http://www.originlab.com/index.aspx?s=8&lm=322&pid=1076 .Accessed on August 20,2009
 Receiver operating characteristic. Wikipedia The Free Encyclopedia Available at http://en.wikipedia.org/wiki/Receiver_operating_characteristic .Accessed on August 20,2009

评论这张

#### 评论

<#--最新日志，群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇，下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->