# Package overview and workflow map

This vignette gives a compact map of the package. For a first executable example, start with the “Getting started with GLBFP” vignette.

## Estimator families

`GLBFP` implements three related histogram-based density estimator families.

Family | Pointwise function | Grid function | Main tuning inputs
--- | --- | --- | ---
Averaged Shifted Histogram | `ASH()` | `ASH_estimate()` | `b`, `m`
Linear Blend Frequency Polygon | `LBFP()` | `LBFP_estimate()` | `b`
General Linear Blend Frequency Polygon | `GLBFP()` | `GLBFP_estimate()` | `b`, `m`

Lowercase aliases are also available:

    library(GLBFP)

    c(
      ash = exists("ash"),
      lbfp = exists("lbfp"),
      glbfp = exists("glbfp")
    )
    #>   ash  lbfp glbfp
    #>  TRUE  TRUE  TRUE

The uppercase names are kept for compatibility with the original package API.

## Core workflow

Most analyses follow the same sequence:

1. prepare a finite numeric matrix or data frame;
2. choose a bandwidth vector `b`;
3. choose `m` when using `ASH` or `GLBFP`;
4. evaluate a pointwise estimator or a grid estimator;
5. inspect the S3 summary, predictions, plots, and grid diagnostics.

    x <- matrix(rnorm(300), ncol = 1)
    b <- compute_bi_optim(x, m = 1)

    point_fit <- glbfp(x = 0, data = x, b = b, m = 1)
    grid_fit <- glbfp_estimate(data = x, b = b, m = 1, grid_size = 80)

    summary(point_fit)
    #> Method: GLBFP
    #> Dimension: 1
    #> Point: 0
    #> Estimation: 0.3867351
    #> Standard error: 0.0838592
    #> 95% CI: 0.362643259199835, 0.410826868862035
    #> Bandwidths (b): 0.155144970240404
    #> Shifts (m): 1
    #> Relative grid coordinate (u): 0.91613931912711
    #> Visited cells: 2
    #> Prefix nodes: 2
    summary(grid_fit)
    #> Method: GLBFP
    #> Dimension: 1
    #> Grid points: 80
    #> Grid type: rectangular
    #> Grid dimensions: 80
    #> Bandwidths (b): 0.155144970240404
    #> Shifts (m): 1
    #> Density range: 0.000828108031887938 to 0.514909698997431
    #> Density quartiles: 0.0553978740851781, 0.168558436679355, 0.338815771448144
    #> Density median: 0.1685584
    #> Density mean: 0.1908764
    #> Zero densities: 0
    #> Standard error median: 0.04918585
    #> Median visited cells: 2
    #> Median prefix nodes: 2

## Article guide

Use the vignettes in this order when learning the package:

Article | Purpose
--- | ---
Getting started with GLBFP | First runnable examples and basic object usage
Package overview and workflow map | Orientation across estimators and workflows
Brief methodological background | Minimal statistical context and references
Choosing between ASH, LBFP and GLBFP | Practical estimator comparison
Two-dimensional density estimation | 2D estimation and visualization
Sparse-prefix computation | Internal sparse grid-count diagnostics
Objects, summaries and plotting | S3 classes and helper methods
Validation and comparison | Lightweight benchmark scaffolding

## Input expectations

The package expects finite numeric observations with one observation per row. Missing values should be removed or handled before estimation. For nearly constant data, provide explicit non-degenerate `min_vals` and `max_vals`.