diag_test: Diagnostic tests from variables.

View source: R/epi_functions.R

diag_testR Documentation

Diagnostic tests from variables.

Description

diag_test is a wrap function that calls epi.tests from package epiR. It computes sensitivity, specificity and other statistics related with screening tests.

Usage

diag_test(object = NULL, formula = NULL, data = NULL, ...)

Arguments

object

When chaining, this holds an object produced in the earlier portions of the chain. Most users can safely ignore this argument. See details and examples.

formula

A formula with shape: outcome ~ predictor (see details).

data

A data frame where the variables in the formula can be found.

...

Further arguments passed to epi.tests.

Details

For the formula, the outcome is the gold standard and the explanatory variable is the new (screening) test. See examples.

See Also

epi.tests.

Examples

## We compare the use of lung’s X-rays on the screening of TB against the gold standard test.
Freq <- c(1739, 8, 51, 22)
BCG <- gl(2, 1, 4, labels = c("Negative", "Positive"))
Xray <- gl(2, 2, labels = c("Negative", "Positive"))
tb <- data.frame(Freq, BCG, Xray)
tb <- expand_df(tb)

tb %>%
  diag_test(BCG ~ Xray)

josie-athens/pubh documentation built on Feb. 3, 2024, 4:32 a.m.