Learn R Programming

excursions (version 2.0.6)

simconf.inla: Simultaneous confidence regions for latent Gaussian models

Description

simconf.inla is used for calculating simultaneous confidence regions for latent Gaussian models estimated using INLA.

Usage

simconf.inla(result.inla,
             stack,
             name=NULL,
             tag=NULL,
             ind=NULL,
             alpha,
             method="NI",
             n.iter=10000,
             verbose=0,
             max.threads=0,
             seed=NULL,
             inla.sample=TRUE)

Arguments

result.inla
Result object from INLA call
stack
The stack object used in the INLA call.
tag
The tag of the component in the stack for which to do the calculation. This argument should only be used if a stack object is provided, use the name argument otherwise.
name
The name of the component for which to do the calculation. This argument should only be used if a stack object is not provided, use the tag argument otherwise.
ind
If only a part of a component should be used in the calculations, this argument specifies the indices for that part.
method
Method for handeling the latent Gaussian structure:
  • 'EB'
{Empirical Bayes (Gaussian approximation of posterior)} 'NI'{Numerical integration (Calculation based on the Gaussian mixture approximation of the posterior,

Value

  • A list:
  • aThe lower bound.
  • bThe upper bound.
  • a.marginalThe lower bound for pointwise confidence bands.
  • b.marginalThe upper bound for pointwise confidence bands.

item

  • alpha
  • n.iter
  • verbose
  • max.threads
  • seed
  • inla.sample

Examples

Run this code
if (require(INLA)) {
n <- 10
x <- seq(0, 6, length.out=n)
y <- sin(x) + rnorm(n)
mu <- 1:n

result <- inla(y ~ 1 + f(mu, model='rw2'),
               data=list(y=y, mu=mu), verbose=FALSE,
               control.compute = list(config=TRUE),
               num.threads = 1)

res <- simconf.inla(result, name='mu', alpha = 0.05, max.threads = 1)

plot(result$summary.random$mu$mean,ylim=c(-2,2))
lines(res$a)
lines(res$b)
lines(res$a.marginal,col="2")
lines(res$b.marginal,col="2")
}

Run the code above in your browser using DataLab