make_transformation {aghq}R Documentation

Marginal Parameter Transformations

Description

These functions make it easier for the user to represent marginal parameter transformations for which inferences are to be made. Suppose quadrature is done on the posterior for parameter theta, but interest lies in parameter lambda = g(theta) for smooth, monotone, univariate g. This interface lets the user provide g, g^-1, and (optionally) the Jacobian dtheta/dlambda, and aghq will do quadrature on the theta scale but report summaries on the lambda scale. See a note in the Details below about multidimensional parameters.

Usage

make_transformation(...)

## S3 method for class 'aghqtrans'
make_transformation(transobj, ...)

## S3 method for class 'list'
make_transformation(translist, ...)

## Default S3 method:
make_transformation(totheta, fromtheta, jacobian = NULL, ...)

Arguments

...

Used to pass arguments to methods.

transobj

An object of class aghqtrans. Just returns this object. This is for internal compatibility.

translist

A list with elements totheta, fromtheta, and, optionally, jacobian.

totheta

Inverse function g^-1(theta). Specifically, takes vector g_1(theta_1)...g_p(theta_p) and returns vector theta_1...theta_p.

fromtheta

Function g: R^p -> R^p, where p = dim(theta). Must take vector theta_1...theta_p and return vector g_1(theta_1)...g_p(theta_p), i.e. only independent/marginal transformations are allowed (but these are the only ones of interest, see below). For j=1...p, the parameter of inferential interest is lambda_j = g_j(theta_j) and the parameter whose posterior is being normalized via aghq is theta_j. Passed to match.fun.

jacobian

(optional) Function taking theta and returning the absolute value of the determinant of the Jacobian dtheta/dg(theta). If not provided, a numerically differentiated Jacobian is used as follows: numDeriv::jacobian(totheta,fromtheta(theta)). Passed to match.fun.

Details

Often, the scale on which quadrature is done is not the scale on which the user wishes to make inferences. For example, when a parameter lambda>0 is of interest, the posterior for theta = log(lambda) may be better approximated by a log-quadratic than that for lambda, so running aghq on the likelihood and prior for theta may lead to faster and more stable optimization as well as more accurate estimates. But, interest is still in the original parameter lambda = exp(theta).

These considerations are by no means unique to the use of quadrature-based approximate Bayesian inferences. However, when using (say) MCMC, inferences for summaries of transformations of the parameter are just as easy as for the un-transformed parameter. When using quadrature, a little bit more work is needed.

The aghq package provides an interface for computing posterior summaries of smooth, monotonic parameter transformations. If quadrature is done on parameter theta and g(theta) is a univariate, smooth, monotone function, then inferences are made for lambda = g(theta). In the case that theta is p-dimensional, p > 1, the supplied function g is understood to take in theta_1...theta_p and return g_1(theta_1)...g_p(theta_p). The Jacobian is diagonal.

To reiterate, all of this discussion applies only to marginal parameter transformations. For the full joint parameter, the only summary statistics you can even calculate at all (at present?) are moments, and you can already calculate the moment of any function h(theta) using aghq::compute_moment, so no additional interface is needed here.

Value

Object of class aghqtrans, which is simply a list with elements totheta, fromtheta, and jacobian. Object is suitable for checking with aghq::validate_transformation and for inputting into any function in aghq which takes a transformation argument.

See Also

Other transformations: default_transformation(), validate_transformation()

Examples


make_transformation('log','exp')
make_transformation(log,exp)


[Package aghq version 0.4.1 Index]