thres2(k1, k2, rho,
costs = matrix(c(0, 0, 1, (1 - rho)/rho), 2, 2, byrow = TRUE),
method = c("equal", "unequal", "empirical", "parametric"),
dist1 = NULL, dist2 = NULL, ci.method = c("delta", "boot"),
B = 1000, alpha = 0.05, extra.info = FALSE, na.rm = FALSE)"equal". See Details for more information about the methods available."delta". See Details for more information about the methods available.ci.method="boot". Otherwise, ignored. Default, 1000.method="empirical", if set to TRUE the function returns extra information about the computation of the threshold. Ignored when method is not "empirical". Default, FALSE.NA values in k1 and k2 should be stripped before the computation proceeds. Default, FALSE.thres2, which is a list with two components:thres threshold estimate.
prev disease prevalence provided by the user.
costs cost matrix provided by the user.
R R term, the product of the non-disease odds and the cost ratio (for further details about this concept, see References).
method method used in the estimation.
k1 vector containing the healthy sample values provided by the user.
k2 vector containing the diseased sample values provided by the user.
When method = "empirical", T also contains:
sens sensitivity obtained.
spec specificity obtained.
cost the minimum cost associated with T$thres.
tot.thres vector of possible thresholds. Only if extra.info = T.
tot.cost vector of empirical costs. Only if extra.info = T.
tot.spec.c complementary of the vector of empirical specificities (1-spec). Only if extra.info = T.
tot.sens vector of empirical sensitivities. Only if extra.info = T.
When method = "parametric", T also contains:
dist1 distribution assumed for the healthy population.
dist2 distribution assumed for the diseased population.
pars1 a numeric vector containing the estimation of the parameters of dist1.
pars2 a numeric vector containing the estimation of the parameters of dist2.ci.method="delta", a list of four components:
lower the lower limit of the confidence interval.
upper the upper limit of the confidence interval.
alpha significance level provided by the user.
ci.method method used for the confidence intervals computation.
When ci.method="boot", a list of seven components:
low.norm the lower limit of the bootstrap confidence interval based on the normal distribution.
up.norm the upper limit of the bootstrap confidence interval based on the normal distribution.
low.perc the lower limit of the bootstrap confidence interval based on percentiles.
up.perc the upper limit of the bootstrap confidence interval based on percentiles.
alpha significance level provided by the user.
B number of bootstrap resamples.
ci.method method used for the confidence intervals computation.method the user can choose between "equal" (assumes binormality and equal variances), "unequal" (assumes binormality and unequal variances), "empirical" (leaves out any distributional assumption) or "parametric" (based on the distribution assumed for the two populations).
Parameters dist1 and dist2 can be chosen between the following 2-parameter distributions: "beta", "cauchy", "chisq" (chi-squared), "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 computed by bootstrap).thresTH2, plot.thres2, lines.thres2# 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) # non-diseased
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")
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")Run the code above in your browser using DataLab