inla.spde2.matern: Matern SPDE model object for INLA

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/spde2.R

Description

Create an inla.spde2 model object for a Matern model. Use inla.spde2.pcmatern instead for a PC prior for the parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
inla.spde2.matern(mesh,
                  alpha = 2,
                  param = NULL,
                  constr = FALSE,
                  extraconstr.int = NULL,
                  extraconstr = NULL,
                  fractional.method = c("parsimonious", "null"),
                  B.tau = matrix(c(0,1,0),1,3),
                  B.kappa = matrix(c(0,0,1),1,3),
                  prior.variance.nominal = 1,
                  prior.range.nominal = NULL,
                  prior.tau = NULL,
                  prior.kappa = NULL,
                  theta.prior.mean = NULL,
                  theta.prior.prec = 0.1,
                  n.iid.group = 1,
                  ...)

Arguments

mesh

The mesh to build the model on, as an inla.mesh or inla.mesh.1d object.

alpha

Fractional operator order, 0<α≤q 2 supported. (ν=α-d/2)

param

Parameter, e.g. generated by param2.matern.orig

constr

If TRUE, apply an integrate-to-zero constraint. Default FALSE.

extraconstr.int

Field integral constraints.

extraconstr

Direct linear combination constraints on the basis weights.

fractional.method

Specifies the approximation method to use for fractional (non-integer) alpha values. 'parsimonious' gives an overall approximate minimal covariance error, 'null' uses approximates low-order properties.

B.tau

Matrix with specification of log-linear model for τ.

B.kappa

Matrix with specification of log-linear model for κ.

prior.variance.nominal

Nominal prior mean for the field variance

prior.range.nominal

Nominal prior mean for the spatial range

prior.tau

Prior mean for tau (overrides prior.variance.nominal)

prior.kappa

Prior mean for kappa (overrides prior.range.nominal)

theta.prior.mean

(overrides prior.*)

theta.prior.prec

Scalar, vector or matrix, specifying the joint prior precision for theta.

n.iid.group

If greater than 1, build an explicitly iid replicated model, to support constraints applied to the combined replicates, for example in a time-replicated spatial model. Constraints can either be specified for a single mesh, in which case it's applied to the average of the replicates (ncol(A) should be mesh$n for 2D meshes, mesh$m for 1D), or as general constraints on the collection of replicates (ncol(A) should be mesh$n * n.iid.group for 2D meshes, mesh$m * n.iid.group for 1D).

...

Additional parameters for special uses.

Details

This method constructs a Matern SPDE model, with spatial scale parameter κ(u) and variance rescaling parameter τ(u).

(kappa^2(u)-Delta)^(alpha/2) (tau(u) x(u)) = W(u)

Stationary models are supported for 0 < α ≤q 2, with spectral approximation methods used for non-integer α, with approximation method determined by fractional.method.

Non-stationary models are supported for α=2 only, with

The same parameterisation is used in the stationary cases, but with B^τ_0, B^τ_k, B^κ_0, and B^τ_k constant across u.

Integration and other general linear constraints are supported via the constr, extraconstr.int, and extraconstr parameters, which also interact with n.iid.group.

Value

An inla.spde2 object.

Author(s)

Finn Lindgren finn.lindgren@gmail.com

See Also

inla.mesh.2d, inla.mesh.create, inla.mesh.1d, inla.mesh.basis, inla.spde2.pcmatern, inla.spde2.generic

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
n = 100
field.fcn = function(loc) (10*cos(2*pi*2*(loc[,1]+loc[,2])))
loc = matrix(runif(n*2),n,2)
## One field, 2 observations per location
idx.y = rep(1:n,2)
y = field.fcn(loc[idx.y,]) + rnorm(length(idx.y))

mesh = inla.mesh.create(loc, refine=list(max.edge=0.05))
spde = inla.spde2.matern(mesh)
data = list(y=y, field=mesh$idx$loc[idx.y])
formula = y ~ -1 + f(field, model=spde)
result = inla(formula, data=data, family="normal")

## Plot the mesh structure:
plot(mesh)

if (require(rgl)) {
  col.pal = colorRampPalette(c("blue","cyan","green","yellow","red"))
  ## Plot the posterior mean:
  plot(mesh, rgl=TRUE,
       result$summary.random$field[,"mean"],
       color.palette = col.pal)
  ## Plot residual field:
  plot(mesh, rgl=TRUE,
       result$summary.random$field[,"mean"]-field.fcn(mesh$loc),
       color.palette = col.pal)
}

result.field = inla.spde.result(result, "field", spde)
plot(result.field$marginals.range.nominal[[1]])

inbo/INLA documentation built on Dec. 6, 2019, 9:51 a.m.