Skip to contents

A prior in neuralsbi is a lightweight object (class nsbi_prior) that knows how to (a) draw samples and (b) evaluate its log-density. Bounded priors also carry lower/upper support limits, which are used to reject out-of-support posterior samples ("leakage" correction).

Details

There are four ways to build one. prior_uniform() is the box prior most benchmark tasks use. prior_normal() and the named families in prior_families (log-normal, exponential, gamma, beta, Student-t, Cauchy and the half versions of the last two) give one marginal per parameter, under Stan's argument names. prior_independent() multiplies those together into a joint prior, and prior_truncated() bounds one, renormalizing the density by the mass it keeps. prior_custom() takes a sampler and a density you write yourself, for anything the families do not cover.

Prefer a named family over prior_custom() where one fits. A family carries its support bounds into the leakage correction, survives prior_truncated() with an exact normalizing constant, and is what stan_code() writes out as a sampling statement; a custom prior does none of those.