Learn R Programming

nproc (version 2.1.5)

rocCV: Calculate the Receiver Operating Characteristics with Cross-validation or Subsampling

Description

rocCV calculates the receiver operating characterisitc with cross-validation

Usage

rocCV(x = NULL, y, method = c("logistic", "penlog", "svm", "randomforest",
  "lda", "nb", "ada", "tree"), metric = "CV", n.folds = 5,
  train.frac = 0.5, n.cores = 1, randSeed = 0, ...)

Arguments

x

n * p observation matrix. n observations, p covariates.

y

n 0/1 observatons.

method

classification method(s).

  • logistic: Logistic regression. glm function with family = 'binomial'

  • penlog: Penalized logistic regression with LASSO penalty. glmnet in glmnet package

  • svm: Support Vector Machines. svm in e1071 package

  • randomforest: Random Forest. randomForest in randomForest package

  • Linear Discriminant Analysis. lda: lda in MASS package

  • nb: Naive Bayes. naiveBayes in e1071 package

  • ada: Ada-Boost. ada in ada package

metric

metric used for averging performance. Includes 'CV' and 'SS' as options. Default = 'CV'.

n.folds

number of folds used for cross-validation or the number of splits in the subsampling. Default = 5.

train.frac

fraction of training data in the subsampling process. Default = 0.5.

n.cores

number of cores used for parallel computing. Default = 1.

randSeed

the random seed used in the algorithm. Default = 0.

...

additional arguments.

Value

A list.

fpr

sequence of false positive rate.

tpr

sequence of true positive rate.

References

Xin Tong, Yang Feng, and Jingyi Jessica Li (2018), Neyman-Pearson (NP) classification algorithms and NP receiver operating characteristic (NP-ROC), Science Advances, 4, 2, eaao1659.

See Also

nproc

Examples

Run this code
# NOT RUN {
n = 200
x = matrix(rnorm(n*2),n,2)
c = 1 - 3*x[,1]
y = rbinom(n,1,1/(1+exp(-c)))
fit = rocCV(x, y, method = 'svm')
fit2 = rocCV(x, y, method = 'penlog')
fit3 = rocCV(x, y, method = 'penlog', metric = 'SS')
# }

Run the code above in your browser using DataLab