inla.spde1.create: Old SPDE model objects for INLA

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

Description

Create an inla.spde1 model object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Create an SPDE model object:
inla.spde1.create(mesh,
                  model = c("matern", "imatern", "matern.osc"),
                  param = NULL,
                  ...)

## Shortcuts to the matern, imatern and matern.osc models:
inla.spde1.matern(mesh, ...)
inla.spde1.imatern(mesh, ...)
inla.spde1.matern.osc(mesh, ...)

Arguments

mesh

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

model

The name of the model.

param

Model specific parameters.

...

Additional parameters passed on to other methods.

Details

Note: This is an old spde object format retained for backwards compatibility. Please use inla.spde2 models for new code.

This method constructs an object for SPDE models. Currently implemented:

model="matern"

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

param:

model="imatern"

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

param:

Value

An inla.spde1 object.

Author(s)

Finn Lindgren finn.lindgren@gmail.com

See Also

inla.spde2.matern, inla.mesh.2d, inla.mesh.basis

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
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.spde.create(mesh, model="matern")
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)) {
  ## Plot the posterior mean:
  plot(mesh, rgl=TRUE,
       result$summary.random$field[,"mean"],
       color.palette = colorRampPalette(c("blue","green","red")))
  ## Plot residual field:
  plot(mesh, rgl=TRUE,
       result$summary.random$field[,"mean"]-field.fcn(mesh$loc),
       color.palette = colorRampPalette(c("blue","green","red")))
}

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