Long Representation of Results from Two Binary Diagnostic Tests

Description

Long representation of results from two binary diagnostic tests.

Usage

1
represent.long(d, y1, y2)

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

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

Details

Sometimes a long representation of data from a “paired” study of binary diagnostic tests is required, e.g. to run regression analyses.

In a wide representation each subject has 1 record in the dataset containing d, y1 and y2.

In a long representation each subjects has 2 records in the dataset, one for each test. The data format is shown below.

Value

A dataframe containing:

id

A numeric vector specifying the patient identifier.

d

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

x

A numeric vector specifying the diagnostic test (1 = test 1, 0 = test 2).

y

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

See Also

tab.paired and read.tab.paired.

Examples

1
2
3
4
5
data(Paired1) # Hypothetical study data
names(Paired1)
new.long <- represent.long(d=Paired1$d, y1=Paired1$y1, y2=Paired1$y2)
str(new.long)
head(new.long)