Skip to content

smoothbp

0.2.8Package record

Hierarchical Piecewise Regression with Smoothed Change-Points

0packages dependsuggested by 1
1.5Kdownloads / year
–test coverage
13/13flavors OK

Overview

About

Fits Bayesian hierarchical piecewise regression models with multiple logistic-smoothed change-points. Non-linear parameters (change-point locations and transition sharpness) and linear parameters can each be conditioned on covariates and factors via flexible design matrices. A random-intercept structure is supported for any parameter. Spike-and-slab regularization is supported for selecting the number of breakpoints. Posterior inference uses a Metropolis-within-Gibbs sampler implemented in 'Rust' for speed. Methods are based on the smooth transition piecewise regression model of Bacon and Watts (1971) doi:10.2307/2334389 and variable selection spike-and-slab priors of Kuo and Mallick (1998) https://www.jstor.org/stable/25053023. Methods are described in Bindoff (2026) doi:10.48550/arXiv.2606.19044.

Changes in 0.2.8

Sampler correctness

  • Fixed the NUTS proposal rule in the random-effects sampler. The doubling loop updated its proposal from the newly built subtree without checking whether that subtree had terminated, omitting the s' = 1 guard of Hoffman and Gelman (2014, Algorithm 3). A subtree that ends on a U-turn contains states the reverse trajectory could not reach, so proposing from it breaks reversibility; because U-turn termination is the ordinary way the loop ends, this affected a large share of transitions rather than a rare tail. The effect is not subtle. Sampling a standard normal with the affected code returns a variance of 1.24 rather than 1.0, over-dispersed in the direction the bug predicts, since the wrongly admitted proposals come from beyond the U-turn. In fitted models the over-dispersed random effects degrade the fit and the residual scale absorbs it, which is how this surfaced: sigma was systematically over-estimated in simulation-based calibration while omega, delta and sigma_re looked calibrated. **Any random change-point or random-slope fit produced by 0.2.x should be re-run.** Only the random-effects sampler is affected; the non-hierarchical entry points use fixed-length HMC with a single Metropolis correction and are unaffected, which simulation-based calibration confirms.
Show all changes in 0.2.8Hide the rest of the changes in 0.2.8
  • Fixed the change-point translation move under reparameterise = "omega". omega_translation_step() rescaled the random-effect columns by sigma_re, but those columns always hold centred values. Every other sampling step converts back on write-back, and omega_vec() feeds them straight into the likelihood. The move therefore shifted the subject-level change-points instead of leaving them invariant, while still being accepted with probability one. Results computed with reparameterise = "omega" and a random change-point should be regarded as unreliable and re-run. The default, reparameterise = "none", was never affected.

Sampler efficiency

  • The change-point update is now collapsed (Rao-Blackwellised): the linear block (b0, b1, the slope changes) is integrated out analytically before omega is drawn, then resampled from its full conditional given the new omega. Previously omega was drawn conditional on a single draw of those coefficients and vice versa, so the chain traversed the strong omega-delta dependence one axis at a time. On a single-change-point model this raised bulk ESS for omega from a median of 394 to 5588 out of 5000 posterior draws, cut the worst R-hat from 1.090 to 1.006, and cost about 14% more time per fit. Posterior marginals are unchanged; only the efficiency differs. Note that the collapse necessarily runs in this direction. omega cannot be integrated out of the delta update, since it enters through d = t - omega and the transition weight s(d; rho) and that integral has no closed form. The linear block can be integrated out of the omega update because it is conditionally Gaussian, and that breaks the same dependence. Models that place finite bounds on a linear coefficient (prior_normal(lb=, ub=) on b0, b1 or deltas) keep the previous conditional update, because the marginal likelihood of a box-truncated Gaussian is not available in closed form.
  • Added a joint translation move for the population intercept and the group-level random intercepts, b0 -> b0 + c and u_j -> u_j - c. Only the sum b0 + u_j is identified within a group, so updating the fixed coefficients conditional on the random intercepts and vice versa could not traverse the ridge between them: b0 reached a bulk effective sample size of 91 out of 4000 draws on the vignette's random-intercept model while every other parameter mixed freely. The move raises that to 3558 at no measurable cost in run time. The shift leaves the mean function exactly invariant, so c is drawn from its prior-only conditional and accepted outright; it is skipped when invariance would not hold (no intercept column, or observations outside every group). Note that the package documentation previously described the fixed and group-level intercepts as being updated in a single joint block. They were not, which is what the low effective sample size reflected.
  • The spike-and-slab inclusion indicators now use a collapsed (Rao-Blackwellised) update: the slab coefficient is integrated out analytically before the indicator is drawn, then resampled given the new indicator. Previously each indicator was drawn at the current coefficient, so an excluded coefficient sat wherever the diffuse slab put it, fitted badly, and rarely re-entered. The indicator and its coefficient locked together and indicator ESS fell into the tens. This targets the same posterior as before (it is a better sampler of it, not a different model), so posterior inclusion probabilities keep their meaning.
  • The collapsed update also honours bounded slabs (prior_normal(lb=, ub=) on deltas or b1), which the previous indicator update ignored, and uses the learned sigma_re rather than the fixed-effect prior as the slab for random-effect columns.

Validation

  • tools/sbc_ecdf_bands.R now puts every estimated parameter on the SBC figure and writes PASS/FAIL, interval-coverage and run-regime tables to tools/part3_results/. Previously b0, b1 and sigma were checked only on the console and left no artefact, which is why a systematic sigma miscalibration went unnoticed.
  • The calibration evidence for this release is four independent SBC runs of 500 replicates each: rho estimated, rho fixed at its generating value, rho fixed under reparameterise = "omega", and a random-intercept run with a population change-point. Every estimated parameter passes in all four on the full sample of 500 fits. The fourth run exists because the other three use b0 = ~ 1, so the new b0/u translation move never fires in them and they carry no evidence about it.
  • The simultaneous ECDF confidence band is now drawn from a seed derived from its own shape rather than from the ambient RNG stream. The band is itself a Monte Carlo object, and left unseeded it moved enough between runs that reported deviations drifted by a few hundredths, so a table typed from one run no longer reproduced from the same saved ranks. Consecutive runs now write byte-identical tables.
  • Every arm now writes a regime record. The random-intercept arm previously wrote none, which left the one run that exercises the b0/u translation move as the only one whose priors and design were unrecorded.
  • The rank, ECDF, coverage and regime files for all four arms are tracked in the repository, each rank file stamped with the smoothbp version that produced it, so the reported numbers can be checked against the source without rerunning 2000 fits.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 12.4 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-07-30
  • NOTE12 OK, 1 NOTE2026-07-29
  • OK13 OK2026-06-17
Show 6 earlier changesHide 6 earlier changes
  • ERROR12 OK, 1 ERROR2026-06-14
  • OK13 OK2026-06-09
  • ERROR12 OK, 1 ERROR2026-06-08
  • WARNING12 OK, 1 WARNING2026-06-07
  • OK8 OK2026-06-03
  • ERROR5 OK, 2 ERROR2026-06-02
Advisories

none known

Documentation

In release 0.2.8
READMEYes · 85 wordsVignettesYes · 5 · evaluation depends on the environmentNEWSYes · 100% structured · mentions 0.2.8Citation fileYes · software entry onlyWebsitenot declared in DESCRIPTION
Help pages
34 (2 internal)
Examples that run
14%1 run in a plain check · 6 never run
Exported functions with examples
32%
Documented parameters
98%
Return-value docs
95%
Help pages citing references
3%

Downloads

1.5K
CRAN downloads in the past year
Rank #15,177 · ~4/day · ~121/mo
Daily download trend is not available in this view yet.
29930 days
79590 days
1.5K1 year
Compare downloads with other packages →
Also on95 r2u

Repository

1Stars
0Forks
0Open issues
0Open PRs
1Releases
140Commits
2Commit identities
140 commits · Last activity 2026-08-06 · 0% stars, 30d · The default branch showed an older version (0.2.7) than CRAN on 2026-10-18
Responsiveness
How these are sampled
PRs merged (all time)
100%
Median days to close, 50 most recently updated closed issues
9
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2026-06-01 · 12026-07-07 · 1
PracticesBeta

4 development-tooling and community-health practices detected across 2 families in the upstream repository

Checks run against github.com/abindoff/smoothbp on 2026-10-18.

CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Lint, format, editor (2)
VS CodeRStudio project
How this is detected·Detection ruleset v3 (2026-09-26)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen on or before 2026-04-29
    Named in .Rbuildignore: .claude
    Pull request it wrote: opened by a project member
    Commits: at least 28 crediting it in the message
Models named in its commits
  • Claude Sonnet 4.627 commits · May to Jun 2026
  • Claude Fable 51 commit · Aug 2026
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
16 external dependencies (excludes base and recommended)

Installing smoothbp adds 49 packages (25 with compiled code, 46 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, bayesplot 5.0 MB.

Depends (1)
R >= 4.2
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect
Suggested by 1
Suggests, most downloaded first

People & History

People (1)
Author, Maintainer since 0.2.1 (2026)
Releases (5)

Pick two releases to compare their code metrics.

  • 0.2.8Latest
    record
    2026-08-28 · current release · diff ↗
  • 0.2.7
    record
    2026-06-16 · diff ↗ ·
    added 1 export
    derivative
  • 0.2.4
    record
    2026-06-14 · diff ↗ ·
    added 2 exports
    model_methods, model_results
  • 0.2.2
    record
    2026-06-02 · diff ↗
  • 0.2.1
    record
    2026-06-01
  • R
    R 4.6.0 released · 2026-04-24

Package metadata

First published
2026-06-01
Total releases
5 / 1 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.2
Download size
2.9 MB

Cite

Cite this package

Run in R for the authors' entry:

citation("smoothbp")

The package provides a citation file, so citation() returns the authors' own entry.

It points to 10.48550/arxiv.2606.19044.

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 smoothbp version 0.2.8 [Data set]. HJJB, LLC. Data release v2026-10-21. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-21, 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