Implements nonparametric density estimation with Averaged Shifted
Histogram (ASH), Linear Blend Frequency Polygon (LBFP), and General Linear
Blend Frequency Polygon (GLBFP) estimators. The package provides pointwise
and grid-based estimation workflows, sparse-prefix grid-count computation,
plotting helpers, and plug-in bandwidth selection. Methodological
background follows Scott (1992)
GLBFP is an R package for histogram-based nonparametric density
estimation. It implements:
ASH(), ASH_estimate()LBFP(), LBFP_estimate()GLBFP(), GLBFP_estimate()The package supports pointwise density estimation, regular-grid estimation, 1D and 2D plotting, sparse-prefix grid-count computation, S3 summaries and predictions, and plug-in bandwidth selection.
The package is prepared for CRAN submission. Development-only features remain on GitHub until their methodology and documentation are ready for release.
Install the development version from GitHub:
install.packages("remotes")
remotes::install_github("AurelienNicosiaULaval/GLBFP")
If the package is accepted on CRAN, installation will use:
install.packages("GLBFP")
library(GLBFP)
set.seed(2026)
x <- matrix(rnorm(300), ncol = 1)
b <- compute_bi_optim(x, m = 1)
fit <- glbfp(x = 0, data = x, b = b, m = 1)
fit
summary(fit)
predict(fit)
Uppercase function names remain available and are the historical API:
fit_upper <- GLBFP(x = 0, data = x, b = b, m = 1)
identical(fit$estimation, fit_upper$estimation)
library(GLBFP)
data("ashua")
river_data <- ashua[, c("flow", "level")]
b <- c(8, 0.4)
x0 <- c(mean(river_data$flow), mean(river_data$level))
point_fit <- glbfp(x = x0, data = river_data, b = b, m = c(1, 1))
point_fit
grid_fit <- glbfp_estimate(
data = river_data,
b = b,
m = c(1, 1),
grid_size = 20
)
summary(grid_fit)
head(as.data.frame(grid_fit))
plot(grid_fit, contour = TRUE)
| Task | Functions |
|---|---|
| Pointwise density estimation | ASH(), LBFP(), GLBFP() |
| Grid-based density estimation | ASH_estimate(), LBFP_estimate(), GLBFP_estimate() |
| Lowercase aliases | ash(), lbfp(), glbfp(), ash_estimate(), lbfp_estimate(), glbfp_estimate() |
| Bandwidth helper | compute_bi_optim() |
| Bandwidth constants | K_mi(), G_i(), compute_G_star() |
| S3 helpers | print(), summary(), predict(), plot(), as.data.frame() |
The pkgdown site is organized as a reading path:
The first five articles introduce the package and the estimators. The next two articles document implementation diagnostics and S3 behavior. The validation article gives a lightweight reproducible benchmark, while the legacy vignette is kept for backward compatibility.
General background on frequency polygons, averaged shifted histograms, and multivariate density estimation is available in:
The complete bibliographic record for the original GLBFP methodological article
has not yet been verified in this repository. It is tracked in
dev/references_to_verify.md and should be added before journal submission.
To cite the package from R:
citation("GLBFP")
The repository also includes CITATION.cff for software citation metadata.
devtools::document()
devtools::test()
devtools::check()
rcmdcheck::rcmdcheck(args = c("--as-cran"))
Benchmarks are stored in benchmarks/ and are not run automatically during
R CMD check.
Please use GitHub issues and pull requests: https://github.com/AurelienNicosiaULaval/GLBFP/issues
GPL (>= 3).