Last data update: 2014.03.03

R: Tabulate Single Binary Diagnostic Test vs. Gold-Standard
tab.1testR Documentation

Tabulate Single Binary Diagnostic Test vs. Gold-Standard

Description

Produces a contingency table of results from a single binary diagnostic test vs. the gold-standard results.

Usage

tab.1test(d, y, data = NULL, testname, ...)

Arguments

d

A numeric vector specifying the gold-standard results (1 = presence of disease, 0 = absence of disease).

y

A numeric vector specifying the results of the diagnostic test (1 = positive, 0 = negative).

data

An optional data frame, list or environment containing the required variables d and y.

testname

An optional character variable specifying the name of the diagnostic test, e.g. c("Test A"). If not supplied, the variable name is used as the testname.

...

Additional arguments (usually not required).

Value

Returns a list of class tab.1test:

tab.1test

A contingency table (matrix) of test results.

Diseased Non-diseased Total
Test pos. ... ... ...
Test neg. ... ... ...
Total ... ... ...
testname

The name of the diagnostic test.

Note

Objects of class tab.1test are required as arguments for acc.1test, a function to compute the accuracy of a binary diagnostic test.

See Also

tab.paired, acc.1test, acc.paired.

Examples

data(Paired1) # Hypothetical study data 
a <- tab.1test(d=d, y=y1, data=Paired1)
str(a)
a$tab.1test
a

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DTComPair)
Loading required package: gee
Loading required package: PropCIs
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DTComPair/tab.1test.Rd_%03d_medium.png", width=480, height=480)
> ### Name: tab.1test
> ### Title: Tabulate Single Binary Diagnostic Test vs. Gold-Standard
> ### Aliases: tab.1test
> 
> ### ** Examples
> 
> data(Paired1) # Hypothetical study data 
> a <- tab.1test(d=d, y=y1, data=Paired1)
> str(a)
List of 2
 $ tab.1test: num [1:3, 1:3] 397 54 451 84 177 261 481 231 712
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3] "Test pos." "Test neg." "Total"
  .. ..$ : chr [1:3] "Diseased" "Non-diseased" "Total"
 $ testname : chr "y1"
 - attr(*, "class")= chr "tab.1test"
> a$tab.1test
          Diseased Non-diseased Total
Test pos.      397           84   481
Test neg.       54          177   231
Total          451          261   712
> a
Binary diagnostic test 'y1'

          Diseased Non-diseased Total
Test pos.      397           84   481
Test neg.       54          177   231
Total          451          261   712
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>