This function generate samples, and functions of those, from an approximated posterior of a fitted model (an inla-object)

inla.posterior.sample(n = 1L, result, selection = list(), 
intern = FALSE,
use.improved.mean = TRUE, skew.corr = TRUE, 
add.names = TRUE, seed = 0L, num.threads = NULL, 
verbose=FALSE)
inla.posterior.sample.eval(fun, samples, return.matrix = TRUE, ...)

Arguments

n

Number of samples.

result

The inla-object, ie the output from an inla-call. The inla-object must be created with control.compute=list(config=TRUE).

selection

Select what part of the sample to return. By default, the whole sample is returned. selection is a named list with the name of the components of the sample, and what indices of them to return. Names include APredictor, Predictor, (Intercept), and otherwise names in the formula. The values of the list, is interpreted as indices. If they are negative, they are interpreted as 'not', a zero is interpreted as 'all', and positive indices are interpreted as 'only'. The names of elements of each samples refer to the indices in the full sample.