
BKP implements Beta Kernel Process models for nonparametric estimation of covariate-dependent binomial probabilities. The package uses kernel-weighted conjugate updates to obtain closed-form posterior inference for binary and aggregated binomial responses, avoiding latent-variable augmentation and MCMC-based computation.
The package also implements the Dirichlet Kernel Process (DKP) for categorical and multinomial responses, as well as scalable global-local approximations through TwinBKP and TwinDKP. These twin models combine twinning-selected global subsets with local nearest-neighbour updates to improve scalability for larger datasets.
predict(), simulate(),
summary(), plot(), print(),
fitted(), parameter(), and
quantile()Install the stable version from CRAN:
install.packages("BKP")Install the development version from GitHub:
# install.packages("pak")
pak::pak("Jiangyan-Zhao/BKP")library(BKP)
set.seed(123)
true_pi_fun <- function(x) {
(1 + exp(-x^2) * cos(10 * (1 - exp(-x)) / (1 + exp(-x)))) / 2
}
n <- 30
Xbounds <- matrix(c(-2, 2), nrow = 1)
X <- tgp::lhs(n = n, rect = Xbounds)
true_pi <- true_pi_fun(X)
m <- sample(100, n, replace = TRUE)
y <- rbinom(n, size = m, prob = true_pi)
fit <- fit_BKP(X, y, m, Xbounds = Xbounds)
summary(fit)
plot(fit)
Xnew <- matrix(seq(-2, 2, length.out = 10), ncol = 1)
pred <- predict(fit, Xnew = Xnew)
predFor multinomial data, use fit_DKP(). For scalable
global-local approximations, use fit_TwinBKP() or
fit_TwinDKP().
The statistical foundations, implementation details, and examples are described in
If you use BKP in your work, please cite both the methodology paper and the R package:
Methodology paper
Zhao, J., Qing, K., and Xu, J. (2025). BKP: An R Package for Beta
Kernel Process Modeling.
arXiv:2508.10447. https://arxiv.org/abs/2508.10447.
R package
Zhao, J., Qing, K., and Xu, J. (2026). BKP: Beta Kernel Process
Modeling.
R package version 0.3.0. https://cran.r-project.org/package=BKP.
You can also obtain the citation information directly within R:
citation("BKP")The BKP package is under active development. Bug reports, feature requests, and contributions are welcome through GitHub issues or pull requests: