# Wrapped transformations

`abstract type TransformationWrapper <: Function`

Wrap a transformation to achieve some specialized functionality.

Supports `length`

, `get_transformation`

, and other methods depending on the subtype.

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

Return a callable that

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

calls

`ℓ`

(which should return a scalar) with this tuple.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`

.

`ContinuousTransformations.get_loglikelihood`

— Function.```
get_loglikelihood(t)
```

Return the log likelihood function.

`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`

.

`ContinuousTransformations.get_distribution`

— Function.```
get_distribution(t)
```

Return the wrapped distribution.

`ContinuousTransformations.logpdf_in_domain`

— Function.```
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 `x`

s from the contained distribution (possibly also used for some other purpose), and obtaining the log pdfs at `t(y)`

with the same values.

`ContinuousTransformations.logpdf_in_image`

— Function.```
logpdf_in_image(t, y)
```

The log pdf for a transformed distribution at `y`

in image.

See also `logpdf_in_domain`

.