rspde.precision: Precision matrices for 'inla_rspde' objects

View source: R/inla_rspde.R

rspde.precisionR Documentation

Precision matrices for inla_rspde objects

Description

Precision matrices for rSPDE models

Calculates the precision matrix for given parameter values based on an inla_rspde model object.

Usage

rspde.precision(rspde, theta, optimized = FALSE)

Arguments

rspde

An inla_rspde object.

theta

The parameter vector. See the details in rspde.matern() to see the parameterizations.

optimized

Logical indicating if only the elements (the x slot) of the precision matrix should be returned.

Value

A sparse precision matrix.

Examples

 #tryCatch version
tryCatch({
if (requireNamespace("INLA", quietly = TRUE)){
library(INLA)

set.seed(1)
n <- 10

coords <- cbind(long = sample(1:n), lat = sample(1:n))

mesh <- inla.mesh.2d(coords, max.edge = c(20, 40))
rspde_model_int <- rspde.matern(mesh = mesh, nu = 1)

prec_int <- rspde.precision(rspde_model_int, theta = log(c(1, 3)))

rspde_model <- rspde.matern(mesh)
prec <- rspde.precision(rspde_model, theta = log(c(1, 3, 1.2)))
}
#stable.tryCatch
}, error = function(e){print("Could not run the example")})


rSPDE documentation built on Sept. 17, 2022, 1:05 a.m.

Related to rspde.precision in rSPDE...