auc | R Documentation |
Calculate the histogram approximation to the area under the curve after restricting the curve to fit within the unit square. Specifically, the highest histogram bar reaches 1 and the support is the unit interval. See Heiner et al. (2024+).
auc(u = NULL, x = NULL, y = NULL, nbins = 30)
u |
Numeric vector of samples supported on unit interval with which to
create a histogram (use |
x |
Numeric vector of histogram locations. (Not used if |
y |
Numeric vector of histogram heights OR function evaluating the curve
for a given value of |
nbins |
Number of histogram bins to use (defaults to 30). |
Accepts either samples u
or a function y
representing a (possibly
unnormalized) probability density supported on the unit interval.
The (approximate) area under the curve as a numeric value of length one.
Heiner, M. J., Johnson, S. B., Christensen, J. R., and Dahl, D. B. (2024+), "Quantile Slice Sampling," arXiv preprint arXiv:###.
u_samples <- rbeta(10e3, 2, 2)
auc(u = u_samples)
auc(u = u_samples, nbins = 50)
auc(y = function(x) {dbeta(x, 2, 2)}, nbins = 30)
auc(y = function(x) {dbeta(x, 2, 2)}, nbins = 300)
xx <- seq(0.001, 0.999, length = 1000)
auc(x = xx, y = function(x) {dbeta(x, 2, 2)})
auc(x = xx, y = dbeta(xx, 2, 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.