plotCostROC: Plot cost function and ROC curve

View source: R/ThresholdROC-2states.R

plotCostROCR Documentation

Plot cost function and ROC curve

Description

This function plots the ROC curve and the cost function associated to the disease prevalence and costs.

Usage

plotCostROC(x, type = "l", which.plot, ...)

Arguments

x

an object of class thres2 or thres3. See Details.

type

1-character string giving the type of plot desired. Default, "l". See Details.

which.plot

which plot should be produced? The user can choose between "both" (default, which plots both cost function and ROC curve), "cost" (only plots cost function) or "roc" (only plots ROC curve). It only applies to objects of class thres2, therefore this argument has no effect if x is an object of class thres3.

...

other graphical parameters to be passed to plot().

Details

If the argument x was constructed with method="empirical", the argument extra.info should be switched to TRUE (this only applies when x is an object of class thres2).

For parameter type the following values are possible: "p" for points, "l" for lines, "b" for both points and lines, "c" for empty points joined by lines, "o" for overplotted points and lines, "s" and "S" for stair steps and "h" for histogram-like vertical lines. Finally, "n" does not produce any points or lines.

Value

When x is an object of class thres2, two plots are produced. The first one shows the cost function with the cost minimising threshold in red. The second one is the step ROC curve with the sensitivity and specificity achieved in red. If method = "empirical" is used when building x, empirical cost function and ROC curve are plotted. If method = "smooth" is used when building x, smooth cost function and ROC curve are plotted.

When x is an object of class thres3, two plots are produced. The first one shows the cost function C(T1) with the first cost minimising threshold in red. The second one shows the cost function C(T2) with the second cost minimising threshold in red.

Note

This function uses the plot() function and further arguments can be set to customise the resulting plot.

References

Skaltsa K, Jover L, Carrasco JL. (2010). Estimation of the diagnostic threshold accounting for decision costs and sampling uncertainty. Biometrical Journal 52(5):676-697.

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

thres2

Examples

## Not run: 
# example 1: x is an object of class 'thres2'
n1 <- 100
n2 <- 100
set.seed(19998)
par1.1 <- 0
par1.2 <- 1
par2.1 <- 2
par2.2 <- 1
rho <- 0.3
k1 <- rnorm(n1, par1.1, par1.2) # non-diseased
k2 <- rnorm(n2, par2.1, par2.2) # diseased
x <- thres2(k1, k2, rho, method="emp", ci.method="boot", extra=TRUE)

par(mfrow=c(1,2))
plotCostROC(x)


# example 2: x is an object of class 'thres3'
set.seed(2015)
n <- 100
k1 <- rlnorm(n)
k2 <- rnorm(n, 3, 1)
k3 <- rnorm(n, 5, 1)
rho <- c(1/3, 1/3, 1/3)
y <- thres3(k1, k2, k3, rho, B=1000, ci.method="boot", dist1="lnorm", dist2="norm", dist3="norm") 

par(mfrow=c(1,2))
plotCostROC(y)

## End(Not run)

ThresholdROC documentation built on Aug. 30, 2023, 1:08 a.m.