-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I got this behavior which looks like a bug. It appears both in the package from CRAN and in the latest version from GitHub. Here is a reproducible example:
library(ModelMetrics)
observed <- structure(c(1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L), .Label = c("+",
"-"), class = "factor")
yprob <- c(0.11, 0.19, 0.89, 0.3, 0.33, 0.92, 0.48, 0.03, 0.09, 0.13)
sensitivity(observed, yprob, 0.1)
sensitivity(observed, yprob, 0.2)
sensitivity(observed, yprob, 0.3)
sensitivity(observed, yprob, 0.4)
sensitivity(observed, yprob, 0.5)
specificity(observed, yprob, 0.6)
specificity(observed, yprob, 0.7)
specificity(observed, yprob, 0.8)
specificity(observed, yprob, 0.9)
specificity(observed, yprob, 1.0)
Notice that sensitivity() accepts a factor as input but the same is not valid for specificity(). Using as.numeric(observed) doesn't work, but it is ok if as.numeric(observed == "+") is used.
Metadata
Metadata
Assignees
Labels
No labels