# \[ANN\] BetaKDE.jl: Boundary-Corrected Beta Kernel Density Estimation

**URL:** <https://discourse.julialang.org/t/ann-betakde-jl-boundary-corrected-beta-kernel-density-estimation/137057>\
**Category:** Package Announcements\
**Tags:** package, statistics, machine-learning, math\
**Created:** [May 9, 2026, 10:55pm UTC](https://discourse.julialang.org/t/ann-betakde-jl-boundary-corrected-beta-kernel-density-estimation/137057 "2026-05-09T22:55:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![egonmedhatten](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/egonmedhatten/32/221850_2.png) [@egonmedhatten](https://discourse.julialang.org/u/egonmedhatten)\
**Post date:** [May 9, 2026, 10:55pm UTC](https://discourse.julialang.org/t/ann-betakde-jl-boundary-corrected-beta-kernel-density-estimation/137057/1 "2026-05-09T22:55:52Z")

</div>

I am pleased to announce the release of [BetaKDE.jl](https://github.com/egonmedhatten/BetaKDE.jl), a package for boundary-corrected density estimation on the unit interval [0,1].

Standard KDE with Gaussian kernels suffers from severe boundary bias when applied to data with strict compact support (e.g., proportions, probabilities, or copula data). To address this, this package implements Chen’s beta kernel estimator alongside a newly derived closed-form Beta Reference Rule for bandwidth selection. This provides a rigorous rule-of-thumb solution that avoids the instability and computational overhead of numerical optimization routines like LSCV.

**Key Features:**

- Implements Chen’s beta kernel for strictly bounded data in [0,1].
- Natively provides the closed-form Beta Reference Rule bandwidth selector.
- **Ecosystem compatibility:** Includes a `Plots.jl` recipe, `StatsBase.jl` `fit` support, `Distributions.jl` point evaluations (`pdf`, `logpdf`), and full `DensityInterface.jl` compatibility for use in Bayesian workflows.
- For cross-language workflows, this method is also available in Python via [`beta-kde`](https://pypi.org/project/beta-kde/). Furthermore, it has been integrated as the default bandwidth selector (under the identifier “HS”) for beta kernels in the standard R package [`kdensity`](https://cran.r-project.org/web/packages/kdensity/index.html) (v1.2.0+).

The mathematical derivation of the bandwidth rule has been accepted for publication in the _Journal of Computational and Graphical Statistics (JCGS)_. The preprint is available on arXiv: [https://arxiv.org/abs/2601.19553](https://arxiv.org/abs/2601.19553)

Feedback and pull requests are welcome!
