This project implements and visualizes pointwise credible bands around the posterior mean cumulative distribution function (CDF) under a Dirichlet Process (DP), following the Bayesian non-parametric approach.
A description of the statistical problem, methodology, and theoretical background
is provided in the file Problem description.pdf.
The goal is to:
- compute the posterior mean CDF,
- generate approximate posterior draws via the Pólya urn scheme,
- construct pointwise credible bands by taking empirical quantiles at each grid point,
- visualize how the bands and posterior mean evolve with the sample size and with the concentration parameter (\theta).
The core algorithms are implemented in src/CredibleBandsDP.jl, while all experiments and
figures are produced by scripts in the scripts/ folder.
-
API stabilization and types.
The main routine returns a typed containerPointwiseBandsResult{T}rather than an unstructured tuple. This makes the interface explicit (res.grid,res.lower,res.upper, etc.) and improves type stability and readability. -
Generic programming and multiple dispatch.
Functions accept generic inputs such asrng::AbstractRNGandgrid::AbstractVector{<:Real}. Internally, a simple conversion boundary is used to perform computations inFloat64, keeping the implementation robust and numerically stable. -
Mutating functions and performance patterns.
Performance-critical routines are written in mutating form (functions ending with!), operate on preallocated arrays, and use@inboundsandviewto avoid unnecessary allocations inside hot loops. -
Reproducibility.
The project relies on a local Julia environment (Project.toml/Manifest.toml) and deterministic random number generators in the scripts.
-
The constructed credible bands are pointwise credible intervals, not simultaneous credible regions. As discussed in the reference literature, they do not control the global coverage probability and should be interpreted accordingly.
-
No explicit parallelism or systematic benchmarking is implemented. This is a deliberate choice: for the problem sizes considered here, the simulations run in reasonable time on a single core.
src/CredibleBandsDP.jl: core DP routines (Pólya urn sampler, ECDF on a grid, posterior mean CDF, pointwise bands).scripts/: scripts to reproduce the figures discussed in the project.Problem description.pdf: detailed explanation of the statistical problem and theory.Project.toml,Manifest.toml: reproducible Julia environment.
From the repository root:
julia --project=. -e "using Pkg; Pkg.instantiate()"
julia --project=. scripts/Credible_intervals_different_ns.jl