update_hbm: update_hbm : Update a Hierarchical Bayesian Model (hbm)...

View source: R/update_hbm.R

update_hbmR Documentation

update_hbm : Update a Hierarchical Bayesian Model (hbm) object

Description

This function updates an existing hbmfit object generated by hbm(), hbm_beta(), hbm_logitnormal(), and hbm_lognormal(). It allows updating the formula, data, and other arguments, following the behavior of brms::update().

Usage

update_hbm(
  model,
  newdata = NULL,
  iter = NULL,
  warmup = NULL,
  chains = NULL,
  cores = NULL,
  control = NULL,
  ...
)

Arguments

model

A brmsfit/hbmfit object

newdata

(optional) A new dataset with the same structure as the original

iter

(optional) Number of MCMC iterations

warmup

(optional) Number of warmup iterations

chains

(optional) Number of MCMC chains

cores

(optional) Number of cores to use for sampling

control

(optional) A named list of control parameters passed to Stan

...

Other arguments passed to update.brmsfit, except those modifying model structure

Details

Update a Hierarchical Bayesian Model (hbm) object

Value

An updated hbmfit object

Examples


library(hbsaems)
# Load example data
data("data_fhnorm")
# Fit initial model
model <- hbm(
formula = bf(y ~ x1 + x2 + x3),
hb_sampling = "gaussian",
hb_link = "identity",
data = data_fhnorm,
chains = 2,
iter = 10000,
warmup = 2000,
cores = 2
 )
# Update number of  iterations and warmup
updated_model <- update_hbm(
model,
newdata = data_fhnorm,
iter = 10000,
warmup = 2000,
 chains = 2,
 cores = 2
 )
# Check updated model summary
summary(updated_model)
  

hbsaems documentation built on Aug. 8, 2025, 7:28 p.m.