| detc | R Documentation |
From a response and one or more predictors, the function calculates a DET curve for each response-predictor pair. Optionally, it can compute each curve with a confidence interval (CI). Instead of a response and predictors, it can also receive a 'DETs' object to extract existing DET curve results and compute CIs.
detc(
response = NULL,
predictors = NULL,
dets = NULL,
names = NULL,
conf = NULL,
positive = "",
parallel = FALSE,
ncores = detectCores(),
nboot = NULL,
plot = FALSE,
...
)
response |
A factor, typically encoded with 0 (healthy, genuine user, signal, normal) and 1 (diseased, impostor user, noise, abnormal). It can also be a dichotomous variable that will be treated as a factor. By default, the second factor level is used as the positive class. |
predictors |
A matrix whose columns represent the values of each predictor. |
dets |
A 'DETs' object which will be used to compute the DET curves. |
names |
A character vector that will be used to set the names of the DET curves. They will also appear in the plot legend. |
conf |
If present, the confidence level for the DET curve CI, within [0,1]. Default: the CI is not computed. |
positive |
A string with the name of the 'positive' level used as the reference level of 'response'. If left as the default empty string, the second factor level of 'response' is used. |
parallel |
If TRUE, the bootstrap method used to calculate the CI is processed in parallel, using the backend provided by |
ncores |
The number of nodes to be forked for the parallel computation of the CI. Default: the maximum available. None used if |
nboot |
The number of bootstrap replicates to be used for the computation of the CI. Default: 2000. |
plot |
If TRUE, the DET curves are plotted. Default: FALSE. |
... |
Further attributes that will be passed to the |
A 'DETs' object. The object's 'detCurves' attribute contains one DET curve per classifier. Each DET curve is an object of class "DET", containing the DET curve parameters (false positive ratio, false negative ratio, and thresholds), along with the Equal Error Rate (EER). If the CI was calculated, the object also includes the median,
upper, and lower CI limits for the false negative ratio and EER. Use the show method for more details about the results saved in a 'DETs' object.
library(DET)
n = 500
# Predictors with normal distribution
set.seed(1235)
scoreNegative1 = rnorm(n, mean = 0.25, sd = 0.125)
set.seed(5321)
scoreNegative2 = rnorm(n, mean = 0.25, sd = 0.125)
set.seed(11452)
scorePositive1 = rnorm(n, mean = 0.55, sd = 0.125)
set.seed(54321)
scorePositive2 = rnorm(n, mean = 0.65, sd = 0.125)
response = as.factor(c(rep(c("diseased"), times = n), rep(c("healthy"), times = n)))
predictor1 = c(scoreNegative1, scorePositive1)
predictor2 = c(scoreNegative2, scorePositive2)
predictors = matrix(c(predictor1, predictor2), ncol = 2)
colnames(predictors) = c("DET1", "DET2")
detCurves = detc(
response,
predictors,
positive = "diseased",
names = colnames(predictors)
)
# Run in parallel for faster execution by activating the logical argument
# 'parallel' and setting the number of cores of your computer
detCurvesWithConfidenceInterval = detc(
response,
predictors,
positive = "diseased",
names = colnames(predictors),
conf = 0.95,
parallel = TRUE,
ncores = 2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.