mcmc-0.8.2.0: Sample from a posterior using Markov chain Monte Carlo
Copyright2021 Dominik Schrempf
LicenseGPL-3.0-or-later
Maintainerdominik.schrempf@gmail.com
Stabilityunstable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Mcmc.Proposal.Simplex

Description

Creation date: Mon Oct 19 15:32:31 2020.

Synopsis

Elements of simplices

data Simplex Source #

An element of a simplex.

A vector of non-negative values summing to one.

The nomenclature is not very consistent, because a K-dimensional simplex is usually considered to be the set containing all K-dimensional vectors with non-negative elements that sum to 1.0. However, I couldn't come up with a better name. Maybe SimplexElement, but that was too long.

Instances

Instances details
FromJSON Simplex Source # 
Instance details

Defined in Mcmc.Proposal.Simplex

ToJSON Simplex Source # 
Instance details

Defined in Mcmc.Proposal.Simplex

Show Simplex Source # 
Instance details

Defined in Mcmc.Proposal.Simplex

Eq Simplex Source # 
Instance details

Defined in Mcmc.Proposal.Simplex

Methods

(==) :: Simplex -> Simplex -> Bool #

(/=) :: Simplex -> Simplex -> Bool #

simplexUniform :: Dimension -> Simplex Source #

Create the uniform element of the K-dimensional simplex.

Set all values to \(1/D\).

simplexFromVector :: Vector Double -> Either String Simplex Source #

Ensure that the value vector is an element of a simplex.

Return Left if: - The value vector is empty. - The value vector contains negative elements. - The value vector is not normalized.

Proposals on simplices

dirichlet :: PDimension -> PName -> PWeight -> Tune -> Proposal Simplex Source #

Dirichlet proposal on a simplex.

For a given element of a K-dimensional simplex, propose a new element of the K-dimensional simplex. The new element is sampled from the multivariate Dirichlet distribution with parameter vector being proportional to the current element of the simplex.

The tuning parameter is used to determine the concentration of the Dirichlet distribution: the lower the tuning parameter, the higher the concentration.

The proposal dimension, which is the dimension of the simplex, is used to determine the optimal acceptance rate.

For high dimensional simplices, this proposal may have low acceptance rates. In this case, please see the coordinate wise beta proposal.

beta :: Dimension -> PName -> PWeight -> Tune -> Proposal Simplex Source #

Beta proposal on a specific coordinate i on a simplex.

For a given element of a K-dimensional simplex, propose a new element of the K-dimensional simplex. The coordinate i of the new element is sampled from the beta distribution. The other coordinates are normalized such that the values sum to 1.0. The parameters of the beta distribution are chosen such that the expected value of the beta distribution is the value of the old coordinate.

The tuning parameter is used to determine the concentration of the beta distribution: the lower the tuning parameter, the higher the concentration.

See also the dirichlet proposal.

No "out of bounds" checks are performed during compile time. Run time errors can occur if i is negative, or if i-1 is larger than the length of the element vector of the simplex.

This proposal has been assigned a dimension of 2. See the discussion at PDimension.