mcmc-samplers- Combinators for MCMC sampling

Safe HaskellNone




Methods over distributions

class HasDensity d a where

The class of distributions for which there exists a density method.


density :: d a -> Density a

A method that provides the probability density at a point in the distribution.


HasDensity Proposal a

Get the probability density at a point for any proposal distribution.

HasDensity Target a

Get the probability density at a point for any target distribution.

productDensity :: HasDensity d a => [d a] -> Density a

Compute the product density of the input distributions. An example use is in constructing a target distribution whose density can be expressed as a product of probability densities.

sampleFrom :: Proposal a -> Sample a

This function can be used to call the sampling method of any proposal distribution.

fromProposal :: Proposal a -> Target a

Convenience function for constructing target distributions from predefined or custom proposal distributions. One use case is in testing that the samplers in the library correctly simulate standard distributions.

Standard distributions

uniform :: (Variate a, Real a) => a -> a -> Proposal a

Univariate uniform distribution over real numbers. The parameters should not be equal.

mvUniform :: (Variate a, Real a) => [a] -> [a] -> Proposal [a]

Multivariate uniform distribution over real numbers.

diag :: [Double] -> [[Double]]

Convenience function to create a diagonal matrix from a list representing the diagonal. Useful for creating a diagonal covariance matrix for the multivariate Gaussian distribution.

normal :: Double -> Double -> Proposal Double

Univariate Gaussian distribution over real numbers.

mvNormal :: [Double] -> [[Double]] -> Proposal [Double]

Multivariate Gaussian distribution over real numbers.

categorical :: Eq a => [(a, Double)] -> Proposal a

Categorical distribution over instances of the Eq typeclass. The input argument is a list of category-proportion pairs.

The input proportions represent relative weights and are not required to be normalized.

normalize :: [(a, Double)] -> [(a, Double)]

Normalize the weights in a list of category-weight pairs.

categoricalNormed :: Eq a => [(a, Double)] -> Proposal a

Assume that the weights are already normalized. This is useful as an optimized version of categorical.

beta :: Double -> Double -> Proposal Double

Beta distribution over real numbers. Requires non-negative arguments.

bern :: Double -> Proposal Bool

Bernoulli distribution

poisson :: Double -> Proposal Int

Univariate Poisson distribution. Requires non-negative argument.