Description Usage Arguments Value Author(s) See Also Examples
Generates a list of named index vectors for an SPDE model.
1 2 3 4 5 | inla.spde.make.index(name,
n.spde,
n.group = 1,
n.repl = 1,
...)
|
name |
A character string with the base name of the effect. |
n.spde |
The size of the model, typically from |
n.group |
The size of the |
n.repl |
The number of model replicates. |
... |
Additional parameters. Currently unused. |
A list of named index vectors.
name |
Indices into the vector of latent variables |
name.group |
'group' indices |
name.repl |
Indices for replicates |
Finn Lindgren finn.lindgren@gmail.com
inla.spde.make.A
,
inla.spde2.result
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | loc = matrix(runif(100*2),100,2)
mesh = inla.mesh.create.helper(points.domain=loc, max.edge=c(0.1,0.5))
spde = inla.spde2.matern(mesh)
index = inla.spde.make.index("spatial", spde$n.spde, n.repl=2)
spatial.A = inla.spde.make.A(mesh, loc,
index=rep(1:nrow(loc), 2),
repl=rep(1:2, each=nrow(loc)))
y = 10+rnorm(100*2)
stack = inla.stack(data=list(y=y),
A=list(spatial.A),
effects=list(c(index, list(intercept=1))),
tag="tag")
data = inla.stack.data(stack, spde=spde)
formula = y ~ -1 + intercept + f(spatial, model=spde,
replicate=spatial.repl)
result = inla(formula, family="gaussian", data=data,
control.predictor=list(A=inla.stack.A(stack)))
spde.result = inla.spde2.result(result, "spatial", spde)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.