*! version 1.2.2 15dec2022

Title

dt -- Diagnostic Tests

Syntax

Syntax for dt - cross-sectional & case-control studies

dt var_test var_reference [if] [in] [weight][, options]

Immediate command

dti #a1 #a0 #b1 #b0 [, options]

Syntax for Bayes theorem

dti #sensitivity #specificity, st(bt) p(numlist)

or

dti #a1 #a0 #b1 #b0, st(bt) p(numlist)

st(type) study type; valid values are:

cs Cross-sectional (default)

cc Case-control

bt Bayes theorem

p(numlist) list of hypothetical population prevalence (%)

This option is needed for Bayes theorem

nst(string) name of the study (label)

Cross-sectional & Case-control
valtest(#neg #pos) diagnostic test variable values for negative, positive; default is valtest(0 1)

valref(#noncase #case) reference criterion variable values for noncase, case; default is valref(0 1)

wilson calculate Wilson confidence intervals; the default

exact calculate exact confidence intervals

wald calculate Wald confidence intervals

level(#) confidence level (%); default is level(95)

Case-control only
m1(#) total cases in a population sample

n(#) size of population sample

m1 and n options go together, n > m1

by is allowed; see [D] by.

fweight is allowed; see weight.

Description

Diagnostic Tests for Cross-sectional, Case-Control studies and Bayes theorem.

Cross-sectional & Case-Control

Cross-sectional and case-control studies are available. The command needs the diagnostic test and
reference criterion variables to compute the results.

For case-control studies it is possible to provide m1, n options to compute the prevalence in a
population sample. Monsour, Evans and Kupper (1991) confidence
intervals are computed for positive and negative predictive values for case-control estudies.

dti is the immediate form of dt; see immed.

The sequence of #a1, #a0, #b1 and #b0 for dti come from a contingency table:

|NonCases| Cases

+--------+--------

Positive | b1 | a1

Negative | b0 | a0

+--------+--------

Bayes theorem

For the Bayes theorem, the immediate command needs the Sensitivity (%) and Specificity (%) values, or the
#a1 #a0 #b1 #b0 values (sensitivity an specificity are computed by the command). The
list of hypothetical population prevalences is also needed to compute the results.

You can click here to pop up a dialog or type db dt. For the
immediate command, you can click here to pop up a dialog or type db dti.

Execute net from http://metodo.uab.cat/stata for install.

It is important to keep the commands updated. Execute adoupdate dt, update to update the dt command.

Execute adoupdate, update to update all the user-written commands.

This command uses the csi and cii Stata commands.

If you find any bugs or want to suggest any improvements, please send an e-mail to: leam@uab.cat.

Examples

. use http://metodo.uab.cat/stata/DiabGluc.dta

Cross-Sectional

. dt Glucose Diabetes, st(cs) valtest(0 1) valref(0 1) p(0.5 1(1)10)

. dti 65 90 48 396, st(cs) p(0.5 1(1)10)

Case-Control

. dt Glucose Diabetes, st(cc) p(2 4 6 8 10 12 15)

. dt Glucose Diabetes, st(cc) m1(98) n(765)

. dti 65 90 48 396, st(cc) p(2 4 6 8 10 12 15)

. dti 65 90 48 396, st(cc) m1(98) n(765)

Bayes theorem

. dti 90 80, st(bt) p(5 10 15 20 30 40)

. dti 65 90 48 396, st(bt) p(2 4 6 8 10)

Stored results

The command stores the following in r():

Scalars

r(level) confidence level of confidence intervals

Cross-Sectional & Case-control

r(a1) number of cases positive

r(a0) number of cases negative

r(b1) number of noncases positives

r(b0) number of noncases negatives

r(m1) total number of cases

r(m0) total number of noncases

r(n0) total number of negative (st(cs) only)

r(n1) total number of positive (st(cs) only)

r(n) total number of observations (st(cs) only)

r(m1_sample) total number of cases in the population sample (st(cc) with m1 & n options only)

r(m0_sample) total number of noncases in the population sample (st(cc) with m1 & n options only)

r(n_sample) total number of observations in the population sample (st(cc) with m1 & n options only)

r(se) sensitivity

r(lb_se) lower bound of sensitivity CI

r(ub_se) upper bound of sensitivity CI

r(sp) specificity

r(lb_sp) lower bound of specificity CI

r(ub_sp) upper bound of specificity CI

r(fp) false positive

r(lb_fp) lower bound of false positive CI

r(ub_fp) upper bound of false positive CI

r(fn) false negative

r(lb_fn) lower bound of false negative CI

r(ub_fn) upper bound of false negative CI

r(lrp) likelihood ratio +

r(lb_lrp) lower bound of likelihood ratio + CI

r(ub_lrp) upper bound of likelihood ratio + CI

r(lrn) likelihood ratio -

r(lb_lrn) lower bound of likelihood ratio - CI

r(ub_lrn) upper bound of likelihood ratio - CI

r(or) odds ratio (st(cs) only)

r(lb_or) lower bound of odds ratio CI (st(cs) only)

r(ub_or) upper bound of odds ratio CI (st(cs) only)

r(pre) sample prevalence (st(cs) or st(cc) with m1 & n options only)

r(lb_pre) lower bound of sample prevalence CI (st(cs) or st(cc) with m1 & n options only)

r(ub_pre) upper bound of sample prevalence CI (st(cs) or st(cc) with m1 & n options only)

r(pvp) predictive value + (st(cs) or st(cc) with m1 & n options only)

r(lb_pvp) lower bound of predictive value + CI (st(cs) or st(cc) with m1 & n options only)

r(ub_pvp) upper bound of predictive value + CI (st(cs) or st(cc) with m1 & n options only)

r(pvn) predictive value - (st(cs) or st(cc) with m1 & n options only)

r(lb_pvn) lower bound of predictive value - CI (st(cs) or st(cc) with m1 & n options only)

r(ub_pvn) upper bound of predictive value - CI (st(cs) or st(cc) with m1 & n options only)

r(eff) efficiency (st(cs) or st(cc) with m1 & n options only)

r(lb_eff) lower bound of efficiency CI (st(cs) only)

r(ub_eff) upper bound of efficiency CI (st(cs) only)

Bayes theorem

a1 a0 b1 b0 m1 m0 n1 n0 n are stored if information provided

r(se) sensitivity

r(sp) specificity

r(fp) false positive

r(fn) false negative

r(lrp) likelihood ratio +

r(lrn) likelihood ratio -

Matrices

r(P) Predictive values of disease if option p provided

Version

Version 1.2.2 -- 15 December 2022

Authors

JM.Doménech

Programmer: R.Sesma

Laboratori d'Estadística Aplicada

Universitat Autònoma de Barcelona

leam@uab.cat

Vancouver reference

Doménech JM. Diagnostic tests: User-written command dt for Stata [computer program].

V1.2.2. Bellaterra: Universitat Autònoma de Barcelona; 2022.

Available executing from Stata: net from http://metodo.uab.cat/stata

References

Monsour MJ, Evans AT, Kupper LL. Confidence intervals for post-test probability. Stat Med. 1991;10:443-56.

Doménech JM. Fundamentos de Diseño y Estadística. UD 3. Teoría y cálculo de
probabilidades. Pruebas diagnósticas. 16ª ed. Barcelona: Signo; 2015.