Skip to content

hbsaems

1.1.0Package record

Hierarchical Bayesian Area-Level Small Area Estimation Models

0packages depend
3Kdownloads / year
67.6%test coverage
11/13flavors OK

Overview

About

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.

Changes in 1.1.0

Minor release with Bayesian-workflow improvements. **Read the behaviour

change below before upgrading production scripts.**

Behaviour change (IMPORTANT)

  • **sae_predict() now defaults to predict_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 reported SD / RSE_percent now 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, pass predict_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() and list_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()'s family argument is now the primary way to choose the family. It accepts a string (e.g. "gaussian", exactly like the old family_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. The family_key argument is retained as a backward-compatible alias (not deprecated). Supply either family or family_key, not both.
  • hbm() gains a family argument mirroring hbm_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 when hb_link is left at its default. hb_sampling is retained as a backward-compatible alias. Supply either family or hb_sampling, not both. family is thus the uniform distribution selector across hbm() and hbm_flex().
  • sae_predict() gains the predict_type = c("epred", "response", "linpred", "proportion") argument (see above). model_average() and sae_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, and predict_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 in summary() (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: a n_high_k column is added to the ranking table and a warning is issued when any k > 0.7. The previously dead reloo_args argument is now functional -- supplying it triggers brms::reloo() to refit the high-k folds.

Default change

  • hbm() now defaults to control = list(adapt_delta = 0.95, max_treedepth = 12) (the values long documented as the recommended starting point) instead of brms's adapt_delta = 0.8. Hierarchical SAE funnels need the higher value to avoid spurious divergences. User-supplied control values are always respected. Seed-level results may differ slightly from 1.0.x.

Bug fixes

  • convergence_check() no longer reports Tail_ESS = Bulk_ESS in the fallback path when the 'posterior' package is unavailable; it reports NA rather than falsely implying the tails were checked.
  • model_compare() (and the deprecated hbmc()) accept a list of fitted models again. When model_compare() became an S3 generic in 1.0.0 it dispatched only on hbmfit/brmsfit, so the pre-1.0.0 convention hbmc(model = list(m1, m2)) failed with "no applicable method for 'model_compare' applied to an object of class 'list'". A model_compare.list() method now unwraps a 1-2 element list to the single/pairwise path (hbmc_results), routes a 3+ element list to model_compare_all() (ranked hbm_table), and rejects an empty or non-model list with an informative error.

From NEWS.md in the release

Install

Health

CRAN checks
2NOTE11OK
Check messages
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.

CRAN check page ↗

Slowest check: 11.4 min · r-release-linux-x86_64
Status changes
  • 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
Advisories

none known

Documentation

In release 1.1.0
READMEYes · 1,118 wordsVignettesYes · 1 · dynamicNEWSYes · 67% structured · mentions 1.1.0Citation fileNoWebsiteYes · pkgdown

The repository also keeps web-only articles.

Description cites a JSS article
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

3K
CRAN downloads in the past year
Rank #10,135 · ~8/day · ~250/mo
Daily download trend is not available in this view yet.
Also on71 r2u5 autocran

Repository

1Stars
0Forks
0Open issues
0Open PRs
1Releases
112Commits
1Commit identities
112 commits · Last activity 2026-06-01
Responsiveness
How these are sampled
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
PracticesBeta

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.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-06-01 · The repository has a site deploy workflow

pkgdown site last built 2026-06-01

Reproducibility and dev environment (1)
data-raw/
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v3 (2026-09-26)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • GitHub Copilotfirst seen 2026-04-07
    Pull request: opened by its own account
How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
26 external dependencies (excludes base and recommended)

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.

Depends (1)
R >= 4.0.0
Imports (7)
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (4)
Author, Maintainer since 0.1.1 (2025)
Releases (3)

Pick two releases to compare their code metrics.

  • 1.1.0Latest
    record
    2026-06-01 · current release · diff ↗
  • 1.0.0
    record
    2026-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
  • R
    R 4.6.0 released · 2026-04-24
  • 0.1.1
    record
    2025-07-18
  • R
    R 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")
Choir, A. S., Nurhayati, S. S., Oktalia Siregar, A. L., & Zamzanah, S. (2026). hbsaems: Hierarchical Bayesian Area-Level Small Area Estimation Models (Version 1.1.0) [Computer software]. https://doi.org/10.32614/CRAN.package.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.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for hbsaems version 1.1.0 [Data set]. HJJB, LLC. Data release v2026-10-22. https://doi.org/10.5281/zenodo.21843040

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.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy