Last data update: 2014.03.03

R: Add threshold lines to a plot (three-state setting)
lines.thres3R Documentation

Add threshold lines to a plot (three-state setting)

Description

The function includes vertical lines for the thresholds and confidence intervals in a plot created with plot.thres3().

Usage

## S3 method for class 'thres3'
lines(x, ci = TRUE, which.boot = c("norm", "perc"),
  col = 1, lty = c(1, 2), lwd = 1, ...)

Arguments

x

an object of class thres3.

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". This argument is ignored if parametric confidence intervals were computed.

col

color for the thresholds and their corresponding confidence intervals. Default, 1.

lty

a 2-dimensional vector containing:

lty[1]: line type for the thresholds

lty[2]: line type for the confidence intervals

Default, c(1, 2).

lwd

line width for the thresholds and their corresponding confidence intervals. Default, 1.

...

further arguments to be passed to abline().

Value

With a plot.thres3 open, this function adds lines for the required threshold estimates.

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, plot.thres3

Examples

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))
thres1 <- thres3(k1, k2, k3, rho, dist1="norm", dist2="norm",
                 dist3="norm", start=start, ci.method="param") 

# not assuming trinormality
start2 <- c(0.05, 0.6, 0.5, 0.95)
set.seed(2014)
thres2 <- thres3(k1, k2, k3, rho, start=start2, B=1000,
                ci.method="boot", dist1="lnorm", dist2="norm",
                dist3="norm") 
plot(thres2, leg.pos="topright", leg.cex=0.8, col=1:4)
lines(thres1, col=5)

Results