| marginal_laplace_tmb | R Documentation |
Implement the algorithm from aghq::marginal_laplace(), but making use of
TMB's automatic Laplace approximation. This function takes a function
list from TMB::MakeADFun() with a non-empty set of random parameters,
in which the fn and gr are the unnormalized marginal Laplace
approximation and its gradient. It then calls aghq::aghq() and formats
the resulting object so that its contents and class match the output of
aghq::marginal_laplace() and are hence suitable for post-processing
with summary, aghq::sample_marginal(), and so on.
marginal_laplace_tmb(
ff,
k,
startingvalue,
transformation = default_transformation(),
optresults = NULL,
basegrid = NULL,
control = default_control_tmb(),
...
)
ff |
The output of calling |
k |
Integer, the number of quadrature points to use. I suggest at least 3. k = 1 corresponds to a Laplace approximation. |
startingvalue |
Value to start the optimization. |
transformation |
Optional. Do the quadrature for parameter |
optresults |
Optional. A list of the results of the optimization of the log
posterior, formatted according to the output of |
basegrid |
Optional. Provide an object of class |
control |
A list of control parameters. See
. |
... |
Additional arguments to be passed to |
Because TMB does not yet have the Hessian of the log marginal Laplace
approximation implemented, a numerically-differentiated jacobian of the gradient
is used via numDeriv::jacobian(). You can turn this off (using ff$he() instead,
which you'll have to modify yourself) using default_control_tmb(numhessian = FALSE).
If k > 1, an object of class marginallaplace
(and inheriting from class aghq) of the same
structure as that returned by aghq::marginal_laplace(), with plot
and summary methods, and suitable for input into aghq::sample_marginal()
for drawing posterior samples.
Other quadrature:
aghq(),
get_hessian(),
get_log_normconst(),
get_mode(),
get_nodesandweights(),
get_numquadpoints(),
get_opt_results(),
get_param_dim(),
laplace_approximation(),
marginal_laplace(),
nested_quadrature(),
normalize_logpost(),
optimize_theta(),
plot.aghq(),
print.aghqsummary(),
print.aghq(),
print.laplacesummary(),
print.laplace(),
print.marginallaplacesummary(),
summary.aghq(),
summary.laplace(),
summary.marginallaplace()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.