abstract type GroupedTransformation <: ContinuousTransformation

Abstract type for grouped transformations.

A grouped transformation takes a vector, and transforms contiguous blocks of elements to some output type, determined by the specific transformation type.

All subtypes support

  • length: return the length of the vector that can be used as an argument

  • callable object for the transformation

  • logjac, and inverse,

  • domain and image, which may have specific interpretation for their result types depending on the concrete subtype.

TransformDistribution(distribution, transformation)

Given a transformation and a distribution, create a transformed distribution object that has the distribution of transformation(x) with x ∼ distribution.

The transformation object is callable with the same syntax as transformation. It also supports methods rand, length.

See also logpdf_in_domain and logpdf_in_image.

TransformLogLikelihood(ℓ, transformation::Union{Tuple, GroupedTransformation})

TransformLogLikelihood(ℓ, transformations...)

Return a callable that

  1. transforms its vector argument using a grouped transformation to a set of values,

  2. calls (which should return a scalar) with this tuple.

  3. returns the result above corrected by the log Jacobians.

Useful when is a log-likelihood function with a restricted domain, and transformations is used to trasform to this domain from $ℝ^n$.

See also get_transformation, get_distribution, Distributions.logpdf, and logpdf_in_domain.

bridge(dom, img, [transformation])

Return a transformation that maps dom to img.

The transformation argument may be used to specify a particular transformation family, otherwise default_transformation is used.

lkj_correlation_cholesky_logpdf(L, η)

Log PDF of the LKJ distribution (Lewandowski et al 2009) for correlation matrices.

A correlation matrix $Ω=LL'$ has the density $|Ω|^(η-1)$. However, it is usually not necessary to construct $Ω$, so this function is parametrized in terms of a Cholesky decomposition L.

Note that this function does not check if L yields a valid correlation matrix. Use CorrelationCholeskyFactor for generating valid arguments.

Valid values are $η > 0$. When $η > 1$, the distribution is unimodal at the identity, while $0 < η < 1$ has a trough. $η = 2$ is recommended as a vague prior.

When $η = 1$, the density is uniform. Note however that the function should still be invoked, because of the Jacobian correction of the transformation.

logpdf_in_domain(t, x)

The log pdf for a transformed distribution at t(x) in image, calculated in the domain without performing the transformation.

The log pdf is adjusted with the log determinant of the Jacobian, ie the following holds:

julia logpdf_in_image(t, t(x)) == logpdf_in_domain(t, x)

See logpdf_in_image.


Typical usage of this function would be drawing some random xs from the contained distribution (possibly also used for some other purpose), and obtaining the log pdfs at t(y) with the same values.

y, logjac =
transform_and_logjac(t, x)

Return the transformed value and the determinant of the log Jacobian.

Equivalent to t(x), logjac(t, x), but may be faster because of reused components.

ungrouping_map(T, f, A)

Map the vector A elementwise using f, and collect the results in arrays or vectors organized as a single result from f. For example, if f returns tuples, this function returns tuples of vectors.

The shape of the result is determined by the first argument, which can be Vector or Array. The difference is that Array stacks arrays into arrays, while Vector does not.

Array may be more useful for summaries along dimensions, eg mean and similar.

struct RRStable <: ContinuousTransformations.RRStability

Trait that indicates that a univariate transformation

  1. maps $ℝ$ to $ℝ$,

  2. supports mapping intervals, and

  3. maps subtypes of AbstractInterval to the same type.

make_ungrouped_container(?, representative_elt, len)

Make a container for ungrouped results.

The first argument, Vector or Array, determines the result of ungrouping.

representative_elt is a representative element, used to determine element type and stucture, and len is the length of the result.