
Tabulate Results from Two Binary Diagnostic Tests in a Paired Study Design
tab.paired.RdProduces contingency tables of results from two binary diagnostic tests evaluated in a paired study design.
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,- y1and- 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.
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
#>