Description Usage Arguments Details Value References See Also Examples
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.
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)
|
tests |
A list of |
... |
Other graphical parameters passed to |
xlab, ylab |
Characters indicating the labels of the horizantal and vertical axis. These will be passed to |
xlim, ylim |
Vectors indicating the limits of the horizantal and vertical axis. These will be passed to |
point.arg |
A |
lines.arg |
A |
auto.legend |
Logical. If |
leg.arg |
A |
SeSp.lines |
Logical. If |
SeSp.lines.arg |
A |
grid |
Logical. If |
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.
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.
Biggerstaff, B.J. Comparing diagnostic tests: a simple graphic using likelihood ratios. Statistics in Medicine. 2000; 19(5):649-663
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.