The component definitions will automatically attempt to extract mapper
information from any model object by calling the generic bru_get_mapper
.
Any class method implementation should return a bru_mapper object suitable
for the given latent model.
Usage
bru_get_mapper(model, ...)
# S3 method for class 'inla.spde'
bru_get_mapper(model, ...)
# S3 method for class 'inla.rgeneric'
bru_get_mapper(model, ...)
bru_get_mapper_safely(model, ...)
Value
A bru_mapper object defined by the model component
Methods (by class)
bru_get_mapper(inla.spde)
: Extract an indexed mapper for themodel$mesh
object contained in the model object. It returnsNULL
gives a warning if no known mesh type is found in the model object.bru_get_mapper(inla.rgeneric)
: Returns the mapper given by a call tomodel$f$rgeneric$definition("mapper")
. To support this for your owninla.rgeneric
models, add a"mapper"
option to thecmd
argument of your rgeneric definition function. You will need to store the mapper in your object as well. Alternative, define your model using a subclass and define a correspondingbru_get_mapper.subclass
method that should return the correspondingbru_mapper
object.
Functions
bru_get_mapper_safely()
: Tries to call thebru_get_mapper
, and returnsNULL
if it fails (e.g. due to no available class method). If the call succeeds and returns non-NULL
, it checks that the object inherits from thebru_mapper
class, and gives an error if it does not.
See also
bru_mapper for mapper constructor methods, and the individual mappers for specific implementation details.
Other mappers:
bru_mapper()
,
bru_mapper.fm_mesh_1d()
,
bru_mapper.fm_mesh_2d()
,
bru_mapper_aggregate()
,
bru_mapper_collect()
,
bru_mapper_const()
,
bru_mapper_factor()
,
bru_mapper_fmesher()
,
bru_mapper_generics
,
bru_mapper_harmonics()
,
bru_mapper_index()
,
bru_mapper_linear()
,
bru_mapper_logsumexp()
,
bru_mapper_marginal()
,
bru_mapper_matrix()
,
bru_mapper_mesh_B()
,
bru_mapper_multi()
,
bru_mapper_pipe()
,
bru_mapper_repeat()
,
bru_mapper_scale()
,
bru_mapper_shift()
,
bru_mapper_taylor()
Examples
if (bru_safe_inla()) {
library(INLA)
mesh <- fmesher::fm_rcdt_2d_inla(globe = 2)
spde <- inla.spde2.pcmatern(mesh,
prior.range = c(1, 0.5),
prior.sigma = c(1, 0.5)
)
mapper <- bru_get_mapper(spde)
ibm_n(mapper)
}
#> Loading required package: Matrix
#> This is INLA_24.11.17 built 2024-11-17 09:15:42 UTC.
#> - See www.r-inla.org/contact-us for how to get help.
#> - List available models/likelihoods/etc with inla.list.models()
#> - Use inla.doc(<NAME>) to access documentation
#> [1] 42