utility_pseudo {qslice} | R Documentation |
Utility for a given target and pseudo-target
Description
Takes a pseudo-target and target (or samples from the target) and evaluates the utility function for the transformed target, which can be one of Area Under the Curve (AUC) and Mean Slice Width (MSW). See Heiner et al. (2024+).
Usage
utility_pseudo(
pseudo,
log_target = NULL,
samples = NULL,
type = "samples",
x = NULL,
nbins = 30,
plot = TRUE,
utility_type = "AUC",
tol_int = 0.001
)
Arguments
pseudo |
List containing the following functions with scalar input:
|
log_target |
Function to evaluate the log density of the unnormalized target. |
samples |
Numeric vector of samples from the target distribution. |
type |
String specifying the input type. One of "function", "samples", or "grid". Default is to use "samples". Use of "function" requires specification of Use of "samples" requires specification of Use of "grid" requires specification of |
x |
Numeric vector specifying grid (on (0,1)) over which to evaluate
the transformed target. Defaults to |
nbins |
Number of histogram bins to use (defaults to 30). Must match the length
of |
plot |
Logical for whether to generate two plots:
Defaults to |
utility_type |
String identifying utility type, either AUC (default) or MSW. |
tol_int |
Positive numeric scalar that passes to |
Details
Optionally plot the target and pseudo-target densities as well as the transformed tartet.
Value
Scalar value of the utility function evaluation.
References
Heiner, M. J., Johnson, S. B., Christensen, J. R., and Dahl, D. B. (2024+), "Quantile Slice Sampling," arXiv preprint arXiv:###.
Examples
pseu <- pseudo_list(family = "logistic", params = list(loc = 0.0, sc = 0.66))
ltarg <- list(ld = function(x) dnorm(x, log = TRUE))
oldpar <- par(mfrow = c(1,2))
utility_pseudo(pseudo = pseu, log_target = ltarg$ld, type = "function",
nbins = 100, utility_type = "MSW")
samp <- rnorm(10e3)
utility_pseudo(pseudo = pseu, samples = samp, type = "samples", utility_type = "AUC")
utility_pseudo(pseudo = pseu, samples = samp, type = "samples", utility_type = "MSW")
par(oldpar)