Learn R Programming

glmBfp (version 0.0-60)

getMarginalZ: Construct a (smooth) marginal z density approximation from a model information list

Description

Construct a (smooth) marginal z density approximation from a model information list

Usage

getMarginalZ(
  info,
  method = c("linear", "spline", "logspline", "normalspline", "normal"),
  verbose = FALSE,
  plot = FALSE
)

Arguments

info

the model information list

method

method for approximating the marginal density:

linear

Linearly interpolate the points.

spline

The saved points of the unnormalized density approximation are joined by a “monotonic” spline. The density is smoothed out to zero at the tails. Since the spline might be slightly negative for extreme values, the positive part is returned.

logspline

The saved points of the log unnormalized density approximation are joined by a “monotonic” spline, which is then exponentiated.

normalspline

A “monotonic” spline is fitted to the differences of the saved log density values and the log normal approximation. The resulting spline function is exponentiated and then multiplied with the normal density.

normal

Just take the normal approximation.

This may also be a vector with more than one method names, to select the modify the preference sequence: If the first method does not work, the second is tried and so on. The normal approximation always works (but may give bad results).
verbose

Echo the chosen method? (not default)

plot

produce plots of the different approximation steps? (not default)

Value

a list with the log of the normalized density approximation (“logDens”) and the random number generator (“gen”).