View source: R/spatial_rsr_spde.R
| spatial_spde_custom | R Documentation |
Specify a continuous Matern spatial field using externally-provided FEM matrices. Use this with meshes from fmesher, rSPDE, or any other source.
spatial_spde_custom(
C,
G,
A,
nu = 1,
prior_range = NULL,
prior_sigma = NULL,
coords = NULL
)
C |
Mass matrix (n_mesh x n_mesh sparse matrix, e.g. from |
G |
Stiffness matrix (n_mesh x n_mesh sparse matrix, e.g. from |
A |
Projection matrix (n_obs x n_mesh sparse matrix, e.g. from |
nu |
Matern smoothness parameter. A positive number; integer values
give the exact FEM construction, fractional values the BRASIL rational SPDE
approximation (supported by |
prior_range |
PC prior on the spatial range, |
prior_sigma |
PC prior on the marginal standard deviation, |
coords |
Observation coordinates (an |
A tulpa_spatial object with type "spde".
# FEM matrices of a 6-node 1-D chain mesh, observed at the nodes:
n <- 6L
C <- Matrix::Diagonal(n)
G <- Matrix::bandSparse(n, k = c(-1, 0, 1),
diagonals = list(rep(-1, n - 1), c(1, rep(2, n - 2), 1),
rep(-1, n - 1)))
A <- Matrix::Diagonal(n)
sp <- spatial_spde_custom(C, G, A, prior_range = c(1, 0.5),
prior_sigma = c(1, 0.01))
sp$type
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.