posterior.sample: Generate samples from an approximated posterior of a fitted...

Description Usage Arguments Value Author(s) Examples

Description

This function generate samples from an approximated posterior of a fitted model, ie an inla-object

Usage

1
2
     inla.posterior.sample(n = 1L, result, hyper.user.scale = TRUE, use.improved.mean = 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).

hyper.user.scale

Logical. If TRUE then values of the hyperparameters are given in the user scale (for example precision). If FALSE then values of the hyperparameters are given in the internal representation (for example log(precision)).

use.improved.mean

Logical. If TRUE then use the marginal mean values when constructing samples. If FALSE then use the mean in the Gaussian approximations.

Value

A list of the samples, where each sample is a list with names hyperpar and latent, and with their marginal densities in logdens$hyperpar and logdens$latent and the joint density is in logdens$joint. THIS IS AN EXPERIMENTAL FUNCTION AND CHANGES MAY APPEAR AT ANY TIME!

Author(s)

Havard Rue hrue@math.ntnu.no

Examples

1
2
  r = inla(y ~ 1 ,data = data.frame(y=rnorm(1)), control.compute = list(config=TRUE))
  samples = inla.posterior.sample(2,r)

andrewzm/INLA documentation built on May 10, 2019, 11:12 a.m.