Skip to content

src/core/priors.js ​

Prior distributions as unit-cube transforms (the form nested sampling needs): each maps u ~ U(0,1) to a draw from the prior via its inverse CDF.

Import: import { … } from './src/core/priors.js' — no DOM, runs in Node and the browser.

PRIOR_TYPES ​

js
const PRIOR_TYPES

The fitting UI offers these two; makeTransform also understands 'truncnormal', 'loguniform' and 'categorical' ({ values: [...], weights?: [...] }, a discrete parameter such as a period alias) for programmatic use.

makeTransform ​

js
function makeTransform(pr)
text
Build u -> x for one prior spec { type, a, b, lo, hi }.

validatePrior ​

js
function validatePrior(pr)

Returns an error string, or null if the prior is usable.

priorPdf ​

js
function priorPdf(pr, x)

Prior density (unnormalised is fine) for drawing the prior curve in the UI.

MIT licensed · Kyle A. Pearson