powered by
Long representation of results from two binary diagnostic tests.
represent.long(d, y1, y2)
A dataframe containing:
A numeric vector specifying the patient identifier.
A numeric vector specifying the gold-standard results (1 = presence of disease, 0 = absence of disease).
A numeric vector specifying the diagnostic test (1 = test 1, 0 = test 2).
A numeric vector specifying the test results (1 = positive, 0 = negative).
A numeric vector specifying the results of diagnostic test 1 (1 = positive, 0 = negative).
An numeric vector specifying the results of diagnostic test 2 (1 = positive, 0 = negative).
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.
d
y1
y2
In a long representation each subjects has 2 records in the dataset, one for each test. The data format is shown below.
tab.paired and read.tab.paired.
tab.paired
read.tab.paired
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)
Run the code above in your browser using DataLab