Additional distributions

Pólya-Gamma

pgs = [PolyaGamma(1, 0), PolyaGamma(2, 0), PolyaGamma(1, 2.5), PolyaGamma(3.5, 4.3)]
plot_hist_and_pdf(pgs)

Polya-Gamma density plots

Negative Multinomial

AugmentedGPLikelihoods.SpecialDistributions.NegativeMultinomialType
NegativeMultinomial(x₀::Real, p::AbstractVector)

Negative Multinomial distribution defined as

\[ p(\boldsymbol{x}|x_0, \boldsymbol{p}) = \Gamma\left(\sum_{i=0}^M x_i \right)\frac{p_0^{x_0}}{\Gamma(x_0)}\prod_{i=1}^M \frac{p_i^{x_i}}{x_i!}\]

where $p_0= 1-\sum_{i=1}^M p_i$.

For a detailed understanding of this distribution, see "Negative multinomial distribution" - Sibuya et al. - 1964

source

Pólya-Gamma Poisson

AugmentedGPLikelihoods.SpecialDistributions.PolyaGammaPoissonType
PolyaGammaPoisson(y::Real, c::Real, λ::Real)

A bivariate distribution, used as hierachical prior as:

\[ p(\omega, n) = \operatorname{PG}(\omega|y + n, c)\operatorname{Po}(n|\lambda).\]

Random samples as well as statistics from the distribution will returned as NamedTuple : (;ω, n).

This structured distributions is needed for example for the PoissonLikelihood.

source

Pólya-Gamma Negative Multinomial

AugmentedGPLikelihoods.SpecialDistributions.PolyaGammaNegativeMultinomialType
PolyaGammaNegativeMultinomial(y::BitVector, c::AbstractVector{<:Real}, p::AbstractVector{<:Real})

A multivariate distribution, used as hierachical prior as:

\[ p(\boldsymbol{\omega}, \boldsymbol{n}) = \operatorname{NM}(\boldsymbol{n}|1, \boldsymbol{p})\prod_{i=1}^K\operatorname{PG}(\omega|y_i + n_i, c).\]

Random samples as well as statistics from the distribution will returned as a NamedTuple : (;ω, n).

This structured distributions is needed for the CategoricalLikelihood with a LogisticSoftMaxLink.

source

Additional likelihoods

AugmentedGPLikelihoods.StudentTLikelihoodType
StudentTLikelihood(ν::Real, σ::Real)

Likelihood with a Student-T likelihood:

\[ p(y|f,\sigma, \nu) = \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)\sqrt{\pi\nu}\sigma}\left(1 + \frac{1}{\nu}\left(\frac{x-\nu}{\sigma}\right)^2\right)^{-\frac{\nu+1}{2}}.\]

Arguments

  • ν::Real, number of degrees of freedom, should be positive and larger than 0.5 to be able to compute moments
  • σ::Real, scaling of the inputs.
source

NamedTuple/TupleVector distribution interface

AugmentedGPLikelihoods.SpecialDistributions.AbstractNTDistType

AbstractNTDist is an abstract type for a wrapper type around measure(s) and distributions(s). The main idea is that instead of rand, mean and other statistical tools wrapped objects return NamedTuples or TupleVector when having a collection of them.

The following API has to be implemented: Given π::AbstractNTDist and Π::AbstractVector{<:AbstractNTDist}

Necessary

  • ntrand(rng, π) -> NamedTuple
  • ntmean(π) -> NamedTuple
  • MeasureBase.logdensity_def(π, x::NamedTuple) -> Real
  • Distributions.kldivergence(π₀, π₁) -> Real

Optional

  • tvrand(rng, Π) -> TupleVector
  • tvmean(Π) -> TupleVector
source