Last data update: 2014.03.03

R: Compute the specificity curve.
specificityR Documentation

Compute the specificity curve.

Description

This function computes the specificity curve required for the auc function and the plot function.

Usage

  specificity(predictions, labels, perc.rank = TRUE)

Arguments

predictions

A numeric vector of classification probabilities (confidences, scores) of the positive event.

labels

A factor of observed class labels (responses) with the only allowed values {0,1}.

perc.rank

A logical. If TRUE (default) the percentile rank of the predictions is used.

Value

A list containing the following elements:

cutoffs

A numeric vector of threshold values

measure

A numeric vector of specificity values corresponding to the threshold values

Author(s)

Authors: Michel Ballings and Dirk Van den Poel, Maintainer: Michel.Ballings@UGent.be

References

Ballings, M., Van den Poel, D., Threshold Independent Performance Measures for Probabilistic Classifcation Algorithms, Forthcoming.

See Also

sensitivity, specificity, accuracy, roc, auc, plot

Examples

data(churn)

specificity(churn$predictions,churn$labels)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(AUC)
AUC 0.3.0
Type AUCNews() to see the change log and ?AUC to get an overview.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/AUC/specificity.Rd_%03d_medium.png", width=480, height=480)
> ### Name: specificity
> ### Title: Compute the specificity curve.
> ### Aliases: specificity
> 
> ### ** Examples
> 
> data(churn)
> 
> specificity(churn$predictions,churn$labels)
$cutoffs
  [1] 1.0000000 1.0000000 0.9777266 0.9769585 0.9746544 0.9738863 0.9723502
  [8] 0.9715822 0.9708141 0.9700461 0.9692780 0.9685100 0.9677419 0.9662058
 [15] 0.9654378 0.9646697 0.9639017 0.9631336 0.9623656 0.9615975 0.9608295
 [22] 0.9600614 0.9592934 0.9539171 0.9531490 0.9523810 0.9516129 0.9508449
 [29] 0.9500768 0.9493088 0.9485407 0.9477727 0.9470046 0.9462366 0.9454685
 [36] 0.9447005 0.9439324 0.9423963 0.9416283 0.9400922 0.9385561 0.9377880
 [43] 0.9370200 0.9362519 0.9354839 0.9347158 0.9339478 0.9324117 0.9316436
 [50] 0.9308756 0.9301075 0.9285714 0.9278034 0.9254992 0.9247312 0.9239631
 [57] 0.9231951 0.9224270 0.9216590 0.9208909 0.9201229 0.9185868 0.9178187
 [64] 0.9170507 0.9162826 0.9116743 0.9086022 0.9070661 0.9062980 0.9055300
 [71] 0.9032258 0.9024578 0.9016897 0.9009217 0.9001536 0.8986175 0.8970814
 [78] 0.8963134 0.8940092 0.8917051 0.8909370 0.8901690 0.8886329 0.8878648
 [85] 0.8870968 0.8863287 0.8855607 0.8824885 0.8809524 0.8801843 0.8794163
 [92] 0.8786482 0.8778802 0.8763441 0.8755760 0.8740399 0.8701997 0.8694316
 [99] 0.8678955 0.8632873 0.8609831 0.8602151 0.8594470 0.8586790 0.8579109
[106] 0.8540707 0.8533026 0.8456221 0.8440860 0.8410138 0.8402458 0.8379416
[113] 0.8356375 0.8348694 0.8317972 0.8310292 0.8302611 0.8287250 0.8241167
[120] 0.8233487 0.8225806 0.8218126 0.8210445 0.8202765 0.8187404 0.8172043
[127] 0.8164363 0.8156682 0.8141321 0.8133641 0.8118280 0.8095238 0.8079877
[134] 0.8064516 0.8056836 0.8049155 0.8018433 0.8003072 0.7987711 0.7933948
[141] 0.7918587 0.7887865 0.7864823 0.7849462 0.7841782 0.7788018 0.7764977
[148] 0.7749616 0.7734255 0.7703533 0.7680492 0.7657450 0.7649770 0.7626728
[155] 0.7611367 0.7572965 0.7534562 0.7519201 0.7480799 0.7473118 0.7450077
[162] 0.7388633 0.7357911 0.7350230 0.7342550 0.7304147 0.7273425 0.7242704
[169] 0.7219662 0.7173579 0.7142857 0.7135177 0.7096774 0.7089094 0.7050691
[176] 0.6989247 0.6981567 0.6950845 0.6889401 0.6850998 0.6820276 0.6774194
[183] 0.6743472 0.6728111 0.6689708 0.6643625 0.6574501 0.6520737 0.6482335
[190] 0.6466974 0.6428571 0.6397849 0.6344086 0.6305684 0.6267281 0.6213518
[197] 0.6159754 0.6129032 0.6059908 0.6029186 0.5990783 0.5944700 0.5913978
[204] 0.5860215 0.5821813 0.5768049 0.5668203 0.5568356 0.5476190 0.5384025
[211] 0.5253456 0.5215054 0.5153610 0.5030722 0.4938556 0.4815668 0.4592934
[218] 0.4293395 0.3978495 0.3433180 0.0000000

$measure
  [1] 1.0000000 0.9973753 0.9965004 0.9965004 0.9965004 0.9965004 0.9956255
  [8] 0.9956255 0.9947507 0.9947507 0.9947507 0.9938758 0.9930009 0.9930009
 [15] 0.9921260 0.9921260 0.9921260 0.9921260 0.9912511 0.9912511 0.9912511
 [22] 0.9912511 0.9895013 0.9886264 0.9877515 0.9868766 0.9868766 0.9868766
 [29] 0.9868766 0.9860017 0.9851269 0.9842520 0.9842520 0.9833771 0.9833771
 [36] 0.9825022 0.9807524 0.9798775 0.9781277 0.9763780 0.9755031 0.9755031
 [43] 0.9755031 0.9755031 0.9755031 0.9746282 0.9737533 0.9728784 0.9720035
 [50] 0.9711286 0.9702537 0.9702537 0.9685039 0.9676290 0.9667542 0.9658793
 [57] 0.9650044 0.9650044 0.9650044 0.9650044 0.9650044 0.9641295 0.9641295
 [64] 0.9632546 0.9580052 0.9571304 0.9571304 0.9562555 0.9553806 0.9536308
 [71] 0.9527559 0.9527559 0.9518810 0.9518810 0.9510061 0.9492563 0.9492563
 [78] 0.9466317 0.9466317 0.9466317 0.9457568 0.9448819 0.9448819 0.9440070
 [85] 0.9431321 0.9431321 0.9422572 0.9405074 0.9396325 0.9387577 0.9378828
 [92] 0.9370079 0.9361330 0.9352581 0.9343832 0.9308836 0.9300087 0.9282590
 [99] 0.9230096 0.9203850 0.9195101 0.9195101 0.9195101 0.9186352 0.9151356
[106] 0.9142607 0.9063867 0.9063867 0.9028871 0.9020122 0.8993876 0.8976378
[113] 0.8967629 0.8950131 0.8950131 0.8941382 0.8923885 0.8897638 0.8888889
[120] 0.8880140 0.8871391 0.8871391 0.8862642 0.8853893 0.8836395 0.8827647
[127] 0.8827647 0.8810149 0.8801400 0.8783902 0.8757655 0.8740157 0.8731409
[134] 0.8722660 0.8713911 0.8678915 0.8661417 0.8652668 0.8608924 0.8591426
[141] 0.8565179 0.8547682 0.8538933 0.8530184 0.8477690 0.8451444 0.8433946
[148] 0.8416448 0.8381452 0.8355206 0.8328959 0.8320210 0.8293963 0.8285214
[155] 0.8241470 0.8197725 0.8180227 0.8136483 0.8127734 0.8101487 0.8048994
[162] 0.8013998 0.8005249 0.7996500 0.7970254 0.7935258 0.7900262 0.7882765
[169] 0.7830271 0.7804024 0.7795276 0.7751531 0.7742782 0.7699038 0.7629046
[176] 0.7629046 0.7602800 0.7532808 0.7506562 0.7480315 0.7427822 0.7392826
[183] 0.7384077 0.7349081 0.7305337 0.7235346 0.7182852 0.7139108 0.7121610
[190] 0.7077865 0.7051619 0.6999125 0.6955381 0.6911636 0.6859143 0.6797900
[197] 0.6762905 0.6692913 0.6657918 0.6622922 0.6570429 0.6535433 0.6474191
[204] 0.6430446 0.6369204 0.6255468 0.6150481 0.6062992 0.5966754 0.5826772
[211] 0.5791776 0.5721785 0.5581802 0.5476815 0.5345582 0.5109361 0.4768154
[218] 0.4409449 0.3805774 0.0000000 0.0000000

attr(,"class")
[1] "AUC"         "specificity"
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>