Public validator for the hbmfit-class{hbmfit} S3 class.
Runs all invariants that the cheap constructor (new_hbmfit)
is permitted to skip. Useful when reconstructing an hbmfit
object manually, reading one back from disk, or testing custom
family wrappers.
Details
Invariants verified:
Object is a list with class
"hbmfit".Has mandatory slots:
model,missing_method,data.modelinherits frombrmsfitorbrmsfit_multiple.missing_methodisNULLor a single character string inc("deleted", "multiple", "model").datais adata.framewith \(\ge 1\) row.The
handle_missingalias (if present) equalsmissing_method.
Examples
# \donttest{
# Minimal example without area-level RE (fixed-effects baseline) --
# suppress the area-RE advisory because this 5-row toy dataset cannot
# meaningfully estimate a random effect. Uses brms-default MCMC
# settings (chains = 4, iter = 2000, warmup = 1000); on this toy
# data the fit is only used to verify the hbmfit class structure,
# not for inference.
fit <- suppressWarnings(
hbm(brms::bf(y ~ x1), data = data.frame(y = rnorm(5), x1 = 1:5),
chains = 4, iter = 2000, warmup = 1000, refresh = 0)
)
#> Compiling Stan program...
#> Error in .fun(model_code = .x1): Boost not found; call install.packages('BH')
validate_hbmfit(fit)
#> Error: object 'fit' not found
# }