lapprox {qslice}R Documentation

Pseudo-target from Laplace Approximation

Description

Find the location and scale for an approximating pseudo-target via Laplace approximation.

Usage

lapprox(
  log_target,
  init,
  family = "t",
  params = NULL,
  sc_adj = 1,
  lb = -Inf,
  ub = Inf,
  maxit = 100,
  ...
)

Arguments

log_target

Univariate function evaluating the unnormalized log density to approximate.

init

Numeric scalar for an initial value (used in optimization).

family

String specifying the family of distributions for the pseudo-target. Can be any of the families accepted by pseudo_list.

params

List specifying the parameters for the pseudo-target to be used. The location and scale parameters will be replaced with the Laplace approximation and others (e.g., degrees of freedom) will be retained.

sc_adj

Positive numeric scalar; manual multiplicative adjustment to the scale of the output pseudo-target.

lb

Numeric scalar giving the value of left truncation of the resulting pseudo-target. Defaults to -Inf.

ub

Numeric scalar giving the value of right truncation of the resulting pseudo-target. Defaults to Inf.

maxit

See optim.

...

See optim.

Value

A list with the same outputs as pseudo_list; also includes opt, which gives output of optim.

Examples

pseu <- lapprox(function(x) dnorm(x, log = TRUE),
  family = "t",
  params = list(loc = NA, sc = NA, degf = 5.0),
  init = 0.5, lb = -1.0)
curve(dnorm(x)/(1- pnorm(-1)), from = -1, to = 6, col = "blue")
xx <- seq(-1, 6, length = 500)
lines(xx, sapply(xx, FUN = pseu$d))

[Package qslice version 0.3.1 Index]