bm_sum {inlabru} | R Documentation |
Mapper for adding multiple mappers
Description
Defines a mapper that adds the effects of each submapper.
The ibm_n()
method returns the sum of ibm_n(mappers[[k]])
, and
ibm_values()
returns seq_len(ibm_n(mapper))
.
Usage
bm_sum(mappers, single_input = FALSE)
bru_mapper_sum(...)
## S3 method for class 'bm_sum'
ibm_n(mapper, inla_f = FALSE, multi = FALSE, ...)
## S3 method for class 'bm_sum'
ibm_n_output(mapper, input, state = NULL, ...)
## S3 method for class 'bm_sum'
ibm_values(mapper, inla_f = FALSE, multi = FALSE, ...)
## S3 method for class 'bm_sum'
ibm_is_linear(mapper, multi = FALSE, ...)
## S3 method for class 'bm_sum'
ibm_jacobian(
mapper,
input,
state = NULL,
inla_f = FALSE,
multi = FALSE,
...,
sub_lin = NULL
)
## S3 method for class 'bm_sum'
ibm_eval(mapper, input, state, multi = FALSE, ..., sub_lin = NULL)
## S3 method for class 'bm_sum'
ibm_linear(mapper, input, state, ...)
## S3 method for class 'bm_sum'
ibm_invalid_output(mapper, input, state, multi = FALSE, ...)
## S3 method for class 'bm_sum'
x[i, drop = TRUE]
## S3 method for class 'bru_mapper_sum'
x[i, drop = TRUE]
## S3 method for class 'bm_sum'
ibm_names(mapper)
## S3 replacement method for class 'bm_sum'
ibm_names(mapper) <- value
## S3 replacement method for class 'bru_mapper_sum'
ibm_names(mapper) <- value
Arguments
mappers |
A list of |
single_input |
logical. If |
... |
Arguments passed on to other methods |
mapper |
A mapper S3 object, inheriting from |
inla_f |
logical; when |
multi |
logical;
If |
input |
Data input for the mapper. |
state |
A vector of latent state values for the mapping,
of length |
sub_lin |
Internal, optional pre-computed sub-mapper information |
x |
object from which to extract element(s) |
i |
indices specifying element(s) to extract |
drop |
logical;
For |
value |
a character vector of the same length as the number of sub-mappers in the mapper |
Value
A bm_sum
object.
-
[
-indexing abm_sum
extracts a subsetbm_sum
object (for dropFALSE
) or an individual sub-mapper (for dropTRUE
, andi
identifies a single element)
The
names()
method forbm_sum
returns the names from the sub-mappers list
Methods (by generic)
-
ibm_jacobian(bm_sum)
: Accepts a list with named entries, or a list with unnamed but ordered elements. The names must match the sub-mappers, seeibm_names.bm_sum()
. 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_invalid_output(bm_sum)
: Accepts a list with named entries, or a list with unnamed but ordered elements. The names must match the sub-mappers, seeibm_names.bm_sum()
. 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.
See Also
bru_mapper, bru_mapper_generics
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_taylor()
,
bru_get_mapper()
,
bru_mapper()
,
bru_mapper.fm_mesh_1d()
,
bru_mapper.fm_mesh_2d()
,
bru_mapper_generics
Examples
(m <- bm_sum(list(a = bm_index(3), b = bm_index(2))))
ibm_n(m)
ibm_values(m)
ibm_jacobian(m, list(a = 1:3, b = c(1, 1, 2)))
ibm_eval(
m,
list(a = 1:3, b = c(1, 1, 2)),
seq_len(ibm_n(m))
)