Skip to contents

Returns the resolved priors used to fit the model, either the user-supplied fb_prior() object, the auto-default half-normal on the standard-deviation scale, or the legacy scalar bridge (prior_fixed_sd + prior_vc_sd). The return value is an S3 object with a print() method. The underlying fb_prior (when applicable) is exposed under $fb_prior for programmatic access.

Usage

prior_summary(object, ...)

# S3 method for class 'flexybayes_inla'
prior_summary(object, ...)

# S3 method for class 'flexybayes_brms'
prior_summary(object, ...)

# Default S3 method
prior_summary(object, ...)

Arguments

object

A flexybayes_inla or flexybayes_brms object.

...

Ignored by current methods (reserved for future per-component selection).

Value

A prior_summary_flexybayes object, a list carrying the components below.

kind

One of "fb_prior", "legacy_scalar", "no_prior_recorded".

backend

The backend the fit ran on: "inla" or "brms".

fb_prior

The fb_prior object (when kind == "fb_prior").

default_origin

"auto" when the prior was constructed by the half-normal auto-default. "user" when supplied via the prior argument; NA for legacy / no-prior cases.

default_scale, default_basis

Attributes carried by the auto-default prior naming the half-normal scale and its basis (response-scale sd(y), logit-scale constant, log-scale constant). NULL when the prior was user-supplied.

fixed_sd, vc_sd

Legacy scalar values (when kind == "legacy_scalar").

scalars_supplied

Named logical: whether the caller supplied prior_fixed_sd and prior_vc_sd. An argument left unsupplied leaves the engine's own default in force, which fixed_sd_engine_default names.

legacy_vc_applied

Named character: the density the legacy scalar bridge put on each variance component it reached, empty when prior_vc_sd was not supplied.

not_applied

Named character: a prior this package declared that the engine has no parameter for, a residual prior on a family whose dispersion is a function of the mean.

declaration_only

Reserved. Always FALSE for every current backend.

inputs

Data frame: every prior specification the fit was given, stated or chosen by the package, with its source and the number of engine slots that used it.

slots

Data frame: every engine slot, with the prior the package sent, the input it came from, the prior the engine reports after fitting and whether the two agree. A slot carrying the engine's own prior is listed with that source.

not_consumed

Named character: each input no engine slot used, with the reason code.

Details

The methods are also registered on rstantools' prior_summary() generic, which brms re-exports, so prior_summary(fit) returns this summary when brms is attached after flexyBayes.

Examples

if (FALSE) { # \dontrun{
# live brms (Stan) fit, needs a working Stan toolchain
data(sleepstudy, package = "lme4")
fit <- fb_brms(Reaction ~ Days + (1 | Subject),
               data = sleepstudy,
               n_samples = 100, warmup = 100, chains = 1,
               verbose = FALSE, mcmc_verbose = FALSE)
prior_summary(fit)
} # }