bru_mapper
objectsMethods for bru_mapper
objects
bru_mapper(...)ibm_n(mapper, ...)
ibm_values(mapper, ...)
ibm_amatrix(mapper, input, ...)
ibm_valid_input(mapper, input, ...)
# S3 method for default
bru_mapper(
mapper,
new_class = NULL,
ibm_n = NULL,
ibm_values = NULL,
ibm_amatrix = NULL,
ibm_valid_input = NULL,
...
)
# S3 method for inla.mesh
bru_mapper(mesh, ...)
# S3 method for inla.mesh.1d
bru_mapper(mesh, indexed = NULL, ...)
bru_mapper_index(n = 1L, ...)
bru_mapper_linear(...)
bru_mapper_factor(values, factor_mapping, ...)
bru_mapper_offset(...)
bru_mapper_multi(mappers, ...)
Arguments passed on to other methods
A mapper S3 object, normally inheriting from bru_mapper
.
For the default bru_mapper
method, a list that will be converted to a
bru_mapper
object by adding class information and (optional) methods.
The values for which to produce validity information
If non-NULL
, this is added at the front of the class definition
An ibm_n
method function
An ibm_values
method function
An ibm_amatrix
method function
An ibm_valid_input
method function
An inla.mesh.1d
or inla.mesh.2d
object to use as a mapper
logical; If TRUE
, the ibm_values()
output will be the
integer indexing sequence for the latent variables (needed for spde
models).
If FALSE
, the knot
locations are returned (useful as an interpolator for rw2
models
and similar).
Default: NULL
, to force user specification of this parameter
Size of a model for bru_mapper_index
Input values calculated by input_eval.bru_input()
character; selects the type of factor mapping.
'contrast'
for leaving out the first factor level.
'full'
for keeping all levels.
A list of bru_mapper
objects
bru_mapper
Generic mapper S3 constructor. See below for details of the
default constructor that can be used to define new mappers in user code.
ibm_n
Generic. Implementations must return the size of the latent vector
being mapped to.
ibm_values
Generic. Implementations must return a vector that
is interpretable by an INLA::f(..., values = ...)
specification, and
has length ibm_n()
.
ibm_amatrix
Generic.
Implementations must return a (sparse) matrix of size NROW(input)
(except for the bru_mapper_multi
method)
by ibm_n(mapper)
ibm_valid_input
Generic.
Implementations must return a logical vector of length NROW(input)
bru_mapper.default
adds the "bru_mapper" class and new_class
to an object. If provided, mapper method functions are added to an environment
.envir
in the object. The generic methods ibm_n
, ibm_values
,
ibm_amatrix
, and ibm_valid_input
look for these functions first,
and otherwise call UseMethod()
. This is an alternative to using .S3method()
to register the methods, e.g.
.S3method("ibm_amatrix", "my_mapper_class", ibm_amatrix.my_mapper_class)
.
bru_mapper_multi
constructs a kronecker product mapping
bru_mapper_methods for specific method implementations.
# NOT RUN {
mapper <- bru_mapper_index(5)
ibm_amatrix(mapper, c(1,3,4,5,2))
# }
Run the code above in your browser using DataLab