R/JAGS-marglik-priors.R
JAGS_marglik_priors.RdComputes marginal likelihood for the prior part of a 'JAGS' model within 'bridgesampling' function
JAGS_marglik_priors(samples, prior_list)
JAGS_marglik_priors_rows(samples, prior_list)
JAGS_marglik_priors_rows_evaluator(prior_list)
JAGS_marglik_priors_formula(samples, formula_prior_list, prior_list = NULL)samples provided by the bridgesampling function. Supply one
named posterior row to JAGS_marglik_priors() and a named matrix or data
frame to JAGS_marglik_priors_rows(). Row-wise samples must have real
numeric columns.
named list of model-level prior distributions. For
JAGS_marglik_priors_formula(), optional model priors whose shared ordered
allocations have already been included by JAGS_marglik_priors().
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
JAGS_marglik_priors returns a numeric value
of the log prior density evaluated at the current posterior sample.
JAGS_marglik_priors_rows returns one numeric value for every row of
posterior samples. JAGS_marglik_priors_rows_evaluator returns a
function that applies the same row-wise evaluation without recompiling the
prior structure on each call. Samples that lack monitored coordinates the
priors require stop with an error of class
BayesTools_missing_monitored_columns (also
BayesTools_marglik_input).
JAGS_marglik_priors_rows() preserves joint prior boundaries
within each posterior row. In particular, auxiliary-gamma contributions for
vector and Dirichlet priors are summed separately within each row.
When model and formula priors share an ordered Dirichlet allocation, supply
the model priors as prior_list to JAGS_marglik_priors_formula(). Its
contribution then excludes allocations already included by
JAGS_marglik_priors(samples, prior_list), so the two log prior contributions
can be added without counting shared allocations twice.
Evaluate the combined contribution as
JAGS_marglik_priors(samples, prior_list) + JAGS_marglik_priors_formula(samples, formula_prior_list, prior_list).