Preparations before fitting with inla()

  • define the SPDE model, after choosing the smoothness parameter \(\nu\) (e.g. set \(\nu = 1\), which means \(\alpha = 2\) in a 2D plane)
spde <- inla.spde2.matern(mesh = mesh, alpha = 2, constr = TRUE)
  • create an index set for the SPDE model
indexs <- inla.spde.make.index("s", spde$n.spde)
> str(indexs)
List of 3
 $ s      : int [1:3747] 1 2 3 4 5 6 7 8 9 10 ...
 $ s.group: int [1:3747] 1 1 1 1 1 1 1 1 1 1 ...
 $ s.repl : int [1:3747] 1 1 1 1 1 1 1 1 1 1 ...