Skip to contents

Generates a dataset from contingency tables of binary diagnostic test results in a paired study design.

Usage

generate.paired(tab, ...)

Arguments

tab

An object of class tab.paired.

...

Additional arguments (usually not required).

Value

A dataframe containing:

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).

See also

Examples

data(Paired1) # Hypothetical study data
ftable(Paired1)
#>      y2   0   1
#> d y1           
#> 0 0     155  22
#>   1      53  31
#> 1 0      32  22
#>   1      78 319
paired.layout <- tab.paired(d=d, y1=y1, y2=y2, data=Paired1)
new.df <- generate.paired(paired.layout)
head(new.df)
#>   d y1 y2
#> 1 1  1  1
#> 2 1  1  1
#> 3 1  1  1
#> 4 1  1  1
#> 5 1  1  1
#> 6 1  1  1
ftable(new.df)
#>      y2   0   1
#> d y1           
#> 0 0     155  22
#>   1      53  31
#> 1 0      32  22
#>   1      78 319