Extracts transformed parameters from the prior part of a 'JAGS' model inside of a 'bridgesampling' function (returns them as a named list)

JAGS_marglik_parameters_formula(
  samples,
  formula_list,
  formula_data_list,
  formula_prior_list,
  prior_list_parameters,
  formula_design_list = NULL,
  model_data = NULL
)

JAGS_marglik_parameters(samples, prior_list)

Arguments

samples

samples provided by bridgesampling function

formula_list

named list of formulas to be added to the model (names correspond to the parameter name created by each of the formula). For BayesTools_fit objects with stored formula-design metadata, formula inputs can be omitted; if supplied, they are rebuilt only to check exact consistency with the fitted design and never replace fitted replay metadata. Fits without versioned formula-design metadata must be refitted: they stop with an error of class BayesTools_refit_required (see JAGS_validate_fit_contract()).

formula_data_list

named list of data frames containing data for each formula (names of the lists correspond to the parameter name created by each formula). When supplied for a fitted formula, these data must exactly match the fitted original-scale formula source snapshot.

formula_prior_list

named list of named lists of prior distributions (names of the lists correspond to the parameter name created by each of the formula and the names of the prior distribution correspond to the parameter names) of parameters specified within the formula

prior_list_parameters

named list of the posterior values of the model parameters that are not specified within the formula but that might scale the formula parameters (the value returned by JAGS_marglik_parameters() for the same samples)

formula_design_list

named list of the formula-design metadata (the formula_design element returned by JAGS_formula()) of each formula parameter. JAGS_marglik_parameters_formula() reconstructs the linear predictors, including formula random effects, from these fitted designs and stops when a design is missing.

model_data

optional data passed to row-wise external parameter source reconstruction functions during formula random-effect bridge sampling.

prior_list

named list of prior distributions (names correspond to the parameter names) of parameters not specified within the formula_list. For BayesTools_fit objects, stored non-formula priors are used when prior_list = NULL; a supplied prior must specify the same prior as the stored prior of the same name (distribution, parameters, truncation, multiply_by, and mixture components and weights; an error of class BayesTools_refit_required otherwise), while stored priors omitted from prior_list stay allowed. Formula priors are taken from the stored formula metadata: a formula prior supplied here is ignored when it specifies the same prior as the fitted formula prior (distribution, parameters, truncation, contrast, multiply_by, and mixture components and weights) and is an error otherwise.

Value

JAGS_marglik_parameters returns a named list of (transformed) posterior samples. Samples that lack monitored coordinates the priors require stop with an error of class BayesTools_missing_monitored_columns (also BayesTools_marglik_input); callers match the class, not the message. This includes ordinary scalar and vector priors. A named coordinate whose value is NA is present; literal point priors need no monitored coordinate. Formula reconstruction combines decoded ordinary and formula-prior values, genuine additional sampled sources, and retained scalar data before fixed coefficients, multipliers, and random-effect SDs are reconstructed. Natural owned state takes precedence over transformed aliases; malformed supplied owners refuse instead of falling back to a sample column. Expression-point replay is available through a fitted formula owner; generic prior readers without that owner report BayesTools_formula_point_unavailable. A state outside the support of the model (for example a negative row-indexed external random-effect SD value) stops JAGS_marglik_parameters_formula() with an error of class BayesTools_marglik_out_of_support, which JAGS_bridgesampling() treats as zero density.