View source: R/utility_shrinkslice.R
| utility_shrinkslice | R Documentation |
Evaluates the utility function for a transformed target, which can be one of Area Under the Curve (AUC) and Mean Slice Width (MSW).
utility_shrinkslice(
h = NULL,
x = NULL,
u = NULL,
type = "samples",
nbins = 30,
plot = FALSE,
utility_type = "AUC",
options = list(tol_int = 0.001, n_opt = 10, interval_opt = c(1e-06, 0.999999))
)
h |
Function to evaluate the unnormalized transformed target
|
x |
Numeric vector of histogram locations. Not used if |
u |
Numeric vector of samples supported on unit interval ( |
type |
String specifying the utility calculation method. One of "samples", "integration", or "grid".
Use of "integration" requires |
nbins |
Number of histogram bins to use (defaults to 30). Overridden by the length of x. |
plot |
Logical for whether to plot a visualization of the transformed target.
Defaults to |
utility_type |
String identifying utility type, either "AUC" (default) or "MSW" |
options |
List containing the following. |
Calculating the utility with a function and type = 'integration' employs numerical optimization (for AUC) and numerical integration (for both AUC and MSW), which may not succeed for highly multimodal or narrow target densities.
Scalar value of the utility function evaluation.
Heiner, M. J., Johnson, S. B., Christensen, J. R., and Dahl, D. B. (2026+), "Quantile Slice Sampling," arXiv preprint arXiv:2407.12608 \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.48550/arXiv.2407.12608")}
a <- 4
b <- 2
u <- rbeta(10e3, a, b)
h <- function(x) dbeta(x, a, b)
x <- sort(runif(20))
type <- "AUC"
type <- "MSW"
utility_shrinkslice(
h = h,
x = NULL,
u = NULL,
type = "integration",
plot = TRUE,
utility_type = type
)
utility_shrinkslice(
h = h,
x = NULL,
u = NULL,
nbins = 50,
type = "grid",
plot = TRUE,
utility_type = type
)
utility_shrinkslice(
h = h,
x = x,
u = NULL,
type = "grid",
plot = TRUE,
utility_type = type
)
utility_shrinkslice(
h = NULL,
x = NULL,
u = u,
nbins = 30,
type = "samples",
plot = TRUE,
utility_type = type
)
utility_shrinkslice(
h = NULL,
x = x,
u = u,
type = "samples",
plot = TRUE,
utility_type = type
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.