default_control_tmb: Default control arguments for 'aghq::marginal_laplace_tmb()'.

View source: R/00-misc-support-functions.R

default_control_tmbR Documentation

Default control arguments for aghq::marginal_laplace_tmb().

Description

Run default_control_marglaplace() to print the list of valid control parameters and their defaults, and run with named arguments to change the defaults.

Usage

default_control_tmb(...)

Arguments

...

You can provide a named value for any control parameter and its value will be set accordingly. See ?marginal_laplace and examples here.

Details

Valid options are:

  • method: optimization method to use for the theta optimization:

    • 'BFGS' (default): optim(...,method = "BFGS")

    • 'sparse_trust': trustOptim::trust.optim

    • 'SR1': trustOptim::trust.optim with method = 'SR1'

    • 'sparse': trust::trust

  • negate: default TRUE. Assumes that your TMB function template computes the negated log-posterior, which it must if you're using TMB's automatic Laplace approximation, which you must be if you're using this function!.

  • interpolation: how to interpolate the marginal posteriors. The 'auto' option (default) chooses for you and should always work well. The 'polynomial' option uses polynom::poly.calc() to construct a global polynomial interpolant and has been observed to be unstable as the number of quadrature points gets larger, which is obviously a bad thing. Try 'spline' instead, which uses a cubic B-Spline interpolant from splines::interpSpline().

  • numhessian: logical, default TRUE. Replace the ff$he with a numerically-differentiated version, by calling numDeriv::jacobian on ff$gr. Used mainly for TMB with the automatic Laplace approximation, which does not have an automatic Hessian.

  • onlynormconst: logical, default FALSE. Skip everything after the calculation of the log integral, and just return the numeric value of the log integral. Saves computation time, and most useful in cases where aghq is being used as a step in a more complicated procedure.

  • method_summaries: default 'reuse', method to use to compute moments and marginals. Choosing 'correct' corresponds to the approximations suggested in the Stochastic Convergence... paper, which attain the same rate of convergence as the approximation to the marginal likelihood. See ?compute_moment.

Value

A list of argument values.

Examples


default_control_tmb()
default_control_tmb(method = "trust")


aghq documentation built on June 7, 2023, 5:10 p.m.