nproc {nproc}R Documentation

Calculate the Neyman-Pearson Receiver Operating Characteristics

Description

nproc calculates the Neyman-Pearson Receiver Operating Characteristics band for a given sequence of type I error values.

Usage

nproc(x = NULL, y, method = c("logistic", "penlog", "svm", "randomforest",
  "lda", "nb", "nnb", "ada", "tree"), delta = 0.05, split = 1,
  split.ratio = 0.5, n.cores = 1, randSeed = 0, ...)

Arguments

x

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

y

n 0/1 observatons.

method

base 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

  • nnb: Nonparametric Naive Bayes. naive_bayes in naivebayes package

  • ada: Ada-Boost. ada in ada package

delta

the violation rate of the type I error. Default = 0.05.

split

the number of splits for the class 0 sample. Default = 1. For ensemble version, choose split > 1.

split.ratio

the ratio of splits used for the class 0 sample to train the classifier. Default = 0.5.

n.cores

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

randSeed

the random seed used in the algorithm.

...

additional arguments.

Value

An object with S3 class nproc.

typeI.u

sequence of upper bound of type I error.

typeII.l

sequence of lower bound of type II error.

typeII.u

sequence of upper bound of type II error.

auc.l

the auc value of the lower NP-ROC curve.

auc.u

the auc value of the upper NP-ROC curve.

method

the base classification method implemented.

delta

the violation 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

npc

Examples

n = 200
x = matrix(rnorm(n*2),n,2)
c = 1 - 3*x[,1]
y = rbinom(n,1,1/(1+exp(-c)))
#fit = nproc(x, y, method = 'svm')
fit2 = nproc(x, y, method = 'penlog')
##Plot the nproc curve
plot(fit2)

## Not run: 
fit3 = nproc(x, y, method = 'penlog',  n.cores = 2)
#In practice, replace 2 by the number of cores available 'detectCores()'
fit4 = nproc(x, y, method = 'penlog', n.cores = detectCores())

#Confidence nproc curves
fit6 = nproc(x, y, method = 'lda')
plot(fit6)
nproc ensembled version
fit7 = nproc(x, y, method = 'lda', split = 11)
plot(fit7)

## End(Not run)


[Package nproc version 2.1.5 Index]