Description Usage Arguments Details Value Note References See Also Examples
View source: R/ThresholdROC2states.R
This function calculates the threshold estimate and its corresponding confidence interval in a twostate setting.
1 2 3 4 5 6  thres2(k1, k2, rho,
costs = matrix(c(0, 0, 1, (1  rho)/rho), 2, 2, byrow = TRUE),
R=NULL,
method = c("equal", "unequal", "empirical", "smooth", "parametric"),
dist1 = NULL, dist2 = NULL, ci = TRUE, ci.method = c("delta", "boot"),
B = 1000, alpha = 0.05, extra.info = FALSE, na.rm = FALSE, q1=0.05, q2=0.95)

k1 
vector containing the healthy sample values. 
k2 
vector containing the diseased sample values. 
rho 
disease prevalence. 
costs 
cost matrix. Costs should be entered as a 2x2 matrix, where the first row corresponds to the true positive and true negative costs and the second row to the false positive and false negative costs. Default cost values are a combination of costs that yields R=1, which is equivalent to the Youden index method (for details about this concept, see References). It must be set to 
R 
if the cost matrix 
method 
method used in the estimation. The user can specify just the initial letters. Default, 
dist1 
distribution to be assumed for the healthy population. See Details. 
dist2 
distribution to be assumed for the diseased population. See Details. 
ci 
should a confidence interval be calculated? Default, 
ci.method 
method to be used for the confidence intervals calculation. The user can specify just the initial letters. Default, 
B 
number of bootstrap resamples when 
alpha 
significance level for the confidence interval. Default, 0.05. 
extra.info 
when using 
na.rm 
a logical value indicating whether 
q1 
probability of the left distribution in order to determine a low quantile when 
q2 
probability of the right distribution in order to determine a high quantile when 
For parameter method
the user can choose between "equal"
(assumes binormality and equal variances), "unequal"
(assumes binormality and unequal variances), "empirical"
(leaves out any distributional assumption), "smooth"
(leaves out any distributional assumption, but uses a kernel to estimate the densities) or "parametric"
(based on the distribution assumed for the two populations).
Parameters dist1
and dist2
can be chosen between the following 2parameter distributions: "beta"
, "cauchy"
, "chisq"
(chisquared), "gamma"
, "lnorm"
(lognormal), "logis"
(logistic), "norm"
(normal) and "weibull"
. Notice that dist1
and dist2
are only needed when method = "parametric"
.
For parameter ci.method
the user can choose between "delta"
(delta method is used to estimate the threshold standard error assuming a binormal underlying model) or "boot"
(the confidence interval is calculated by bootstrap).
An object of class thres2
, which is a list with two components:
T 
a list of at least seven components:
When
When

CI 
When
When
When 
It is assumed that k1
is the sample with lower values. If that is not the case, k1
and k2
(and the corresponding parameters) are exchanged.
Efron B, Tibshirani RJ. (1993). An introduction to the bootstrap, Chapman & Hall.
Skaltsa K, Jover L, Carrasco JL. (2010). Estimation of the diagnostic threshold accounting for decision costs and sampling uncertainty. Biometrical Journal 52(5):676697.
thresTH2
, plot.thres2
, lines.thres2
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 43 44 45 46 47  # example 1
n1 < 100
n2 < 100
set.seed(1234)
par1.1 < 0
par1.2 < 1
par2.1 < 2
par2.2 < 1
rho < 0.2
k1 < rnorm(n1, par1.1, par1.2) # nondiseased
k2 < rnorm(n2, par2.1, par2.2) # diseased
thres2(k1, k2, rho, method="eq", ci.method="d")
thres2(k1, k2, rho, method="uneq", ci.method="d")
# specify R instead of (default) costs
thres2(k1, k2, rho, costs=NULL, R=2, method="uneq", ci.method="d")
## Not run:
thres2(k1, k2, rho, method="empirical", ci.method="b")
# example 2
set.seed(1234)
k1 < rnorm(50, 10, 3)
k2 < rlnorm(55)
rho < 0.3
thres2(k1, k2, rho, method="param", ci.method="boot", dist1="norm", dist2="lnorm")
## End(Not run)
# supress confidence intervals calculation
thres2(k1, k2, rho, method="equal", ci=FALSE)
thres2(k1, k2, rho, method="empirical", ci=FALSE)
# example 3
n1 < 100
n2 < 100
set.seed(1234)
par1.1 < 0
par1.2 < 1
par2.1 < 2
par2.2 < 1
rho < 0.2
k1 < rnorm(n1, par1.1, par1.2) # nondiseased
k2 < rnorm(n2, par2.1, par2.2) # diseased
## Not run:
thres2(k1, k2, rho, method="smooth", ci.method="b")
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.