Constructs a concatenated collection mapping
Usage
bm_collect(mappers, hidden = FALSE)
bru_mapper_collect(...)
# S3 method for class 'bm_collect'
x[i, drop = TRUE]
# S3 method for class 'bru_mapper_collect'
x[i, drop = TRUE]Arguments
- mappers
A list of
bru_mapperobjectslogical, set toTRUEto flag that the mapper is to be used as a first level input mapper forINLA::f()in a model that requires making only the first mapper visible toINLA::f()andINLA::inla.stack(), such as for "bym2" models, as activated by theinla_fargument toibm_n,ibm_values, andibm_jacobian. Set toFALSEto always access the full mapper, e.g. forrgenericmodels- ...
Arguments passed on to
bm_scale()- x
object from which to extract element(s)
- i
indices specifying element(s) to extract
- drop
logical; For
[.bm_collect, whether to extract an individual mapper wheniidentifies a single element. IfFALSE, a list of sub-mappers is returned (suitable e.g. for creating a newbm_collectobject). Default:TRUE
Value
[-indexing abm_collectextracts a subsetbm_collectobject (for dropFALSE) or an individual sub-mapper (for dropTRUE, andiidentifies a single element)
See also
bru_mapper, bru_mapper_generics
Other mappers:
bm_aggregate(),
bm_const(),
bm_factor(),
bm_fm_mesh_1d,
bm_fmesher(),
bm_harmonics(),
bm_index(),
bm_linear(),
bm_logitaverage(),
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()
Other specific bm_collect method implementations:
ibm_eval(),
ibm_invalid_output(),
ibm_is_linear(),
ibm_jacobian(),
ibm_linear(),
ibm_n(),
ibm_n_output(),
ibm_names(),
ibm_values()
Other specific bm_collect method implementations:
ibm_eval(),
ibm_invalid_output(),
ibm_is_linear(),
ibm_jacobian(),
ibm_linear(),
ibm_n(),
ibm_n_output(),
ibm_names(),
ibm_values()
Examples
(m <- bm_collect(list(
a = bm_index(2),
b = bm_index(3)
), hidden = FALSE))
#> collect(a = index, b = index)
ibm_eval2(m, list(a = c(1, 2), b = c(1, 3, 2)), 1:5)
#> $offset
#> [1] 1 2 3 5 4
#>
#> $jacobian
#> 5 x 5 sparse Matrix of class "dgTMatrix"
#>
#> [1,] 1 . . . .
#> [2,] . 1 . . .
#> [3,] . . 1 . .
#> [4,] . . . . 1
#> [5,] . . . 1 .
#>