Last data update: 2014.03.03

R: Compute the accuracy curve.
accuracyR Documentation

Compute the accuracy curve.

Description

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

Usage

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

accuracy(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/accuracy.Rd_%03d_medium.png", width=480, height=480)
> ### Name: accuracy
> ### Title: Compute the accuracy curve.
> ### Aliases: accuracy
> 
> ### ** Examples
> 
> data(churn)
> 
> accuracy(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] 0.8778802 0.8955453 0.8947773 0.8970814 0.8978495 0.8993856 0.8986175
  [8] 0.8993856 0.8986175 0.8993856 0.9001536 0.8993856 0.8993856 0.9001536
 [15] 0.8993856 0.9001536 0.9009217 0.9016897 0.9009217 0.9016897 0.9024578
 [22] 0.9032258 0.9055300 0.9047619 0.9039939 0.9032258 0.9039939 0.9047619
 [29] 0.9055300 0.9047619 0.9039939 0.9032258 0.9039939 0.9032258 0.9039939
 [36] 0.9032258 0.9016897 0.9009217 0.8993856 0.8978495 0.8970814 0.8978495
 [43] 0.8986175 0.8993856 0.9001536 0.8993856 0.8993856 0.8986175 0.8978495
 [50] 0.8970814 0.8970814 0.8978495 0.8970814 0.8963134 0.8955453 0.8947773
 [57] 0.8940092 0.8947773 0.8955453 0.8963134 0.8978495 0.8970814 0.8978495
 [64] 0.8970814 0.8924731 0.8940092 0.8955453 0.8947773 0.8940092 0.8932412
 [71] 0.8924731 0.8932412 0.8924731 0.8932412 0.8932412 0.8917051 0.8924731
 [78] 0.8901690 0.8924731 0.8932412 0.8924731 0.8924731 0.8932412 0.8924731
 [85] 0.8917051 0.8924731 0.8940092 0.8924731 0.8917051 0.8909370 0.8901690
 [92] 0.8894009 0.8894009 0.8886329 0.8886329 0.8863287 0.8855607 0.8840246
 [99] 0.8794163 0.8771121 0.8763441 0.8771121 0.8778802 0.8771121 0.8748080
[106] 0.8740399 0.8678955 0.8694316 0.8663594 0.8655914 0.8632873 0.8625192
[113] 0.8617512 0.8617512 0.8625192 0.8617512 0.8602151 0.8602151 0.8594470
[120] 0.8586790 0.8579109 0.8586790 0.8579109 0.8579109 0.8563748 0.8556068
[127] 0.8563748 0.8548387 0.8540707 0.8525346 0.8502304 0.8486943 0.8486943
[134] 0.8479263 0.8471582 0.8440860 0.8425499 0.8425499 0.8402458 0.8387097
[141] 0.8371736 0.8364055 0.8364055 0.8356375 0.8317972 0.8294931 0.8279570
[148] 0.8264209 0.8233487 0.8210445 0.8187404 0.8179724 0.8156682 0.8156682
[155] 0.8118280 0.8079877 0.8064516 0.8026114 0.8018433 0.7995392 0.7964670
[162] 0.7933948 0.7926267 0.7918587 0.7910906 0.7880184 0.7849462 0.7841782
[169] 0.7795699 0.7780338 0.7772657 0.7734255 0.7726575 0.7688172 0.7626728
[176] 0.7634409 0.7619048 0.7557604 0.7549923 0.7534562 0.7488479 0.7457757
[183] 0.7457757 0.7434716 0.7403994 0.7350230 0.7311828 0.7273425 0.7258065
[190] 0.7219662 0.7204301 0.7165899 0.7127496 0.7089094 0.7050691 0.6996928
[197] 0.6966206 0.6912442 0.6881720 0.6858679 0.6812596 0.6781874 0.6728111
[204] 0.6689708 0.6635945 0.6536098 0.6451613 0.6390169 0.6313364 0.6198157
[211] 0.6175115 0.6113671 0.5990783 0.5898618 0.5791091 0.5599078 0.5299539
[218] 0.4984639 0.4470046 0.1221198 0.1221198

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