Skip to contents

Comprehensive error analysis for the A1 large-J approximation. Implements the error quantification framework from Lee (2026, Section 3.3).

Usage

DPprior_error_bounds(
  J,
  a,
  b,
  cJ = log(J),
  M = .QUAD_NODES_DEFAULT,
  M_verify = NULL,
  abs_tol = 1e-10,
  rel_tol = 1e-08,
  strict = FALSE
)

Arguments

J

Integer; sample size.

a, b

Numeric; Gamma hyperparameters (shape, rate).

cJ

Numeric; scaling constant (default: log(J)).

M

Integer; number of quadrature nodes (default: 80).

M_verify

Optional independent quadrature order. When omitted and an admissible order exists, the package-wide minimum max(2*M, M+40) is used automatically.

abs_tol, rel_tol

Non-negative selected-versus-verification tolerances.

strict

Logical; require successful numerical verification of the current exact moments, every adequacy-threshold scan point, and the marginal TV bound.

Value

An S3 object of class "DPprior_error_bounds" with components:

J, a, b, cJ

Input parameters

moment_errors

List of moment error metrics from a1_moment_error

tv_bounds

List with conditional and marginal TV bounds

recommendation

"A1_sufficient" or "A2_recommended"

threshold_J

First scan-grid J meeting the A1 adequacy criteria (or NA), with verified/provisional status in verification

status, verified, usable

Numerical verification state for this error-analysis computation. These fields do not assert that A1 itself is accurate; that is described by the reported errors and bounds.

verification, provenance

Numerical checks, including threshold scan provenance, and the theorem crosswalk.

Details

The recommendation is based on:

  • A1 sufficient if: mean relative error < 5\

  • A2 recommended otherwise

This function provides:

  1. Moment errors: Exact vs A1 approximation for mean and variance

  2. TV bounds: Conditional bounds at multiple alpha values, plus marginal bound

  3. Recommendation: Whether to use A1 or refine with A2

  4. Threshold: Minimum J for A1 adequacy with current prior

References

Lee, J. (2026). Design-Conditional Prior Elicitation for Dirichlet Process Mixtures. arXiv preprint arXiv:2602.06301.

Examples

# Check A1 adequacy for J=50, typical prior
bounds <- DPprior_error_bounds(J = 50, a = 1.6, b = 1.2)
print(bounds)
#> DPprior A1 Approximation Error Analysis
#> ================================================== 
#> 
#> Status:      CONVERGED
#> Verified:    yes
#> Method used: A1 error decomposition; adaptive marginal-TV integration
#> GL audit:    APPROXIMATE (absolute difference 0.000335)
#> Audit note:  Gauss-Laguerre audit orders disagree; the adaptive result is retained
#> 
#> Sample size J = 50, c_J = 3.9120
#> Gamma prior: alpha ~ Gamma(1.6000, 1.2000) [shape-rate]
#> E[alpha] = 1.3333, CV(alpha) = 0.7906
#> 
#> Moment Errors (A1 vs Exact):
#> --------------------------------------------- 
#>   E[K_J]:   exact =   5.0973, A1 =   6.2160, error =  21.95%
#>   Var(K_J): exact =   9.5500, A1 =  22.2204, error = 132.67%
#> 
#> TV Bounds:
#> --------------------------------------------- 
#>   Marginal E[d_TV] <= 0.3642
#>   At E[alpha] = 1.33:
#>     Poissonization: 0.2043 (raw: 0.9128)
#>     Linearization:  0.1804
#>     Total:          0.3846
#> 
#> Recommendation: A2_recommended
#>   No scanned J met the A1 adequacy criteria.

# For larger J, A1 becomes more adequate
bounds_200 <- DPprior_error_bounds(J = 200, a = 1.6, b = 1.2)
print(bounds_200)
#> DPprior A1 Approximation Error Analysis
#> ================================================== 
#> 
#> Status:      CONVERGED
#> Verified:    yes
#> Method used: A1 error decomposition; adaptive marginal-TV integration
#> GL audit:    APPROXIMATE (absolute difference 0.000386)
#> Audit note:  Gauss-Laguerre audit orders disagree; the adaptive result is retained
#> 
#> Sample size J = 200, c_J = 5.2983
#> Gamma prior: alpha ~ Gamma(1.6000, 1.2000) [shape-rate]
#> E[alpha] = 1.3333, CV(alpha) = 0.7906
#> 
#> Moment Errors (A1 vs Exact):
#> --------------------------------------------- 
#>   E[K_J]:   exact =   6.9134, A1 =   8.0644, error =  16.65%
#>   Var(K_J): exact =  20.3210, A1 =  38.2557, error =  88.26%
#> 
#> TV Bounds:
#> --------------------------------------------- 
#>   Marginal E[d_TV] <= 0.2994
#>   At E[alpha] = 1.33:
#>     Poissonization: 0.1500 (raw: 0.9389)
#>     Linearization:  0.1571
#>     Total:          0.3071
#> 
#> Recommendation: A2_recommended
#>   No scanned J met the A1 adequacy criteria.