Learn R Programming

ThresholdROC (version 2.2)

plot.thres3: Thresholds and density plot (three-state setting)

Description

The function provides a graphic including the three sample densities, the thresholds and their confidence intervals.

Usage

## S3 method for class 'thres3':
plot(x, bw = c("nrd0", "nrd0", "nrd0"), ci = TRUE,
  which.boot = c("norm", "perc"), col = c(1, 2, 3, 1),
  lty = c(1, 1, 1, 1, 2), lwd = c(1, 1, 1, 1),
  main = paste0("Threshold estimates", ifelse(ci, " and CIs", "")),
  xlab = "", legend = TRUE, leg.pos = "topleft", leg.cex = 1, ...)

Arguments

x
an object of class thres3.
bw
vector containing the bandwith for the first sample in the first position, the bandwith for the second sample in the second position and the bandwith for the third sample in the third position (to be passed to density()). Default, c("nr
ci
should the confidence intervals be plotted? Default, TRUE.
which.boot
in case x contains confidence intervals computed by bootstrapping, which one should be printed? The user can choose between "norm" (based on normal distribution) or "perc" (based on percentiles). Default, "norm
col
a 4-dimensional vector containing: col[1]: color for the density of the first sample col[2]: color for the density of the second sample col[3]: color for the density of the third sample
lty
a 5-dimensional vector containing: lty[1]: line type for the density of the first sample lty[2]: line type for the density of the second sample lty[3]: line type for the density of the third sample
lwd
a 4-dimensional vector containing: lwd[1]: line width for the density of the first sample lwd[2]: line width for the density of the second sample lwd[3]: line width for the density of the third sampl
legend
logical asking if an automatic legend should be added to the graph. Default, TRUE.
leg.pos
position of the legend. Default, "topleft". Ignored if legend=FALSE.
leg.cex
number that reescales the size of the legend. Ignored if legend=FALSE. Default, 1.
main, xlab, ...
further arguments to be passed to plot().

Value

  • Estimates of the density functions for the three samples and vertical lines representing the thresholds and their confidence limits are drawn.

References

Skaltsa K, Jover L, Fuster D, Carrasco JL. (2012). Optimum threshold estimation based on cost function in a multistate diagnostic setting. Statistics in Medicine, 31:1098-1109.

See Also

thres3, lines.thres3

Examples

Run this code
set.seed(1234)
n <- 100
k1 <- rlnorm(n)
k2 <- rnorm(n, 3, 1)
k3 <- rnorm(n, 5, 1)
rho <- c(1/3, 1/3, 1/3)

# assuming trinormality
start <- c(mean(k1), mean(k3)) 
thres <- thres3(k1, k2, k3, rho, dist1="norm", dist2="norm",
                dist3="norm", start=start, ci.method="param") 
plot(thres, leg.pos="topright")

# not assuming trinormality
thres <- thres3(k1, k2, k3, rho, dist1="lnorm", dist2="norm",
                dist3="norm", ci.method="boot") 
plot(thres, leg.pos="topright", which.boot="perc")

Run the code above in your browser using DataLab