utility_shrinkslice: Utility for a Transformed Target

View source: R/utility_shrinkslice.R

utility_shrinksliceR Documentation

Utility for a Transformed Target

Description

Evaluates the utility function for a transformed target, which can be one of Area Under the Curve (AUC) and Mean Slice Width (MSW).

Usage

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))
)

Arguments

h

Function to evaluate the unnormalized transformed target h(\psi) = g(\hat{\Pi}^{-1}(\psi))/\hat{\pi}(\hat{\Pi}^{-1}(\psi)) with argument \psi \in (0,1). Use h = NULL if type = "samples".

x

Numeric vector of histogram locations. Not used if u is supplied or type = "integration". If used but not supplied, a default grid is chosen.

u

Numeric vector of samples supported on unit interval (\psi) with which to create histogram (use u = NULL if type = "integration" or "grid").

type

String specifying the utility calculation method. One of "samples", "integration", or "grid". Use of "integration" requires h. Use of "samples" requires u. Use of "grid" requires h and optionally x. Default is to use "samples".

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 FALSE.

utility_type

String identifying utility type, either "AUC" (default) or "MSW"

options

List containing the following. tol_int: Positive numeric scalar that passes to abs.tol in the call to integrate() used for type = "integration". n_opt: Positive integer giving the number of initialization points for numerical optimization in AUC with type = "integration". interval_opt: Numerical vector of length two giving the interval for numerical optimization in AUC with type = "integration".

Details

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.

Value

Scalar value of the utility function evaluation.

References

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")}

Examples

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
)


qslice documentation built on Oct. 22, 2026, 1:06 a.m.