Hierarchical Bayesian Area-Level Small Area Estimation Models
Overview
Fits area-level Hierarchical Bayesian Small Area Estimation models. The methodological foundation follows the standard area-level Small Area Estimation literature, primarily Rao and Molina (2015, ISBN: 9781118735787) doi:10.1002/9781118735855, while computational implementation is adapted to the parameterisation and prior-specification conventions of the 'brms' package doi:10.18637/jss.v080.i01, which targets the Stan back-end. Supports a principled Bayesian workflow doi:10.48550/arXiv.2011.01808, with prior predictive checks, convergence diagnostics, model comparison, spatial random effects, custom distributions, missing-data handling, and a bilingual 'shiny' application for non-programmer analysts.
Minor release with Bayesian-workflow improvements. **Read the behaviour
change below before upgrading production scripts.**
Behaviour change (IMPORTANT)
- **
sae_predict()now defaults topredict_type = "epred"** (the posterior distribution of the area mean theta_i), replacing the previous posterior-predictive-of-a-new-observation behaviour. This is the theoretically correct target for small area estimation: the reportedSD/RSE_percentnow measure the uncertainty of the *estimator* theta_i and are therefore **smaller** than in 1.0.x (which included observation-level likelihood variance). **Every RSE number your scripts produce will change.** To reproduce the old numbers exactly, passpredict_type = "response". A third option,"linpred", returns the linear predictor on the response scale.
Show all changes in 1.1.0Hide the rest of the changes in 1.1.0
New features
- Four SAE-oriented families added to the model registry, usable via
hbm_flex()/hbm()andlist_hbsae_models(): **gamma** (positive continuous, log link -- incomes/expenditures), **skew_normal** (skewed continuous area means), **student** (heavy-tailed, robust Fay-Herriot), and **hurdle_lognormal** (positive continuous with excess zeros). Each carries the appropriate response-domain check (e.g. Gamma requires y > 0; hurdle-lognormal allows y >= 0). hbm_flex()'sfamilyargument is now the primary way to choose the family. It accepts a string (e.g."gaussian", exactly like the oldfamily_key), a brms family object (e.g.gaussian(),binomial()), or a registered custom family object (e.g.brms_custom_loglogistic()$custom_family). The family name is matched to a registered spec, so custom distributions reuse the same Stan code (stanvars); an unregistered custom family raises an informative error. Thefamily_keyargument is retained as a backward-compatible alias (not deprecated). Supply eitherfamilyorfamily_key, not both.hbm()gains afamilyargument mirroringhbm_flex(): pass a string (e.g."gaussian") or a brms family object (e.g.gaussian(),Gamma(link = "log")); a link carried on the object is honoured whenhb_linkis left at its default.hb_samplingis retained as a backward-compatible alias. Supply eitherfamilyorhb_sampling, not both.familyis thus the uniform distribution selector acrosshbm()andhbm_flex().sae_predict()gains thepredict_type = c("epred", "response", "linpred", "proportion")argument (see above).model_average()andsae_benchmark()honour it. For a **binomial** family,posterior_epred()returns the expected COUNT (n_i * p_i), which is not comparable across areas with unequal trial counts;predict_type = "proportion"returns the area proportion p_i, andpredict_type = "epred"on a binomial model now auto-converts to p_i (with a warning). Use"response"for the count.convergence_check()now reports **divergent transitions**, **E-BFMI** per chain, and the **max-treedepth hit rate** as numbers insummary()(not just the energy plot), and warns when divergences occur or E-BFMI < 0.3.model_compare()/model_compare_all()now check **Pareto-k** for PSIS-LOO reliability: an_high_kcolumn is added to the ranking table and a warning is issued when any k > 0.7. The previously deadreloo_argsargument is now functional -- supplying it triggersbrms::reloo()to refit the high-k folds.
Default change
hbm()now defaults tocontrol = list(adapt_delta = 0.95, max_treedepth = 12)(the values long documented as the recommended starting point) instead of brms'sadapt_delta = 0.8. Hierarchical SAE funnels need the higher value to avoid spurious divergences. User-suppliedcontrolvalues are always respected. Seed-level results may differ slightly from 1.0.x.
Bug fixes
convergence_check()no longer reportsTail_ESS = Bulk_ESSin the fallback path when the 'posterior' package is unavailable; it reportsNArather than falsely implying the tails were checked.model_compare()(and the deprecatedhbmc()) accept a list of fitted models again. Whenmodel_compare()became an S3 generic in 1.0.0 it dispatched only onhbmfit/brmsfit, so the pre-1.0.0 conventionhbmc(model = list(m1, m2))failed with "no applicable method for 'model_compare' applied to an object of class 'list'". Amodel_compare.list()method now unwraps a 1-2 element list to the single/pairwise path (hbmc_results), routes a 3+ element list tomodel_compare_all()(rankedhbm_table), and rejects an empty or non-model list with an informative error.
From NEWS.md in the release
Install
Health
NOTERd contentsr-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc
Rd files without \usage: ‘hbmfit-methods.Rd’ \arguments should not be documented without \usage.
- NOTE11 OK, 2 NOTENow
- NOTE12 OK, 1 NOTE2026-07-11
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK13 OK2026-05-02
- ERROR11 OK, 1 ERROR2026-04-25
Show 3 earlier changesHide 3 earlier changes
- OK14 OK2026-04-22
- ERROR13 OK, 1 ERROR2026-04-18
- OK14 OK2026-03-10
Documentation
The repository also keeps web-only articles.
- Help pages
- 72 (5 internal)includes a package overview page
- Examples that run
- 47%23 run in a plain check (1 of them under a condition) · 25 only when donttest examples are enabled (R CMD check --as-cran) · 1 hold no code
- Exported functions with examples
- 89%
- Documented parameters
- 93%
- Return-value docs
- 100%
- Help pages citing references
- 13%
Downloads
Repository
- PRs merged (all time)
- 0%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 38
8 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/madsyair/hbsaems on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-06-01 · The repository has a site deploy workflow
pkgdown site last built 2026-06-01
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2026-04-07Pull request: opened by its own account
Dependencies
Installing hbsaems adds 101 packages (51 with compiled code, 93 MB of source tarballs). Heaviest: BH 14 MB, stringi 11 MB, ggplot2 6.0 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 1.1.0Latest
- 1.0.02026-05-25 · diff ↗ ·
added 62 exports
brms_custom_loglogistic, brms_custom_shifted_loglogistic, build_brms_custom_family, build_spatial_weight, check_data, check_shiny_deps, check_spatial_weight, convergence_check, diagnostic_summary, dloglogistic, dshifted_loglogistic, get_hbsae_model, hbm_control, hbm_data, hbm_flex, hbm_info, hbm_nonlinear, hbm_priors, hbm_warnings, hbmfit, is.hbcc_results, is.hbmc_results, is.hbmfit, is.hbpc_results, is.hbsae_results, is.hbsaems_check, is_converged, list_hbsae_models, log_lik_loglogistic, log_lik_shifted_loglogistic and 32 more - RR 4.6.0 released · 2026-04-24
- 0.1.12025-07-18
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2025-07-18
- Total releases
- 3 / 1 yrs
- License
- GPL (>= 3) OSI
- Minimum R
- ≥ 4.0.0
- Bundled data
- 29 KB / 7 files
- Download size
- 420 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("hbsaems")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.