| Title: | Calibrated Gibbs Posteriors for Tolerance Intervals |
|---|---|
| Description: | Provides tools for constructing one-sided and two-sided nonparametric tolerance intervals using calibrated Gibbs posteriors. The methods target population quantiles and content levels while achieving nominal frequentist coverage through data-driven calibration. The methodology is described in Pourmohamad, Richardson, and Sansó (2026) <doi:10.1080/00401706.2026.2699103>. |
| Authors: | Tony Pourmohamad [aut, cre], Robert Richardson [aut], Bruno Sansó [aut] |
| Maintainer: | Tony Pourmohamad <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-07-22 10:51:11 UTC |
| Source: | https://github.com/cran/gibbsTI |
Constructs a one-sided or two-sided nonparametric tolerance interval from a
calibrated Gibbs posterior. The learning rate eta is chosen automatically by
Gibbs posterior calibration (GPC) so that the interval attains the nominal
frequentist coverage, or it can be fixed by the user.
gibbsTI( x, side = c("one", "two"), type = c("upper", "lower"), target = c("content", "quantile"), content = 0.95, confidence = 0.9, tau = NULL, tau_lower = NULL, tau_upper = NULL, eta_method = c("GPC", "fixed"), eta = NULL, max_iter = 15, control = list(), n_mcmc = 5000, burnin = 1000, thin = 1, seed = NULL, verbose = TRUE )gibbsTI( x, side = c("one", "two"), type = c("upper", "lower"), target = c("content", "quantile"), content = 0.95, confidence = 0.9, tau = NULL, tau_lower = NULL, tau_upper = NULL, eta_method = c("GPC", "fixed"), eta = NULL, max_iter = 15, control = list(), n_mcmc = 5000, burnin = 1000, thin = 1, seed = NULL, verbose = TRUE )
x |
Numeric vector of observations (at least 5, all finite). |
side |
Direction of the interval: |
type |
For one-sided intervals only, |
target |
Calibration target: |
content |
Population proportion the interval should contain, in (0, 1)
(e.g. 0.95). Used when |
confidence |
Frequentist confidence level in (0, 1) (e.g. 0.90). This is
both the GPC coverage target ( |
tau |
Target quantile for a one-sided |
tau_lower, tau_upper
|
Lower/upper target quantiles for a two-sided
|
eta_method |
How the Gibbs learning rate |
eta |
Gibbs learning rate (positive). Optional starting value when
|
max_iter |
Maximum number of Robbins-Monro iterations for the GPC search
(default 15). Only used when |
control |
A list of control parameters for the MCMC samplers and GPC:
|
n_mcmc |
Number of posterior draws retained for the final interval, after burn-in and thinning (default 5000). |
burnin |
Number of initial iterations discarded as burn-in (default 1000). |
thin |
Thinning interval: every |
seed |
Optional integer random seed for reproducibility. |
verbose |
Logical; if |
An object of class "gibbsTI": a list with the fitted
interval (a numeric limit for one-sided fits, or a list with lower and
upper for two-sided fits), the calibrated eta, the retained posterior
samples, the data, the quantile level(s) tau_used, calibration
diagnostics (calibrated_coverage, eta_history), and the settings used.
Use print(), summary(), and plot() on the result.
set.seed(1) x <- rnorm(50) # Fast: fix the learning rate (no calibration search) fit <- gibbsTI(x, side = "one", type = "upper", eta_method = "fixed", eta = 1, n_mcmc = 500, burnin = 200, verbose = FALSE) print(fit) # Data-driven GPC calibration (slower) for a two-sided 95%/90% interval fit2 <- gibbsTI(x, side = "two", content = 0.95, confidence = 0.90, seed = 1, verbose = FALSE) summary(fit2)set.seed(1) x <- rnorm(50) # Fast: fix the learning rate (no calibration search) fit <- gibbsTI(x, side = "one", type = "upper", eta_method = "fixed", eta = 1, n_mcmc = 500, burnin = 200, verbose = FALSE) print(fit) # Data-driven GPC calibration (slower) for a two-sided 95%/90% interval fit2 <- gibbsTI(x, side = "two", content = 0.95, confidence = 0.90, seed = 1, verbose = FALSE) summary(fit2)