simconf.inla: Simultaneous confidence regions for latent Gaussian models

View source: R/simconf.inla.R

simconf.inlaR Documentation

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,
  link = FALSE,
  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.

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.

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.

ind

If only a part of a component should be used in the calculations, this argument specifies the indices for that part.

alpha

Error probability for the region.

method

Method for handling the latent Gaussian structure:

'EB'

Empirical Bayes (Gaussian approximation of posterior).

'NI'

Numerical integration (Calculation based on the Gaussian mixture approximation of the posterior, as calculated by INLA).

n.iter

Number or iterations in the MC sampler that is used for approximating probabilities. The default value is 10000.

verbose

Set to TRUE for verbose mode (optional).

link

Transform output to the scale of the data using the link function as defined in the model estimated with INLA (default FALSE).

max.threads

Decides the number of threads the program can use. Set to 0 for using the maximum number of threads allowed by the system (default).

seed

Random seed (optional).

inla.sample

Set to TRUE if inla.posterior.sample should be used for the MC integration.

Details

See simconf for details.

Value

An object of class "excurobj" with elements

a

The lower bound.

b

The upper bound.

a.marginal

The lower bound for pointwise confidence bands.

b.marginal

The upper bound for pointwise confidence bands.

Note

This function requires the INLA package, which is not a CRAN package. See https://www.r-inla.org/download-install for easy installation instructions.

Author(s)

David Bolin davidbolin@gmail.com

References

Bolin et al. (2015) Statistical prediction of global sea level from global temperature, Statistica Sinica, vol 25, pp 351-367.

Bolin, D. and Lindgren, F. (2018), Calculating Probabilistic Excursion Sets and Related Quantities Using excursions, Journal of Statistical Software, vol 86, no 1, pp 1-20.

See Also

simconf, simconf.mc, simconf.mixture

Examples

## Not run: 
if (require.nowarnings("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,
      return.marginals.predictor = TRUE
    ),
    num.threads = "1: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")
}

## End(Not run)


excursions documentation built on Oct. 23, 2023, 5:07 p.m.