pseudo_opt {qslice}R Documentation

Optimal pseudo-target for a given target

Description

Find an optimal pseudo-target in a specified family to approximate the given (unnormalized) target (Heiner et al., 2024+). Optimize over the selected utility function.

Usage

pseudo_opt(
  log_target = NULL,
  samples = NULL,
  type = "samples",
  family = "t",
  degf = c(1, 5, 20),
  lb = -Inf,
  ub = Inf,
  utility_type = "AUC",
  nbins = 100,
  tol_opt = 1e-06,
  tol_int = 0.001,
  plot = TRUE,
  verbose = FALSE
)

Arguments

log_target

Function to evaluate the log density of the unnormalized target.

samples

Optional numeric vector providing samples from the target distribution (for use as alternative to log_target).

type

String specifying the input type. One of "function", "samples", or "grid". Default is to use "samples".

Use of "function" requires specification of log_target.

Use of "samples" requires specification of samples.

family

String specifying the family of distributions for the pseudo-target. Can be any of the families accepted by pseudo_list.

degf

Numeric vector of degrees of freedom values to try (only if family = "t". Defaults to c(1, 5, 20).

lb

Numeric scalar giving the value of left truncation. Defaults to -Inf.

ub

Numeric scalar giving the value of right truncation. Defaults to Inf.

utility_type

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

nbins

Positive integer specifying the number of histogram bins if using "samples" or "grid". Defaults to 100.

tol_opt

Positive numeric scalar that passes to reltol in the call to optim. Defaults to 1.0e-6.

tol_int

Positive numeric scalar that passes to abs.tol in the call to integrate. Defaults to 1.0e-3.

plot

Logical for whether to generate two plots:

  1. direct comparison of the target and pseudo-target densities, and

  2. transformed target density.

Defaults to TRUE.

verbose

Logical for whether to print intermediate steps of optimization. Defaults to FALSE.

Details

Optionally supply samples from the target distribution.

Value

A list with named components:

pseudo: a list with functions corresponding to the selected pseudo-target; output of pseudo_list.

utility: value of the utility function using the selected pseudo-target; output of utility_pseudo.

utility_type: repeats the input specifying the utility type.

opt: output of optim.

Other outputs repeating inputs.

References

Heiner, M. J., Johnson, S. B., Christensen, J. R., and Dahl, D. B. (2024+), "Quantile Slice Sampling," arXiv preprint arXiv:###

Examples

(pseu <- pseudo_opt(samples = rnorm(1e3), type = "samples",
               family = "t", utility_type = "AUC",
               nbins = 10, plot = TRUE,
               verbose = FALSE))
oldpar <- par(mfrow = c(1,2))
(pseu <- pseudo_opt(log_target = function(x) dnorm(x, log = TRUE),
                type = "function",
                family = "logistic", utility_type = "AUC",
                nbins = 100, plot = TRUE,
                verbose = FALSE))
(pseu <- pseudo_opt(log_target = function(x) dbeta(x, 4, 2, log = TRUE),
                lb = 0, ub = 1,
                type = "function",
                family = "cauchy", utility_type = "AUC",
                nbins = 30, plot = TRUE,
                verbose = FALSE))
par(oldpar)


[Package qslice version 0.3.1 Index]