Description Usage Arguments Details Value References See Also Examples

This plot function shows the densities of the two distributions and their overlap in a single graph.

1 2 3 4 5 6 7 8 9 10 |

`ref` |
The reference standard. A column in a data frame or a vector indicating the classification by the reference test. The reference standard must be coded either as 0 (absence of the condition) or 1 (presence of the condition) |

`test` |
The index test or test under evaluation. A column in a dataset or vector indicating the test results in a continuous scale. |

`breaks` |
Breaks used to construct the histograms. Either a single integer number or a vector containing the actual breaks. In the case of a vector, the number should cover all available test values. In the case of a single integer number, this number has to be equal or lower than the discernable values in the test. For short ordinal scales a vector should be uses covering all possible test values. |

`subtitle` |
Optional subtitle |

`position.legend` |
The location can be specified by a single keyword from the list "topright", "topleft", "top", "right", "bottomright", "bottom", "bottomleft", "left" and "center". Default is "top.right". |

`colspace` |
Use colors, grayscale or only black and white as plot colors. Default = color. |

`model` |
The model used for estimation. Default = 'kernel'. Adapts also breaks and the call to the density function (parameter adjust). When the model is obviously wrong, warnings are produced. |

`...` |
passing arguments to the kernel density function, other than kernel='gaussian' (default). |

The graph shows the densities of the two distributions and their
overlap. Many tests of intermediate quality have a considerable overlap.
Also, the distributions as estimated by the `density`

function, using
the gaussian kernel is shown. The intersection is indicated by a vertical
line. This graph allows the visual inspection of the two distributions, as
well a visual inspection of the approximation of the `density`

, based
on the gaussian kernel. When the density estimation is way off, the
standard estimation of the intersection will be incorrect, and another
estimation has to be supplied.

The function `plotMD`

can also be used for visual inspection of the
Uncertain Interval (see examples).

No Value returned.

Landsheer, J. A. (2016). Interval of Uncertainty: An Alternative Approach for the Determination of Decision Thresholds, with an Illustrative Application for the Prediction of Prostate Cancer. PloS One, 11(11), e0166007.

Landsheer, J. A. (2018). The Clinical Relevance of Methods for Handling Inconclusive Medical Test Results: Quantification of Uncertainty in Medical Decision-Making and Screening. Diagnostics, 8(2), 32. https://doi.org/10.3390/diagnostics8020032

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 38 39 40 41 42 | ```
# A test of intermediate quality
set.seed(1)
ref=c(rep(0,500), rep(1,500))
test=c(rnorm(500,0,1), rnorm(500,1,1.2))
plotMD(ref, test)
ua = ui.nonpar(ref, test) # with warning message!
# Add lines to indicate Uncertain Interval
abline(v=ua[1:2])
select=(test <= ua[2] & test >= ua[1])
# plot the mixed densities for the Uncertain Interval
plotMD(ref[select], test[select])
plotMD(ref[select], test[select], colspace='gray')
plotMD(ref[select], test[select], colspace='BW')
# An ordinal test
norm = rep(1:5, times=c(33,6,6,11,2))
abnorm = rep(1:5, times=c(3,2,2,11,33))
testres = c(abnorm,norm)
truestat = c(rep(1,length(abnorm)), rep(0,length(norm)))
plotMD(ref=truestat, test=testres, model='ordinal')
# ordinal test: weak test
set.seed(2)
nobs=1000
Z0 <- rnorm(nobs, mean=0)
b0=seq(-5, 5, length.out=31) # range sufficient to cover both z0 and z1
f0=cut(Z0, breaks = b0, labels = c(1:30))
x0=as.numeric(levels(f0))[f0]
Z1 <- rnorm(nobs, mean=.5) # very weak test, not recommended for practical use
f1=cut(Z1, breaks = b0, labels = c(1:30))
x1=as.numeric(levels(f1))[f1]
test=c(x0, x1)
ref =c(rep(0, length(x0)), rep(1, length(x1)))
(pr=prop.table(table(ref, test)))
breaks=c(min(test)-.5, seq(min(test), max(test), by=1)+.5)
plotMD(ref, test, model='ordinal')
# when model = 'binormal' or 'kernel', default breaks do not work well for
# ordinal data, and have to be set by hand
plotMD(ref, test, breaks=c(min(test)-.5, seq(min(test), max(test), by=1)+.5),
model='binormal')
plotMD(ref, test, breaks=c(min(test)-.5, seq(min(test), max(test), by=1)+.5),
model='kernel')
``` |

```
test
ref 5 7 8 9 10 11 12 13 14 15
0 0.0000 0.0015 0.0025 0.0060 0.0120 0.0185 0.0335 0.0450 0.0575 0.0625
1 0.0005 0.0000 0.0005 0.0020 0.0040 0.0070 0.0175 0.0275 0.0390 0.0500
test
ref 16 17 18 19 20 21 22 23 24 25
0 0.0665 0.0555 0.0475 0.0375 0.0225 0.0160 0.0110 0.0020 0.0020 0.0005
1 0.0595 0.0695 0.0680 0.0525 0.0420 0.0300 0.0140 0.0090 0.0040 0.0020
test
ref 26 28
0 0.0000 0.0000
1 0.0010 0.0005
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.