Last data update: 2014.03.03

R: Tabulate Results from Two Binary Diagnostic Tests in a Paired...
tab.pairedR Documentation

Tabulate Results from Two Binary Diagnostic Tests in a Paired Study Design

Description

Produces contingency tables of results from two binary diagnostic tests evaluated in a paired study design.

Usage

tab.paired(d, y1, y2, data = NULL, testnames, ...)

Arguments

d

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

y1

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

y2

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

data

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

testnames

An optional vector specifying the names of diagnostic test 1 and diagnostic test 2, e.g. c("Test A","Test B"). If not supplied, the variable names are used as testnames.

...

Additional arguments (usually not required).

Value

Returns a list of class tab.paired:

diseased

A contingency table (matrix) of test results among diseased subjects.

Test1 pos. Test1 neg. Total
Test2 pos. ... ... ...
Test2 neg. ... ... ...
Total ... ... ...
non.diseased

A contingency table (matrix) of test results among non-diseased subjects.

Test1 pos. Test1 neg. Total
Test2 pos. ... ... ...
Test2 neg. ... ... ...
Total ... ... ...
testnames

The names of the diagnostic tests.

Note

Objects of class tab.paired are essential arguments for various functions in the DTComPair-package.

See Also

print.tab.paired, read.tab.paired, tab.1test.

Examples

data(Paired1) # Hypothetical study data 
b <- tab.paired(d=d, y1=y1, y2=y2, data=Paired1)
str(b)
b$diseased
b$non.diseased
print(b)

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.paired.Rd_%03d_medium.png", width=480, height=480)
> ### Name: tab.paired
> ### Title: Tabulate Results from Two Binary Diagnostic Tests in a Paired
> ###   Study Design
> ### Aliases: tab.paired
> 
> ### ** Examples
> 
> data(Paired1) # Hypothetical study data 
> b <- tab.paired(d=d, y1=y1, y2=y2, data=Paired1)
> str(b)
List of 3
 $ diseased    : num [1:3, 1:3] 319 78 397 22 32 54 341 110 451
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3] "Test2 pos." "Test2 neg." "Total"
  .. ..$ : chr [1:3] "Test1 pos." "Test1 neg." "Total"
 $ non.diseased: num [1:3, 1:3] 31 53 84 22 155 177 53 208 261
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3] "Test2 pos." "Test2 neg." "Total"
  .. ..$ : chr [1:3] "Test1 pos." "Test1 neg." "Total"
 $ testnames   : chr [1:2] "y1" "y2"
 - attr(*, "class")= chr "tab.paired"
> b$diseased
           Test1 pos. Test1 neg. Total
Test2 pos.        319         22   341
Test2 neg.         78         32   110
Total             397         54   451
> b$non.diseased
           Test1 pos. Test1 neg. Total
Test2 pos.         31         22    53
Test2 neg.         53        155   208
Total              84        177   261
> print(b)
Two binary diagnostic tests (paired design)

Test1: 'y1'
Test2: 'y2'

Diseased:
           Test1 pos. Test1 neg. Total
Test2 pos.        319         22   341
Test2 neg.         78         32   110
Total             397         54   451

Non-diseased:
           Test1 pos. Test1 neg. Total
Test2 pos.         31         22    53
Test2 neg.         53        155   208
Total              84        177   261

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>