GYI_normal <- function(par, mu, sigma){
ff <- function(par, mu, sigma){
tcf1 <- pnorm(par[1], mean = mu[1], sd = sigma[1])
tcf2 <- pnorm(par[2], mean = mu[2], sd = sigma[2]) -
pnorm(par[1], mean = mu[2], sd = sigma[2])
tcf3 <- 1 - pnorm(par[2], mean = mu[3], sd = sigma[3])
return(tcf1 + tcf2 + tcf3 + par[3]*(par[1] - par[2]))
}
out_optim <- optim(par = par, fn = ff, method = "L-BFGS-B",
lower = c(-Inf, -Inf, 0), upper = c(Inf, Inf, Inf),
mu = mu, sigma = sigma, control = list(fnscale = -1))
return(out_optim)
}true_GYI_normal <- GYI_normal(c(1.25, 3.1, 0.1), mu = mu_true,
sigma = sigma_true)
true_GYI_normal
#> $par
#> [1] 1.232349 3.164977 0.000000
#>
#> $value
#> [1] 2.162899
#>
#> $counts
#> function gradient
#> 9 9
#>
#> $convergence
#> [1] 0
#>
#> $message
#> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"X1 <- rnorm(n1, mu_true[1], sigma_true[1])
X2 <- rnorm(n2, mu_true[2], sigma_true[2])
X3 <- rnorm(n3, mu_true[3], sigma_true[3])out_GYI_normal <- threshold3(x = X1, y = X2, z = X3, method = "GYI",
kernel_type = "gauss", bwd_type = "AZZ", B = 1000)quantile(out_GYI_normal$out_bts[1,], probs = (1 + c(-1, 1)*0.95)/2,
type = 8, names = FALSE)
#> [1] 0.7866772 1.5308219quantile(out_GYI_normal$out_bts[2,], probs = (1 + c(-1, 1)*0.95)/2,
type = 8, names = FALSE)
#> [1] 2.230346 4.073662Run the following chunks interactively to draw a joint region at the fixed thresholds 0.5 and 3.4.
out_roc_surface <- ROC_emp_surface(X1, X2, X3, ncp = 35)
CR_tcfs(out_roc_surface, cpts = c(0.5, 3.4), fill = TRUE)
rgl::rglwidget(width = 800, height = 800)
rgl::close3d()