Description Usage Arguments Details Value Threshold Errors References See Also Examples
This is the auxiliary function of the Biocomb package. It computes a point coordinates for plotting ROC curve and returns a “List” object, consisting of sensitivity and specificity values for 2D-ROC curve and 3D-points for 3D-ROC curve, the optimal threshold values with the corresponding feature values and the accuracy of the classifier (feature).
1 |
s_data |
a list, which contains the vectors of sorted feature values for individual class labels. |
seq |
a numeric vector, containing the particular permutation of class labels. |
thresholds |
a numeric vector, containing the values of thresholds for calculating ROC curve coordinates. |
This function's main job is to compute the point coordinates to plot the 2D- or 3D-ROC curve, the optimal threshold values and the accuracy of classifier. See the “Value” section to this page for more details. The optimal threshold for two-class problem is the pair of sensitivity and specificity values for the selected feature. The optimal threshold for three-class problem is the 3D-point with the coordinates presenting the fraction of the correctly classified data objects for each class. The calculation of the optimal threshold is described in section “Threshold”.
The data must be provided without missing values in order to process. A returned list consists of the following fields:
Sn |
a specificity values for 2D-ROC construction and the first coordinate for 3D-ROC construction |
Sp |
a sensitivity values for 2D-ROC construction and the second coordinate for 3D-ROC construction |
S3 |
the third coordinate for 3D-ROC construction |
optSn |
the optimal specificity value for 2D-ROC construction and the first coordinate of the op-timal threshold for 3D-ROC construction |
optSp |
the optimal sensitivity value for 2D-ROC construction and the second coordinate of the optimal threshold for 3D-ROC construction |
optS3 |
the third coordinate of the optimal threshold for 3D-ROC construction |
optThre |
the feature value according to the optimal threshold (optSn,optSp) for two-class problem |
optThre1 |
the first feature value according to the optimal threshold (optSn,optSp,optS3) for three-class problem |
optThre2 |
the second feature value according to the optimal threshold (optSn,optSp,optS3) for three-class problem |
accuracy |
the accuracy of classifier (feature) for the optimal threshold |
The optimal threshold value is calculated for two-class problem as the pair “(optSn, optSp)” corresponding to the maximal value of “Sn+Sp”. According to “(optSn, optSp)” the corresponding feature threshold value “optThre” is calculated. The optimal threshold value is calculated for three-class problem as the pair “(optSn, optSp,optS3)” corresponding to the maximal value of “Sn+Sp+S3”.According to “(optSn, optSp,optS3)” the corresponding feature threshold values “optThre1,optThre2” are calculated. The accuracy of the classifier is the mean value of dQuote(optSn, optSp) for two-class problem and the mean value of “(optSn, optSp,optS3)” for three-class problem.
If there exists NA values for features or class labels no HUM value can be calculated and an error is triggered with message “Values are missing”.
Li, J. and Fine, J. P. (2008): ROC Analysis with Multiple Tests and Multiple Classes: methodology and its application in microarray studies.Biostatistics. 9 (3): 566-576.
CalculateHUM_Ex
, CalculateHUM_ROC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | data(leukemia72_2)
# Basic example
# class label must be factor
leukemia72_2[,ncol(leukemia72_2)]<-as.factor(leukemia72_2[,ncol(leukemia72_2)])
xdata=leukemia72_2
indexF=1:3
indexClass=ncol(xdata)
label=levels(xdata[,indexClass])
indexLabel=label
out=CalculateHUM_seq(xdata,indexF,indexClass,indexLabel)
HUM<-out$HUM
seq<-out$seq
indexL=NULL
for(i in 1:length(indexLabel))
{
indexL=c(indexL,which(label==indexLabel[i]))
}
indexEach=NULL
indexUnion=NULL
for(i in 1:length(label))
{
vrem=which(xdata[,indexClass]==label[i])
indexEach=c(indexEach,list(vrem))
if(length(intersect(label[i],indexLabel))==1)
indexUnion=union(indexUnion,vrem)
}
s_data=NULL
dataV=xdata[,indexF[1]] #single feature
prodValue=1
for (j in 1:length(indexLabel))
{
vrem=sort(dataV[indexEach[[indexL[j]]]])
s_data=c(s_data,list(vrem))
prodValue = prodValue*length(vrem)
}
#calculate the threshold values for plot of 2D ROC and 3D ROC
thresholds <- sort(unique(dataV[indexUnion]))
thresholds=(c(-Inf, thresholds) + c(thresholds, +Inf))/2
out=CalcROC(s_data,seq[,indexF[1]], thresholds)
|
Loading required package: gtools
Loading required package: Rcpp
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE
3: .onUnload failed in unloadNamespace() for 'rgl', details:
call: fun(...)
error: object 'rgl_quit' not found
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.