The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Obtaining the true value for optimal threshold.
YI_logGamma <- function(mu, sigma, start = NULL, method.optim = "L-BFGS-B",
maxit = 200, lower = 0, upper = Inf){
if(is.null(start)) start <- mean(mu)
YI_logGamma_ff <- function(par, mu, sigma){
sp <- plnorm(par, meanlog = mu[1], sdlog = sigma[1])
se <- 1 - pgamma(par, shape = mu[2], rate = sigma[2])
return(se + sp - 1)
}
YI_optim <- optim(par = start, fn = YI_logGamma_ff, mu = mu, sigma = sigma,
method = method.optim,
control = list(maxit = maxit, fnscale = -1),
lower = lower, upper = upper)
return(YI_optim)
}
CtP_logGamma <- function(mu, sigma, start = NULL, method.optim = "L-BFGS-B",
maxit = 200, lower = 0, upper = Inf){
if(is.null(start)) start <- mean(mu)
CtP_logGamma_ff <- function(par, mu, sigma){
sp <- plnorm(par, meanlog = mu[1], sdlog = sigma[1])
se <- 1 - pgamma(par, shape = mu[2], rate = sigma[2])
return((1 - sp)^2 + (1 - se)^2)
}
CtP_optim <- optim(par = start, fn = CtP_logGamma_ff, mu = mu, sigma = sigma,
method = method.optim,
control = list(maxit = maxit),
lower = lower, upper = upper)
return(CtP_optim)
}
MA_logGamma <- function(mu, sigma, start = NULL, method.optim = "L-BFGS-B",
maxit = 200, lower = 0, upper = Inf){
if(is.null(start)) start <- mean(mu)
MA_logGamma_ff <- function(par, mu, sigma){
sp <- plnorm(par, meanlog = mu[1], sdlog = sigma[1])
se <- 1 - pgamma(par, shape = mu[2], rate = sigma[2])
return(log(sp) + log(se))
}
MA_optim <- optim(par = start, fn = MA_logGamma_ff, mu = mu, sigma = sigma,
method = method.optim,
control = list(maxit = maxit, fnscale = -1),
lower = lower, upper = upper)
return(MA_optim)
}tau_logG_true_2 <- YI_logGamma(mu = mu_logG_true_2,
sigma = sigma_logG_true_2)$par
tau_logG_true_2
#> [1] 1.834898tau_CtP_logG_true_2 <- CtP_logGamma(mu = mu_logG_true_2,
sigma = sigma_logG_true_2)$par
tau_CtP_logG_true_2
#> [1] 1.761806tau_MA_logG_true_2 <- MA_logGamma(mu = mu_logG_true_2,
sigma = sigma_logG_true_2)$par
tau_MA_logG_true_2
#> [1] 1.811932sp_logG_true_2 <- plnorm(tau_logG_true_2, meanlog = mu_logG_true_2[1],
sdlog = sigma_logG_true_2[1])
se_logG_true_2 <- 1 - pgamma(tau_logG_true_2, shape = mu_logG_true_2[2],
rate = sigma_logG_true_2[2])sp_MA_logG_true_2 <- plnorm(tau_MA_logG_true_2, meanlog = mu_logG_true_2[1],
sdlog = sigma_logG_true_2[1])
se_MA_logG_true_2 <- 1 - pgamma(tau_MA_logG_true_2, shape = mu_logG_true_2[2],
rate = sigma_logG_true_2[2])X1 <- rlnorm(n1, meanlog = mu_logG_true_2[1], sdlog = sigma_logG_true_2[1])
X2 <- rgamma(n2, shape = mu_logG_true_2[2], rate = sigma_logG_true_2[2])To obtain the optimal threshold and plot the confidence region for optimal sensitivity and specificity, we perform the following command:
out1 <- threshold2(x = X1, y = X2, method = "YI", kernel_type = "gauss",
bwd_type = "AZZ", plot = TRUE)out2 <- threshold2(x = X1, y = X2, method = "YI", kernel_type = "gauss",
bwd_type = "CV", plot = FALSE)out3 <- threshold2(x = X1, y = X2, method = "MA", kernel_type = "gauss",
bwd_type = "CV", plot = TRUE)Using formula
out4 <- threshold2(formula = biom ~ diag, data = data_test, method = "MA",
kernel_type = "gauss", bwd_type = "CV", plot = TRUE)The following codes are for verifying the coverage probability of EL confidence region for sensitivity and specificity at optimal threshold.
term1 <- emplikDTA:::empi_llike_prepare(x = X1, y = X2,
tau = tau_logG_true_2,
type_F = "empi")
term2 <- emplikDTA:::empi_llike_2C(term1, spe = sp_logG_true_2,
sen = se_logG_true_2)
term2 < out1$c_alp
#> [1] FALSERun the following chunks interactively for the 1,000-replicate coverage study.
out_cp_1 <- sapply(1:1000, function(i, n1, n2){
X1 <- rlnorm(n1, meanlog = mu_logG_true_2[1], sdlog = sigma_logG_true_2[1])
X2 <- rgamma(n2, shape = mu_logG_true_2[2], rate = sigma_logG_true_2[2])
term1 <- emplikDTA:::empi_llike_prepare(x = X1, y = X2,
tau = tau_logG_true_2,
type_F = "empi")
term2 <- emplikDTA:::empi_llike_2C(term1, spe = sp_logG_true_2,
sen = se_logG_true_2)
out1 <- threshold2(x = X1, y = X2, method = "YI", kernel_type = "gauss",
bwd_type = "AZZ", plot = FALSE, seed = i)
return(c(term2, out1$c_alp, term2 < out1$c_alp))
}, n1 = 50, n2 = 50)These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.