grid.auc: grid.auc

Description Usage Arguments Details Value Author(s) Examples

View source: R/grid.auc.R

Description

grid search for beta that maximize (penalized, partial) auc/sauc/rauc eauc maximizes empirical AUC, but only works with two covariates

Usage

1
2
3
grid.auc (formula, dat, beta, approx.type=NULL, approx.param=1, lambda=0, loss=TRUE, 
    t0=NULL, t1=NULL,ret.vcov = FALSE)
eauc (formula, dat,t0 = NULL, t1 = NULL)

Arguments

formula

a formula

dat

a data frame

beta

a matrix of coefficients

approx.type

a string. If NULL, AUC is computed. If "phi", normal CDF approximation SAUC is computed. If "logistic", logistic approximation SAUC is computed. If "rauc", ramp AUC approximation is computed. Defaults to NULL

approx.param

's' for rauc, 'h' for sauc

loss

a boolean. TRUE is default and means 1-(p)RAUC is computed. If lambda is not 0, loss is forced to be TRUE internally.

t0

a number between 0 and 1 that is the lower boundary of pAUC

t1

a number between 0 and 1 that is the upper boundary of pAUC

lambda

a number that scales the L2 penalty, default to 0, meaning no penalty. If lambda is not 0, loss is forced to be TRUE.

ret.vcov

logical, whether to return an estimate of the covariance matrix of 'beta' for normal or logistic sigmoid functions.

Details

eauc is a shortcut for grid.auc when empirical AUC is the objective function. When loss is FALSE, the criterion function is mean_i_j(loss) When loss is TRUE, including when lambda is not 0, the criterion function is sum_i_j(loss) + 0.5 * lambda * pen, i.e. the penalty is added to the sum of penalty and not mean of the penalty

Value

A n x n matrix

Author(s)

Shuxin Yin
Youyi Fong youyifong@gmail.com
Krisztian Sebestyen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
library(aucm)

dat = sim.dat.1(n=200,seed=1)
beta=cbind(4, 4*seq(-1,0,length=100))
dim(beta)

fit = eauc(y~x1+x2, dat)

## Not run: 
# not run due to r cmd check requirements

par(mfrow=c(3,2))

out1 = grid.auc (y~x1+x2, dat, beta, approx.param=1, loss=FALSE, t0=NULL, t1=NULL, lambda=0, 
    approx.type="rauc")
plot(out1$pars[2,]/out1$pars[1,],out1$vals,type="l",xlab=expression(beta[2]/beta[1]),main="RAUC")

# penalized RAUC
out2 = grid.auc (y~x1+x2, dat, beta, approx.param=1, loss=TRUE, t0=NULL, t1=NULL, lambda=0, 
    approx.type="rauc")
out3 = grid.auc (y~x1+x2, dat, beta, approx.param=1, loss=TRUE, t0=NULL, t1=NULL, lambda=30, 
    approx.type="rauc")
plot(out2$pars[2,]/out2$pars[1,],out2$vals,type="l",xlab=expression(beta[2]/beta[1]),
    main="penalized RAUC loss")
lines(out3$pars[2,]/out3$pars[1,],out3$vals,type="l",col=2)
out2$par
out3$par

# pRAUC
out4 = grid.auc (y~x1+x2, dat, beta, approx.param=1, loss=FALSE, t0=0, t1=0.5, lambda=0, 
    approx.type="rauc")
out5 = grid.auc (y~x1+x2, dat, beta, approx.param=1, loss=FALSE, t0=0.5, t1=1, lambda=0, 
    approx.type="rauc")
plot(out4$pars[2,]/out4$pars[1,],out4$vals,type="l",xlab=expression(beta[2]/beta[1]),main="pRAUC")
plot(out5$pars[2,]/out5$pars[1,],out5$vals,type="l",xlab=expression(beta[2]/beta[1]),main="pRAUC")
out4$par
out5$par


# penalized pRAUC
out6 = grid.auc (y~x1+x2, dat, beta, approx.param=1, loss=TRUE, t0=0, t1=0.5, lambda=0, 
    approx.type="rauc")
out7 = grid.auc (y~x1+x2, dat, beta, approx.param=1, loss=TRUE, t0=0, t1=0.5, lambda=10, 
    approx.type="rauc")
plot(out6$pars[2,]/out6$pars[1,],out6$vals,type="l",xlab=expression(beta[2]/beta[1]),
    main="penalized pRAUC loss")
lines(out7$pars[2,]/out7$pars[1,],out7$vals,type="l",col=2)
out3$par
out7$par


## End(Not run)

aucm documentation built on Jan. 11, 2020, 9:43 a.m.

Related to grid.auc in aucm...