post.sample: A posterior sample as returned by posteriorMCMC
densityGrid: A function returning a npoints*npoints
matrix, representing a discretized version of the spectral density on the two dimensional simplex. The function should be compatible with dgridplot. In particular, it must use discretize to produce the discretization grid. It must be of type
function(par, npoints, eps, equi, displ,invisible, ... ). See Details below.
from: Integer or NULL. If NULL, the default value is used. Otherwise, should be greater than post.sample$Nbin. Indicates the index where the averaging process should start. Default to post.sample$Nbin +1
to: Integer or NULL. If NULL, the default value is used. Otherwise, must be lower than Nsim+1. Indicates where the averaging process should stop. Default to post.sample$Nsim.
thin: Thinning interval.
npoints: The number of grid nodes on the squared grid containing the desired triangle.
eps: Positive number: minimum distance from any node inside the simplex to the simplex boundary
equi: logical. Is the simplex represented as an equilateral triangle (if TRUE) or a right triangle (if FALSE) ?
displ: logical. Should a plot be produced ?
...: Additional graphical parameters and arguments to be passed to contour and image.
Returns
A npoints*npoints matrix: the posterior predictive density.
Details
The posterior predictive density is approximated by averaging the densities produced by the function densityGrid(par, npoints, eps, equi, displ,invisible, ...) for par in a subset of the parameters sample stored in post.sample. The arguments of densityGrid must be
par: A vector containing the parameters.
npoints, eps, equi: Discretization parameters to be passed to dgridplot.
displ: logical. Should a plot be produced ?
invisible: logical. Should the result be returned as invisible ?
... additional arguments to be passed to dgridplot
Only a sub-sample is used: one out of thin parameters is used (thinning). Further, only the parameters produced between time from and time to (included) are kept.
Note
The computational burden may be high: it is proportional to npoints^2. Therefore, the function assigned to densityGridplot should be optimized, typically by calling .C with an internal, user defined C function.