A bru_mapper
sub-class implementation must provide an
ibm_matrix()
method. If the model size 'n' and definition
values 'values' are stored in the object itself, default methods are
available (see Details). Otherwise the
ibm_n()
and ibm_values()
methods also need to be provided.
# S3 method for default
ibm_n(mapper, inla_f = FALSE, ...)# S3 method for default
ibm_values(mapper, inla_f = FALSE, ...)
# S3 method for default
ibm_amatrix(mapper, input, inla_f = FALSE, ...)
# S3 method for default
ibm_valid_input(mapper, input, ...)
# S3 method for bru_mapper_inla_mesh_2d
ibm_n(mapper, ...)
# S3 method for bru_mapper_inla_mesh_2d
ibm_values(mapper, ...)
# S3 method for bru_mapper_inla_mesh_2d
ibm_amatrix(mapper, input, ...)
# S3 method for bru_mapper_inla_mesh_1d
ibm_n(mapper, ...)
# S3 method for bru_mapper_inla_mesh_1d
ibm_values(mapper, ...)
# S3 method for bru_mapper_inla_mesh_1d
ibm_amatrix(mapper, input, ...)
# S3 method for bru_mapper_index
ibm_valid_input(mapper, input, ...)
# S3 method for bru_mapper_index
ibm_amatrix(mapper, input, ...)
# S3 method for bru_mapper_linear
ibm_n(mapper, ...)
# S3 method for bru_mapper_linear
ibm_values(mapper, ...)
# S3 method for bru_mapper_linear
ibm_amatrix(mapper, input, ...)
# S3 method for bru_mapper_matrix
ibm_n(mapper, ...)
# S3 method for bru_mapper_matrix
ibm_values(mapper, ...)
# S3 method for bru_mapper_matrix
ibm_amatrix(mapper, input, ...)
# S3 method for bru_mapper_factor
ibm_n(mapper, ...)
# S3 method for bru_mapper_factor
ibm_values(mapper, ...)
# S3 method for bru_mapper_factor
ibm_amatrix(mapper, input, ...)
# S3 method for bru_mapper_offset
ibm_n(mapper, ...)
# S3 method for bru_mapper_offset
ibm_values(mapper, ...)
# S3 method for bru_mapper_offset
ibm_amatrix(mapper, input, ...)
# S3 method for bru_mapper_multi
ibm_n(mapper, inla_f = FALSE, multi = 0L, ...)
# S3 method for bru_mapper_multi
ibm_values(mapper, inla_f = FALSE, multi = 0L, ...)
# S3 method for bru_mapper_multi
ibm_amatrix(mapper, input, inla_f = FALSE, multi = 0L, ...)
# S3 method for bru_mapper_multi
ibm_valid_input(mapper, input, inla_f = FALSE, multi = 0L, ...)
# S3 method for bru_mapper_multi
[(x, i, drop = TRUE)
# S3 method for bru_mapper_multi
names(x)
# S3 method for bru_mapper_multi
names(x) <- value
# S3 method for bru_mapper_collect
ibm_n(mapper, inla_f = FALSE, multi = 0L, ...)
# S3 method for bru_mapper_collect
ibm_values(mapper, inla_f = FALSE, multi = 0L, ...)
# S3 method for bru_mapper_collect
ibm_amatrix(mapper, input, inla_f = FALSE, multi = 0L, ...)
# S3 method for bru_mapper_collect
ibm_valid_input(mapper, input, inla_f = FALSE, multi = 0L, ...)
# S3 method for bru_mapper_collect
[(x, i, drop = TRUE)
# S3 method for bru_mapper_collect
names(x)
# S3 method for bru_mapper_collect
names(x) <- value
# S3 method for bru_mapper_harmonics
ibm_n(mapper, inla_f = FALSE, ...)
# S3 method for bru_mapper_harmonics
ibm_amatrix(mapper, input, inla_f = FALSE, ...)
[
-indexing a bru_mapper_multi
extracts a subset
bru_mapper_multi
object (for drop FALSE
) or an individual sub-mapper
(for drop TRUE
, and i
identifies a single element)
The names()
method for bru_mapper_multi
returns the names from the
sub-mappers list
[
-indexing a bru_mapper_collect
extracts a subset
bru_mapper_collect
object (for drop FALSE
) or an individual sub-mapper
(for drop TRUE
, and i
identifies a single element)
The names()
method for bru_mapper_collect
returns the names from the
sub-mappers list
A mapper S3 object, normally inheriting from bru_mapper
logical; when TRUE
in ibm_n
and ibm_values
, these must result in values compatible with INLA::f(...)
an specification and corresponding INLA::inla.stack(...)
constructions.
For ibm_amatrix
methods, it may influence how the input data is interpreted.
Implementations do not normally need to do anything different, except
for mappers of the type needed for hidden multicomponent models such
as "bym2", which can be handled by bru_mapper_collect
.
Arguments passed on to other methods
The values for which to produce a mapping matrix
integer or logical;
If positive, the number of levels to recurse in a bru_collect_mapper
.
If TRUE
, equivalent to 1L
. If FALSE
, equivalent to 0L
.
object from which to extract element(s)
indices specifying element(s) to extract
logical;
For [.bru_mapper_collect
, whether to extract an individual mapper when
i
identifies a single element. If FALSE
, a list of sub-mappers is
returned (suitable e.g. for creating a new bru_mapper_collect
object).
Default: TRUE
a character vector of up to the same length as x
The default ibm_n()
method returns a non-null element 'n' from the
mapper object, and gives an error if it doesn't exist. If inla_f=TRUE
,
first checks for a 'n_inla' element.
The default ibm_values()
method returns a non-null element
'values' from the mapper object, and seq_len(ibm_n(mapper))
if
it doesn't exist.
The default ibm_amatrix()
gives an error message.
Mapper classes must implement their own ibm_amatrix
method.
The default ibm_valid_input()
method returns an all-TRUE logical vector.
ibm_amatrix
for bru_mapper_multi
accepts a list with
named entries, or a list with unnamed but ordered elements.
The names must match the sub-mappers, see names.bru_mapper_multi()
.
Each list element should take a format accepted by the corresponding
sub-mapper. In case each element is a vector, the input can be given as a
data.frame with named columns, a matrix with named columns, or a matrix
with unnamed but ordered columns.
ibm_valid_input
for bru_mapper_multi
accepts a list with
named entries, or a list with unnamed but ordered elements.
The names must match the sub-mappers, see names.bru_mapper_multi()
.
Each list element should take a format accepted by the corresponding
sub-mapper. In case each element is a vector, the input can be given as a
data.frame with named columns, a matrix with named columns, or a matrix
with unnamed but ordered columns.
ibm_amatrix
for bru_mapper_collect
accepts a list with
named entries, or a list with unnamed but ordered elements.
The names must match the sub-mappers, see names.bru_mapper_collect()
.
Each list element should take a format accepted by the corresponding
sub-mapper. In case each element is a vector, the input can be given as a
data.frame with named columns, a matrix with named columns, or a matrix
with unnamed but ordered columns. When inla_f=TRUE
and hidden=TRUE
in
the mapper definition, the input format should instead match that of
the first, non-hidden, sub-mapper.
ibm_valid_input
for bru_mapper_collect
accepts a list with
named entries, or a list with unnamed but ordered elements.
The names must match the sub-mappers, see names.bru_mapper_collect()
.
Each list element should take a format accepted by the corresponding
sub-mapper. In case each element is a vector, the input can be given as a
data.frame with named columns, a matrix with named columns, or a matrix
with unnamed but ordered columns.
bru_mapper()