View source: R/03-summary-statistics.R
| make_transformation | R Documentation |
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.
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, ...)
... |
Used to pass arguments to methods. |
transobj |
An object of class |
translist |
A list with elements |
totheta |
Inverse function |
fromtheta |
Function |
jacobian |
(optional) Function taking |
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.
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.
Other transformations:
default_transformation(),
validate_transformation()
make_transformation('log','exp')
make_transformation(log,exp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.