MyNixOS website logo
Description

General Linear Blend Frequency Polygon Density Estimation.

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) <doi:10.1002/9780470316849>, Terrell and Scott (1985) <doi:10.1080/01621459.1985.10477163>, and Carbon and Duchesne (2024) <doi:10.1007/s10463-023-00883-5>.
GLBFP hex logo

GLBFP

R-CMD-check Codecov test coverage DOI

GLBFP is an R package for histogram-based nonparametric density estimation. It implements:

  • Averaged Shifted Histogram estimators: ASH(), ASH_estimate()
  • Linear Blend Frequency Polygon estimators: LBFP(), LBFP_estimate()
  • General Linear Blend Frequency Polygon estimators: 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.

Status

The package is prepared for CRAN submission. Development-only features remain on GitHub until their methodology and documentation are ready for release.

Installation

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")

Quick start

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)

Two-dimensional workflow

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)

Main functions

TaskFunctions
Pointwise density estimationASH(), LBFP(), GLBFP()
Grid-based density estimationASH_estimate(), LBFP_estimate(), GLBFP_estimate()
Lowercase aliasesash(), lbfp(), glbfp(), ash_estimate(), lbfp_estimate(), glbfp_estimate()
Bandwidth helpercompute_bi_optim()
Bandwidth constantsK_mi(), G_i(), compute_G_star()
S3 helpersprint(), summary(), predict(), plot(), as.data.frame()

Documentation

The pkgdown site is organized as a reading path:

  1. Getting started with GLBFP
  2. Package overview and workflow map
  3. Brief methodological background
  4. Choosing between ASH, LBFP and GLBFP
  5. Two-dimensional density estimation
  6. Sparse-prefix computation
  7. Objects, summaries and plotting
  8. Validation and comparison
  9. Legacy estimation example

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.

References

General background on frequency polygons, averaged shifted histograms, and multivariate density estimation is available in:

  • Carbon, M., and Duchesne, T. (2024). Multivariate frequency polygon for stationary random fields. Annals of the Institute of Statistical Mathematics, 76(2), 263-287. doi:10.1007/s10463-023-00883-5.
  • Scott, D. W. (1992). Multivariate Density Estimation: Theory, Practice, and Visualization. Wiley. doi:10.1002/9780470316849.
  • Terrell, G. R., and Scott, D. W. (1985). Oversmoothed Nonparametric Density Estimates. Journal of the American Statistical Association, 80(389), 209-214. doi:10.1080/01621459.1985.10477163.

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.

Citation

To cite the package from R:

citation("GLBFP")

The repository also includes CITATION.cff for software citation metadata.

Development checks

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.

Contributing

Please use GitHub issues and pull requests: https://github.com/AurelienNicosiaULaval/GLBFP/issues

License

GPL (>= 3).

Metadata

Version

0.5.2

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows