Learn R Programming

BKP: An R Package for Beta Kernel Process Modeling

We present BKP, a user-friendly and extensible R package that implements the Beta Kernel Process (BKP)—a fully nonparametric and computationally efficient framework for modeling spatially varying binomial probabilities. The BKP model combines localized kernel-weighted likelihoods with conjugate beta priors, resulting in closed-form posterior inference without requiring latent variable augmentation or intensive MCMC sampling. The package supports binary and aggregated binomial responses, allows flexible choices of kernel functions and prior specification, and provides loss-based kernel hyperparameter tuning procedures. In addition, BKP extends naturally to the Dirichlet Kernel Process (DKP) for modeling spatially varying multinomial data.

Features

  • ✅ Bayesian modeling for binomial and multinomial count data
  • ✅ Kernel-based local information sharing
  • ✅ Posterior prediction and uncertainty quantification
  • ✅ Class label prediction using threshold or MAP rule
  • ✅ Simulation from posterior (Beta or Dirichlet) distributions

Installation

You can install the stable version of BKP from CRAN with:

install.packages("BKP")

Or install the development version from GitHub with:

# install.packages("pak")
pak::pak("Jiangyan-Zhao/BKP")

Documentation

The statistical foundations and example applications are described in the following vignette:

Citing

If you use BKP in your work, please cite both the methodology paper and the R package:

You can also obtain the citation information directly within R:

citation("BKP")

Development

The BKP package is under active development. Contributions and suggestions are welcome via GitHub issues or pull requests.

Copy Link

Version

Install

install.packages('BKP')

Monthly Downloads

148

Version

0.2.3

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Jiangyan Zhao

Last Published

September 22nd, 2025

Functions in BKP (0.2.3)

parameter

Extract Model Parameters from a Fitted BKP or DKP Model
get_prior

Construct Prior Parameters for BKP/DKP Models
fit_DKP

Fit a Dirichlet Kernel Process (DKP) Model
kernel_matrix

Compute Kernel Matrix Between Input Locations
loss_fun

Loss Function for BKP and DKP Models
fit_BKP

Fit a Beta Kernel Process (BKP) Model
BKP-package

Beta Kernel Process Modeling
plot

Plot Fitted BKP or DKP Models
predict

Posterior Prediction for BKP or DKP Models
fitted

Extract BKP or DKP Model Fitted Values
print

Print Methods for BKP and DKP Objects
summary

Summary of a Fitted BKP or DKP Model
simulate

Simulate from a Fitted BKP or DKP Model
quantile

Posterior Quantiles from a Fitted BKP or DKP Model