roc: Produces ROC curve for probabilistic classifiers (e.g....

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/roc.R

Description

Computes an ROC-curve for probabilistic classifiers.

Usage

1
roc(probs, true, cutoffs)

Arguments

probs

Numeric vector, with values between 0 and 1

true

Binary vector.

cutoffs

Numeric vector, with DECREASING values between 1 and 0.

Details

The vector probs contains predicted probabilities for the response to equal 1, as produced by a probabilistic classifier like logistic regression. The cutoffs can simply represent a grid of values between 0 and 1.

Value

A matrix with two rows which contain corresponding False Positive and True Positive Rates for all cutoffs.

Author(s)

Mark A. van de Wiel

See Also

For area-under-the ROC-curve: auc. Examples: grridge.

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
# Load data objects
data(dataFarkas)

firstPartition <- CreatePartition(CpGannFarkas)

sdsF <- apply(datcenFarkas,1,sd)
secondPartition <- CreatePartition(sdsF,decreasing=FALSE, uniform=TRUE, grsize=5000)

# Concatenate two partitions
partitionsFarkas <- list(cpg=firstPartition, sds=secondPartition)

# A list of monotone functions from the corresponding partition
monotoneFarkas <- c(FALSE,TRUE)

#grFarkas <- grridge(datcenFarkas,respFarkas,optl=5.680087,partitionsFarkas,monotone=monotoneFarkas)
#grFarkascv <- grridgeCV(grFarkas,datcenFarkas,respFarkas,outerfold=10)

#cutoffs <- rev(seq(0,1,by=0.01))
#rocgrridgeF <- roc(probs=grFarkascv[,3],true=grFarkascv[,1],cutoffs=cutoffs)
#rocridgeF <- roc(probs=grFarkascv[,2],true=grFarkascv[,1],cutoffs=cutoffs)
#plot(rocridgeF[1,],rocridgeF[2,],type="l",lty=1,ann=FALSE,col="grey")
#points(rocgrridgeF[1,],rocgrridgeF[2,],type="l",lty=1,col="black")
#legend(0.75,0.1, legend=c("ridge","GRridge"),
#       lty=c(1,1), lwd=c(1,1),col=c("grey","black"))

markvdwiel/GRridge documentation built on May 21, 2019, 12:25 p.m.