mcmc-samplers-0.1.1.1: Combinators for MCMC sampling

MCMC.Types

Synopsis

Targets and Proposals

type Rand = GenIO

An even shorter name for PRNGs in the IO monad.

type Density a = a -> Double

The probability density function used in both target and proposal distributions. Given an input point, this method returns a probability density.

type Sample a = Rand -> IO a

A procedure that, given a source of randomness, returns an action that produces a sample. The type itself is read as a verb, i.e, "to sample".

data Target a

The type for target distributions that can be used in any MCMC sampler.

Instances

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

newtype TargetView a

Constructors

 Target (Density a)

makeTarget :: Density a -> Target a

Method for constructing custom target distributions.

Target distributions need only a density method.

data Proposal a

The type for proposal distributions that can be used in any MCMC sampler.

Instances

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

data ProposalView a

Constructors

 Proposal (Density a) (Sample a)

makeProposal :: Density a -> Sample a -> Proposal a

Method for constructing custom proposal distributions.

Proposal distributions need both a density and a sampling method.

Transition kernels

type Step x = Rand -> x -> IO x

The type for one step in the random walk. A value of type Step a is a function that takes a source of randomness and a current state and returns an action producing a subsequent state.

type Kernel x a = Target a -> (a -> Proposal a) -> Step x

The type for MCMC transition kernels.

The input arguments are the target distribution (to be modeled) and a conditional proposal distribution.

The result is a Step that will make one move in the random walk based on the current state. In general, an MCMC kernel consists of using:

• the conditioned proposal to make a hypothesis move, and then
• the semantics of the specific Kernel at hand to either accept this hypothesis (and move to the new state), or reject the hypothesis (and stay at the current state).

Type parameter definitions:

x
The kernel-state. This is the type for each state in the Markov chain.
a
The distribution-state. This is the domain of the target distribution as well as the type of values sampled from the proposal distribution.

In general, we need different types to represent the kernel-state and distribution-state because the kernel-state may hold extra information that gets updated with each step. Look at simulatedAnnealing for an example where x differs from a.

Actions

type Act x m a = x -> a -> m a

data Action x m a b

Type parameter definitions:

x
The kernel-state (see Kernel)
a
The action-state, specific to the action being performed
m
The monad in which the action is performed
b
The final returned state type

viewAction :: Action x m a b -> ActionView x m a b

data ActionView x m a b

Constructors

 Action (Act x m a) (a -> m b) a

makeAction

Arguments

 :: Act x m a The action to perform at each step of the random walk -> (a -> m b) The finish function, called at the end of the sampling process -> a The current value of the action-state -> Action x m a b