Safe Haskell | None |
---|---|

Language | Haskell2010 |

- class HasDensity d a where
- productDensity :: HasDensity d a => [d a] -> Density a
- sampleFrom :: Proposal a -> Sample a
- fromProposal :: Proposal a -> Target a
- uniform :: (Variate a, Real a) => a -> a -> Proposal a
- mvUniform :: (Variate a, Real a) => [a] -> [a] -> Proposal [a]
- diag :: [Double] -> [[Double]]
- normal :: Double -> Double -> Proposal Double
- mvNormal :: [Double] -> [[Double]] -> Proposal [Double]
- categorical :: Eq a => [(a, Double)] -> Proposal a
- normalize :: [(a, Double)] -> [(a, Double)]
- categoricalNormed :: Eq a => [(a, Double)] -> Proposal a
- beta :: Double -> Double -> Proposal Double
- bern :: Double -> Proposal Bool
- poisson :: Double -> Proposal Int

# Methods over distributions

class HasDensity d a where

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

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.

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`

.