Posterior

Instances of Posterior are called by worker sampling processes for evaluation of a joint posterior distribution.

class xpsi.Posterior.Posterior(likelihood, prior, **kwargs)[source]

The (joint) posterior distribution.

A callable instance is required by emcee (but is not required for nested sampling).

Parameters:
  • likelihood – An instance of Likelihood.

  • prior – An instance of Prior.

__call__(p)[source]

Special method to make callable instances to feed to emcee.

Returns:

The logarithm of the posterior density (up to a normalising constant), evaluated at p.

property likelihood

Get the likelihood object.

loglikelihood(p)[source]

The logarithm of the likelihood function, evaluated at p.

Companion to logprior() for parallel-tempered sampling; see _evaluate_split().

Returns:

The logarithm of the likelihood. ptemcee only requires it where the log-prior is finite.

logprior(p)[source]

The logarithm of the prior density, evaluated at p.

Companion to loglikelihood() for parallel-tempered sampling; see _evaluate_split().

Returns:

The logarithm of the prior density (up to a normalising constant), or minus infinity if p lies outside the strict parameter bounds.

property prior

Get the prior object.

class xpsi.Posterior.PriorError[source]

Bases: ValueError

Raised if there is a problem with the value of the log-prior.