smoothbp: Fit a hierarchical piecewise regression model with smoothed...

View source: R/smoothbp.R

smoothbpR Documentation

Fit a hierarchical piecewise regression model with smoothed change-points

Description

Fit a hierarchical piecewise regression model with smoothed change-points

Usage

smoothbp(
  formula,
  b0 = ~1,
  b1 = ~1,
  deltas = list(~1),
  omega = list(~1),
  rho = list(~1),
  data,
  priors = smoothbp_priors(),
  chains = 4L,
  iter = 2000L,
  warmup = 1000L,
  seed = NULL,
  step_om = 0.3,
  step_rho = 0.3,
  target_accept = 0.9,
  cores = getOption("smoothbp.cores", 1L),
  hierarchical = NULL,
  reparameterise = c("none", "omega"),
  .verbose = TRUE
)

Arguments

formula

A two-sided formula identifying the response and time variable, e.g. value ~ tau.

b0

One-sided formula for the b0 linear predictor.

b1

One-sided formula for b1. Default ~ 1.

deltas

List of one-sided formulas for slope changes. Default list(~ 1).

omega

List of one-sided formulas for change-point locations. Default list(~ 1). Can also contain fixed() values for known change-points.

rho

List of one-sided formulas for transition sharpness. Default list(~ 1). Can also contain fixed() values for fixed sharpness.

data

A data frame.

priors

A smoothbp_priors object.

chains

Number of chains. Default 4.

iter

Total iterations per chain. Default 2000.

warmup

Warmup iterations. Default 1000.

seed

Random seed.

step_om

Initial HMC/MH step size for omega.

step_rho

Initial HMC/MH step size for rho.

target_accept

Target HMC acceptance probability (default 0.9). Raise toward 0.99 if you see divergent transitions in the sharpness (rho) parameter.

cores

Number of CPU cores.

hierarchical

Deprecated. Character vector; which parameters should be treated as hierarchical. This argument is no longer needed: random effects on change-point timing are auto-detected from (1|group) formula syntax (e.g. omega = list(~ 1 + (1|group))). Passing a non-NULL value generates a deprecation warning.

reparameterise

Character specifying the parameterisation for random change-points: "none" (centred) or "omega" (fully non-centred). Default is "none". Only used if random effects are present.

.verbose

Print progress.

Value

A smoothbp_fit object.


smoothbp documentation built on June 14, 2026, 9:06 a.m.