| bru_mapper_generics | R Documentation | 
A bru_mapper sub-class implementation must provide an
ibm_jacobian() 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.
ibm_n(mapper, inla_f = FALSE, ...)
ibm_n_output(mapper, input, state = NULL, inla_f = FALSE, ...)
ibm_values(mapper, inla_f = FALSE, ...)
ibm_is_linear(mapper, ...)
ibm_jacobian(mapper, input, state = NULL, inla_f = FALSE, ...)
ibm_linear(mapper, input, state = NULL, ...)
ibm_simplify(mapper, input = NULL, state = NULL, ...)
ibm_eval(mapper, input, state = NULL, ...)
ibm_eval2(mapper, input, state = NULL, ...)
ibm_names(mapper)
ibm_names(mapper) <- value
ibm_inla_subset(mapper, ...)
ibm_invalid_output(mapper, input, state, ...)
## Default S3 method:
ibm_n(mapper, inla_f = FALSE, ...)
## Default S3 method:
ibm_n_output(mapper, input, state = NULL, inla_f = FALSE, ...)
## Default S3 method:
ibm_values(mapper, inla_f = FALSE, ...)
## Default S3 method:
ibm_is_linear(mapper, ...)
## Default S3 method:
ibm_jacobian(mapper, input, state = NULL, ...)
## Default S3 method:
ibm_linear(mapper, input, state, ...)
## Default S3 method:
ibm_simplify(mapper, input = NULL, state = NULL, ...)
## Default S3 method:
ibm_eval(mapper, input, state = NULL, ..., jacobian = NULL)
## Default S3 method:
ibm_eval2(mapper, input, state, ...)
## Default S3 method:
ibm_names(mapper, ...)
## Default S3 method:
ibm_inla_subset(mapper, ...)
## Default S3 method:
ibm_invalid_output(mapper, input, state, ...)
| mapper | A mapper S3 object, inheriting from  | 
| inla_f | logical; when  | 
| ... | Arguments passed on to other methods | 
| input | Data input for the mapper. | 
| state | A vector of latent state values for the mapping,
of length  | 
| value | a character vector of the same length as the number of sub-mappers in the mapper | 
| jacobian | For  | 
ibm_n(): Implementations must return the size of the latent vector
being mapped to.
ibm_n_output(): Implementations must return an integer denoting the
mapper output length.
The default implementation returns NROW(input).
Mappers such as bm_multi and bm_collect,
that can accept list() inputs require their own methods implementations.
ibm_values(): When inla_f=TRUE, implementations must return a vector that
would be interpretable by an INLA::f(..., values = ...) specification.
The exception is the method for bm_multi, that returns a
multi-column data frame if multi=TRUE.
ibm_is_linear(): Implementations must return TRUE or FALSE.
If TRUE (returned by the default method unless the mapper
contains an is_linear variable), users of the mapper
may assume the mapper is linear.
ibm_jacobian(): Implementations must return a (sparse) matrix of size
ibm_n_output(mapper, input, inla_f)
by ibm_n(mapper, inla_f = FALSE). The inla_f=TRUE argument should
only affect the allowed type of input format.
ibm_linear(): Implementations must return a bm_taylor object
The linearisation information includes offset, jacobian, and state0.
The state information indicates for which state the offset was evaluated,
with NULL meaning all-zero.
The linearised mapper output is defined as
effect(input, state) = offset(input, state0) + jacobian(input, state0) %*% (state - state0)
The default method calls ibm_eval() and ibm_jacobian() to generate
the needed information.
ibm_simplify(): Implementations must return a bru_mapper object.
The default method returns ibm_linear(...) for linear mappers, and the
original mapper for non-linear mappers.
ibm_eval(): Implementations must return a vector of length ibm_n_output(...).
The input contents must
be in a format accepted by ibm_jacobian(...)
for the mapper.
ibm_eval2(): Implementations must return a list with elements offset and jacobian.
The input contents must
be in a format accepted by ibm_jacobian(...)
for the mapper.
ibm_names(): Implementations must return a character vector of sub-mapper names, or
NULL. Intended for providing information about multi-mappers and mapper
collections.
ibm_names(mapper) <- value: Set mapper names.
ibm_inla_subset(): Implementations must return a logical vector of TRUE/FALSE for
the subset such that, given the full A matrix and values output,
A[, subset, drop = FALSE] and values[subset]
(or values[subset, , drop = FALSE] for data.frame values) are equal
to the inla_f = TRUE version of A and values. The default method uses
the ibm_values output to construct the subset indexing.
ibm_invalid_output(): Implementations should return a logical vector of length
ibm_n_output(mapper, input, state, ...) indicating which, if any,
output elements of ibm_eval(mapper, input, state, ...) are known to be
invalid.
For for multi/collect mappers, a list, when given a multi=TRUE argument.
ibm_n(default): 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.
ibm_n_output(default): Returns NROW(input)
ibm_values(default): Returns a non-null element
'values' from the mapper object, and seq_len(ibm_n(mapper)) if
it doesn't exist.
ibm_is_linear(default): Returns logical
is_linear from the mapper object if it exists, and otherwise TRUE.
ibm_jacobian(default): Mapper classes must implement their own ibm_jacobian method.
ibm_linear(default): Calls ibm_eval() and ibm_jacobian()
and returns a bm_taylor object.
The state0 information in the affine mapper indicates for which state
the offset was evaluated; The affine mapper output is defined as
effect(input, state) = offset(input, state0) + jacobian(input, state0) %*% (state - state0)
ibm_simplify(default): Calls ibm_linear() for linear mappers, and returns the original mapper
for non-linear mappers.
ibm_eval(default): Verifies that the mapper is linear
with ibm_is_linear(), and then computes a linear mapping
as ibm_jacobian(...) %*% state.  When state is NULL,
a zero vector of length ibm_n_output(...) is returned.
ibm_eval2(default): Calls jacobian <- ibm_jacobian(...) and
offset <- ibm_eval(..., jacobian = jacobian)
and returns a list with elements offset and jacobian, as needed by
ibm_linear.default() and similar methods. Mapper classes can implement
their own ibm_eval2 method if joint construction of evaluation and Jacobian
is more efficient than separate or sequential construction.
ibm_names(default): Returns NULL
ibm_inla_subset(default): Uses
the ibm_values output to construct the inla subset indexing, passing
extra arguments such as multi on to the methods (this means it supports
both regular vector values and multi=1 data.frame values).
ibm_invalid_output(default): Returns an all-FALSE logical vector.
bru_mapper for constructor methods, and bru_get_mapper for hooks to extract mappers from latent model object class objects.
bru_mapper, bru_get_mapper()
Other mappers: 
bm_aggregate(),
bm_collect(),
bm_const(),
bm_factor(),
bm_fmesher(),
bm_harmonics(),
bm_index(),
bm_linear(),
bm_logsumexp(),
bm_marginal(),
bm_matrix(),
bm_mesh_B(),
bm_multi(),
bm_pipe(),
bm_repeat(),
bm_scale(),
bm_shift(),
bm_sum(),
bm_taylor(),
bru_get_mapper(),
bru_mapper(),
bru_mapper.fm_mesh_1d(),
bru_mapper.fm_mesh_2d()
# ibm_names
mapper <- bm_multi(list(A = bm_index(2), B = bm_index(2)))
ibm_names(mapper)
ibm_names(mapper) <- c("new", "names")
ibm_names(mapper)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.