Learn R Programming

MRMCbinary (version 1.0.5)

SensSpec: Calculate sensitivity and specificity

Description

SensSpec() is the function that calculates overall sensitivity and specificity, modality-specific sensitivity and specificity, and modality- and reader-specific sensitivity and specificity.

Usage

SensSpec(
  data,
  Modality,
  Reader,
  Case,
  D,
  Y,
  percentage = FALSE,
  digits = max(1L, getOption("digits") - 3L)
)

Value

An object of class SensSpec. The object is a data.frame with the following components:

Overall Result

Overall sensitivity and specificity

Modality-specific Result

Modality-specific sensitivity and specificity

Reader-specific Modality-specific Result

Modality- and reader-specific sensitivity and specificity

digits

The number of significant digits

The results for the SensSpec are printed with the print.SensSpec function.

Arguments

data

A data frame in which contains the modality identifiers (Modality), the reader identifiers (Reader), the case identifiers (Case), the true disease status (D), and the binary diagnostic test result (Y).

Modality

Variable of the modality identifiers.

Reader

Variable of the reader identifiers.

Case

Variable of the case identifiers.

D

Variable of the true disease status. It should be set the value to 1 for cases diseased and to 0 for those non-diseased.

Y

Variable of the binary diagnostic test result. It should be set the value to 1 for cases diagnosed as positive and to 0 for those diagnosed as negative.

percentage

Whether to report results as decimals or percentage points. Default: FALSE.

digits

Number of significant digits. Default: max(1L, getOption("digits") - 3L).

References

Yerushalmy, J. (1947). Statistical Problems in Assessing Methods of Medical Diagnosis, with Special Reference to X-Ray Techniques. Public Health Reports (1896-1970), 62(40), 1432–1449.

See Also

print.SensSpec

Examples

Run this code
## Load example data
data(VanDyke)

## Return the first parts of an object
head(VanDyke)

## Extract unique modalities
unique(VanDyke$treatment)

## Extract Unique readers
unique(VanDyke$reader)

## Create binary test results (Y_ijk)
VanDyke$Y <- as.numeric(VanDyke$rating >= 3)

## Example usage of SensSpec function:
# Report results as decimals
senspe_result1 <- SensSpec(data = VanDyke, Modality = treatment,
                           Reader = reader, Case = case,
                           D = truth, Y = Y, percentage = FALSE, digits = 3)

# Report results as percentage points
senspe_result2 <- SensSpec(data = VanDyke, Modality = treatment,
                           Reader = reader, Case = case,
                           D = truth, Y = Y, percentage = TRUE, digits = 1)

Run the code above in your browser using DataLab