kCompute: Use sparse grid quadrature techniques to integrate...

Description Usage Arguments Examples

View source: R/kCompute.R

Description

This function integrates (unnormalized) densities and may be used to compute integration constants for unnormalized densities, or to marginalize a joint density, for example.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
kCompute(
  f,
  init,
  method = "BFGS",
  maxit = 10000,
  level = 2,
  log = FALSE,
  link = NULL,
  linkparams = NULL,
  quadError = FALSE,
  ...
)

Arguments

f

(Unnormalized) density to integrate. the function f should include an argument log, which returns log(f(x)).

init

Initial guess for the density's mode

method

method to be used to search for the density's mode

maxit

maximum number of iterations optim should use in searching for the density's mode

level

accuracy level (typically number of grid points for the underlying 1D quadrature rule) [description from mvQuad::createNIGrid]

log

TRUE to return log of integration constant

link

character vector that specifies transformations used during optimization and integration of f(theta2 | X). while theta2 may be defined on arbitrary support, wtdMix performs optimization and integration of theta2 on an unconstrained support. the link vector describes the transformations that must be applied to each element of theta2. Jacobian functions for the transformations will automatically be added to the optimization and integration routines. currently supported link functions are 'log', 'logit', and 'identity'.

linkparams

Optional list of additional parameters for link functions. For example, the logit function can be extended to allow mappings to any closed interval. There should be one list entry for each link function. Specify NA if no additional arguments are passed.

quadError

TRUE if integration nodes and weight should be computed for the level-1 integration grid, so that quadrature approximation error can be estimated.

...

additional arguments to pass to f

Examples

1
kCompute(dgamma, init = 1, shape=2, link='log', level = 5)

jmhewitt/bisque documentation built on Feb. 9, 2020, 2:36 a.m.