Description Usage Arguments Value Author(s) See Also Examples
Find the ROC true-positive (TP) rate for a given false-positive (FP) rate.
1 2 3 |
truth |
A |
data |
A |
fpRate |
A |
acc |
A |
recall |
(Optional) Unless |
hasNAs |
If |
isOrdered |
If |
... |
Not used. |
.checkArgs |
If |
verbose |
See |
Returns a list
with elements:
tpRateEst,tpRateEstRange |
The estimated TP rate with lower and upper limits. |
fpRateEst,fpRateEstRange |
The estimated FP rate with lower and upper limits. This should be close to the request target FP rate. |
fpRate |
The target FP rate (equals the corresponding argument). |
callRate |
Fraction of data points called. If less than one, for instance data points with missing values may have been excluded. |
orderedIdxs |
The indices of the ordered data points corresponding to the lower and upper limits. |
w |
The weights of the lower and upper limits. |
Henrik Bengtsson
findRocSmoothingForTpAtFp
().
scanRocTpAtFp
().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | n <- 1000
x <- rnorm(n=n, mean=0, sd=1)
y <- rnorm(n=n, mean=2, sd=1)
T <- integer(2*n)
T[1:n] <- 1L
D <- c(x,y)
fit <- fitRoc(T,D)
par(xaxs="i", yaxs="i")
xlim <- c(0, 0.5)
plot(fit$roc, type="l", lwd=3, xlim=xlim, ylim=c(1-xlim[2], 1))
adj <- c(-0.05,-0.2)
for (fpRate in c(0.2, 0.4)) {
fit <- findRocTpAtFp(T,D, fpRate=fpRate)
fp <- fit$fpRateEst
tp <- fit$tpRateEst
lines(x=c(0,fp,fp), y=c(tp,tp,xlim[2]))
text(x=fp, y=xlim[2], sprintf("FP rate: %.3f", fp), srt=90, adj=adj)
text(x=0, y=tp, sprintf("TP rate: %.3f", tp), adj=adj)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.