SensSpec: Sensitivity and Specificity

Description Usage Arguments Examples

Description

Function to calculate a table of sensitivities, specficities and error rates for classification procedures using predicted probabilities and true classification labels.

Usage

1
2
SensSpec(x, grouping, thresh = seq(0, 1, 0.05), plots = T, table = F,
  legend.loc = c(0.7 * max(thresh), 0.85))

Arguments

x

Vector of predicted probabilities for classification. For example, the predicted probabilities from a logistic model.

grouping

The vector of true class labels for the data.

thresh

Vector of desired thresholds for classification. The table will have as many rows as thresholds.

plots

Logical, plot the sensitivity, specificity and error rate curves versus the threshold vector on one plot.

table

Logical, returns the table of sensitivities, specificities and error rates for all thresholds.

legend.loc

Vector of two values for the x and y coordinate of the legend, respectively. Applicable only when plot is TRUE.

Examples

1
2
3
test.dat<-data.frame(x=rnorm(10),y=rbinom(10,2,.5))
SensSpec(test.dat$x,test.dat$y)
SensSpec(test.dat$x,test.dat$y,plot=FALSE,tab=TRUE)

mathykathy26/kagRfun documentation built on May 29, 2019, 4:40 a.m.