LRgraph: Comparing diagnositic tests: a simple graphic using...

Description Usage Arguments Details Value References See Also Examples

View source: R/LRgraph.R

Description

LRgraph graphically compares two or more (all of them with the first test) diagnostic tests with binary results through their likelihood ratios, based on the rationale that the predictive ability of a test is a more interesting characteristic than sensitivity or specificity alone. It is possible to see through the graph that if the tests with smaller sensitivity or specificity may have superior predictive ability, that is, increases the prediction ability with small sensitivity/specificity trade-off.

Usage

1
2
3
4
5
6
LRgraph(tests, ..., xlab = "1 - Specificity", ylab = "Sensitivity",
  ylim = c(0, 1), xlim = c(0, 1), point.arg = list(cex = 2, pch =
  1:length(tests), lwd = 2), lines.arg = list(lwd = 2, col = "red"),
  auto.legend = TRUE, leg.arg = list(x = "top", inset = -0.2, xpd = NA, ncol
  = 2, cex = 0.9, bty = "n"), SeSp.lines = TRUE, SeSp.lines.arg = list(lty =
  2, col = gray(0.4)), grid = FALSE)

Arguments

tests

A list of diagnosis objects composed by two or more tests. This object should be created listing two diagnosis objects as list(mytest1, mytest2). One may insert as many tests as one wishes. See example.

...

Other graphical parameters passed to plot.default

xlab, ylab

Characters indicating the labels of the horizantal and vertical axis. These will be passed to plot.default.

xlim, ylim

Vectors indicating the limits of the horizantal and vertical axis. These will be passed to plot.default

point.arg

A list of arguments to be passed to points. Internally the arguments x and y are replaced by the values in the tests argument. These argumentes will be used recurssively to plot points, so the arguments in list should not have a length bigger than tests.

lines.arg

A list of arguments to be passed to segments to draw the likelihood ratio lines. Internally the argument coef is replaced by the values in the tests arguments.

auto.legend

Logical. If TRUE, it makes a legend of the graph.

leg.arg

A list of arguments to be passed to legend when auto.legend = TRUE. Internally, the LRgraph removes the x and y, and the duplicated arguments from point.arg and append them to draw the legend. Therefore, some graphical parameters should be be defined in point.arg. If one whised to override them, define them in leg.arg as well. It is very important that the index.name arguments froam all tests are defined when calling the diagnosis function, as it will be passed to legend function within LRgraph and may return an error if otherwise.

SeSp.lines

Logical. If TRUE, a vertical and a horizontal lines will be drawn representing the Sensitivity and Specificity of the test.

SeSp.lines.arg

A list of arguments to be passed to abline when SeSP.lines = TRUE. Internally the arguments v and h are replaced by the values in the tests arguments.

grid

Logical. If TRUE, it calls the grid function with the deafult arguments.

Details

When a diagnostic test has both sensitivity and specificity higher than a competing test is easy to see that the former is superior than the later. However, sometimes a test may have superior sensitivity and inferior specificity (or the other way around). In this case, a good decision may be toward the test that have a better prediction ability. The graph visually helps the user to see and compare these abilities. The graph is very similar to the ROC graph. The vertical and horizontal axis have the same length as the ROC graph. However, the diagnostic tests are represented as dots instead of curves. The solid line passing through (0,0) is the likelihood ratio positive-line and the solid line passing through (1,1) is the likelihood ratio negative-line. Both negative and positive likelihood are numerically equivalent to the slopes of the solid lines. The solid lines split the graph into four areas (run the example). Also, there are dashed lines representing the sensitivity and specificity of the first test plotted. One may see that there are areas that a test may have superior sensitivity (or specificity) and yet the dot may be below the likelihood solid line. That is because the sensitivity / specificity trade-off is not reasonable, making the test with less predictive ability.

Value

Returns only a graph which is divided in four areas (by the solid lines representing the likelihood ratios of the firts test). The interpretation of the comparisons will depend on which area the competing tests will fall in. See and run the example to have the idea on how interpretation must be done.

References

Biggerstaff, B.J. Comparing diagnostic tests: a simple graphic using likelihood ratios. Statistics in Medicine. 2000; 19(5):649-663

See Also

diagnosis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Making tests with diagnosis function with different performances for comparison.
# mytest5 is the one which all others will be compared with.
# It is important to set the index.name argument to later ditinguish the tests at the plot.
mytest5 <- diagnosis(TP = 80, FN = 20, FP = 20, TN = 80, index.name = "Original")
mytest5

# mytest1 has higher sensitivity and specificity.
# mytest1 is overall superior compared to mytest5.
mytest1 <- diagnosis(TP = 90, FN = 10, FP = 10, TN = 90, index.name = "Test 1")
mytest1

# mytest2 has lower sensitivity but higher specificity.
# mytest2 is better to identify the presence of the target condition compared to mytest5.
mytest2 <- diagnosis(TP = 72, FN = 28, FP = 3, TN = 97, index.name = "Test 2")
mytest2

# mytest3 has higher sensitivity but lower specificity.
# mytest3 is better to identify the absence of the target condition compared to mytest5.
mytest3 <- diagnosis(TP = 92, FN = 8, FP = 27, TN = 63, index.name = "Test 3")
mytest3

# mytest4 has higher sensitivity and lower specificity.
# Nevertheless, mytest4 is overall inferior compared to mytest5.
mytest4 <- diagnosis(TP = 82, FN = 18, FP = 40, TN = 60, index.name = "Test 4")
mytest4

# But that becomes clear only after ploting the tests.
allmytests <- list(mytest5, mytest1, mytest2, mytest3, mytest4)
LRgraph(allmytests, grid = FALSE)

# The texts below are not part of the function but helps to understand the areas
text(x=.5, y =.5, labels ="Area 4: Overall inferior", col=gray(.6),cex=.8)
text(x=.5, y =1, labels ="Area 2: Absence", col=gray(.6),cex=.8)
text(x=.07, y =.68, labels ="Area 3: Presence", col=gray(.6),cex=.8, xpd = NA)
text(x=.1, y =1, labels ="Area 1: Overall superior", col=gray(.6),cex=.8, xpd = NA)

rm(mytest5, mytest1, mytest2, mytest3, mytest4, allmytests)

DiagnosisMed documentation built on May 2, 2019, 5:21 p.m.