Running examples in ‘WeightedROC-Ex.R’ failed
The error most likely occurred in:

> ### Name: WeightedAUC
> ### Title: WeightedAUC
> ### Aliases: WeightedAUC
> 
> ### ** Examples
> 
> 
> library(WeightedROC)
> ## Compute the AUC for this weighted data set.
> y <- c(-1, -1, 1, 1, 1)
> w <- c(1, 1, 1, 4, 5)
> y.hat <- c(1, 2, 3, 1, 1)
> tp.fp <- WeightedROC(y.hat, y, w)
> wauc <- WeightedAUC(tp.fp)
> wauc
[1] 0.325
> 
> ## glmnet 1.9-5 (2013-8-1) also has a function called auc but it
> ## does not compute the correct AUC when there are ties in the
> ## predicted score (y.hat).
> library(glmnet)
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-13

> rbind(`glmnet::auc`=c(unequal.weights=glmnet::auc(y, y.hat, w),
+         no.weights=glmnet::auc(y, y.hat),
+         equal.weights=glmnet::auc(y, y.hat, rep(1, length(y)))),
+       `WeightedROC::WeightedAUC`=c(wauc,
+         WeightedAUC(WeightedROC(y.hat, y)),
+         WeightedAUC(WeightedROC(y.hat, y, rep(1, length(y))))))          
                         unequal.weights no.weights equal.weights
glmnet::auc                        0.300        2.0     0.3333333
WeightedROC::WeightedAUC           0.325        0.5     0.5000000
> 
> ## with no ties, glmnet::auc can give the correct answer. For the
> ## case with equal weights you must provide a vector of equal
> ## weights as an argument (if you leave the third argument of
> ## glmnet::auc missing, then it gives the wrong answer).
> y <- c(-1, -1, 1, -1, 1)
> y.hat <- c(1, 2, 3, 4, 5)
> w <- c(1, 1, 1, 4, 5)
> rbind(`glmnet::auc`=c(unequal.weights=glmnet::auc(y, y.hat, w),
+         no.weights=glmnet::auc(y, y.hat),
+         equal.weights=glmnet::auc(y, y.hat, rep(1, length(y)))),
+       `WeightedROC::WeightedAUC`=c(WeightedAUC(WeightedROC(y.hat, y, w)),
+         WeightedAUC(WeightedROC(y.hat, y)),
+         WeightedAUC(WeightedROC(y.hat, y, rep(1, length(y))))))
Warning in log(n1) : NaNs produced
                         unequal.weights no.weights equal.weights
glmnet::auc                    0.8888889        NaN     0.8333333
WeightedROC::WeightedAUC       0.8888889  0.8333333     0.8333333
>         
> library(ROCR)
Loading required package: gplots

Attaching package: ‘gplots’

The following object is masked from ‘package:stats’:

    lowess

> library(pROC)
Type 'citation("pROC")' for a citation.

Attaching package: ‘pROC’

The following object is masked from ‘package:glmnet’:

    auc

The following objects are masked from ‘package:stats’:

    cov, smooth, var

> ## For the un-weighted ROCR example data set, verify that our AUC is
> ## the same as that of ROCR/pROC/glmnet. Note that glmnet::auc is
> ## faster than WeightedROC::WeightedAUC because glmnet::auc it does
> ## not include the overhead of computing a data.frame(TPR, FPR) that
> ## could be plotted.
> data(ROCR.simple, envir=environment())
> if(require(microbenchmark)){
+   microbenchmark(WeightedROC={
+     tp.fp <- with(ROCR.simple, WeightedROC(predictions, labels))
+     wroc <- WeightedAUC(tp.fp)
+   }, ROCR={
+     pred <- with(ROCR.simple, prediction(predictions, labels))
+     rocr <- performance(pred, "auc")@y.values[[1]]
+   }, pROC={
+     proc <- pROC::auc(labels ~ predictions, ROCR.simple, algorithm=2)
+   }, glmnet={
+     gnet <- with(ROCR.simple, {
+       glmnet::auc(labels, predictions, rep(1, length(labels)))
+     })
+   }, times=10)
+   rbind(WeightedROC=wroc, ROCR=rocr, pROC=proc, glmnet=gnet) #same
+ }
Loading required package: microbenchmark
Error in microbenchmark(WeightedROC = { : 
  Measured negative execution time! Please investigate and/or contact the package author.
Execution halted