contourmap
is used for calculating contour maps and quality measures for contour maps for Gaussian models.
contourmap(
mu,
Q,
vars,
n.levels,
ind,
levels,
type = c("standard", "pretty", "equalarea", "P0-optimal", "P1-optimal", "P2-optimal"),
compute = list(F = TRUE, measures = NULL),
use.marginals = TRUE,
alpha,
F.limit,
n.iter = 10000,
verbose = FALSE,
max.threads = 0,
seed = NULL
)
contourmap
returns an object of class "excurobj" with the following elements
Contour levels used in the contour map.
The number of contours used.
The values associated with the level sets G_k.
A vector which shows which of the level sets G_k each node belongs to.
Representation of the contour map with map[i]=u.e[k] if i is in G_k.
The contour map function (if computed).
Contour avoiding sets (if F
is computed). \(M=-1\) for all non-significant nodes and \(M=k\) for nodes that belong to \(M_k\).
Calculated quality measures (if computed).
Calculated upper bounds quality measures (if computed).
A list containing various information about the calculation.
Expectation vector.
Precision matrix.
Precomputed marginal variances (optional).
Number of levels in contour map.
Indices of the nodes that should be analyzed (optional).
Levels to use in contour map.
Type of contour map. One of:
Equidistant levels between smallest and largest value of the posterior mean (default).
Equally spaced 'round' values which cover the range of the values in the posterior mean.
Levels such that different spatial regions are approximately equal in size.
Levels chosen to maximize the P0 measure.
Levels chosen to maximize the P1 measure.
Levels chosen to maximize the P2 measure.
A list with quality indices to compute
TRUE/FALSE indicating whether the contour map function should be computed (default TRUE).
A list with the quality measures to compute ("P0", "P1", "P2") or corresponding bounds based only on the marginal probabilities ("P0-bound", "P1-bound", "P2-bound").
Only marginal distributions are used when finding P-optimal maps (default TRUE).
Maximal error probability in contour map function (default=1).
The limit value for the computation of the F function. F is set to NA for all nodes where F<1-F.limit. Default is F.limit = alpha
.
Number or iterations in the MC sampler that is used for calculating the quantities in compute
. The default value is 10000.
Set to TRUE for verbose mode (optional).
Decides the number of threads the program can use. Set to 0 for using the maximum number of threads allowed by the system (default).
Random seed (optional).
David Bolin davidbolin@gmail.com
The Gaussian model is specified using the mean mu
and the precision matrix
Q
. The contour map is then computed for the mean, using either the contour
levels specified in levels
, or n.levels
contours that are placed according
to the argument type
.
A number of quality measures can be computed based based on the specified contour map
and the Gaussian distribution. What should be computed is specified using the
compute
argument. For details on these quanties, see the reference below.
Bolin, D. and Lindgren, F. (2017) Quantifying the uncertainty of contour maps, Journal of Computational and Graphical Statistics, vol 26, no 3, pp 513-524.
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.
contourmap.inla
, contourmap.mc
, contourmap.colors
n <- 10
Q <- Matrix(toeplitz(c(1, -0.5, rep(0, n - 2))))
mu <- seq(-5, 5, length = n)
lp <- contourmap(mu, Q,
n.levels = 2,
compute = list(F = FALSE, measures = c("P1", "P2")),
max.threads = 1
)
# Plot the contourmap
plot(lp$map)
# Display the quality measures
cat(c(lp$P1, lp$P2))
Run the code above in your browser using DataLab