Create a matrix mapper, for a given number of columns
Usage
bru_mapper_matrix(labels)
# S3 method for class 'bru_mapper_matrix'
ibm_n(mapper, ...)
# S3 method for class 'bru_mapper_matrix'
ibm_values(mapper, ...)
# S3 method for class 'bru_mapper_matrix'
ibm_jacobian(mapper, input, state = NULL, inla_f = FALSE, ...)
Arguments
- labels
Column labels for matrix mappings; Can be factor, character, or a single integer specifying the number of columns for integer column indexing.
- mapper
A mapper S3 object, inheriting from
bru_mapper
.- ...
Arguments passed on to other methods
- input
Data input for the mapper.
- state
A vector of latent state values for the mapping, of length
ibm_n(mapper, inla_f = FALSE)
- inla_f
logical; when
TRUE
foribm_n()
andibm_values()
, the result must be compatible with theINLA::f(...)
and correspondingINLA::inla.stack(...)
constructions. Foribm_{eval,jacobian,linear}
, theinput
interpretation may be different. 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 bybru_mapper_collect
.
See also
bru_mapper, bru_mapper_generics
Other mappers:
bru_get_mapper()
,
bru_mapper()
,
bru_mapper.fm_mesh_1d()
,
bru_mapper.fm_mesh_2d()
,
bru_mapper_aggregate()
,
bru_mapper_collect()
,
bru_mapper_const()
,
bru_mapper_factor()
,
bru_mapper_fmesher()
,
bru_mapper_generics
,
bru_mapper_harmonics()
,
bru_mapper_index()
,
bru_mapper_linear()
,
bru_mapper_logsumexp()
,
bru_mapper_marginal()
,
bru_mapper_mesh_B()
,
bru_mapper_multi()
,
bru_mapper_pipe()
,
bru_mapper_repeat()
,
bru_mapper_scale()
,
bru_mapper_shift()
,
bru_mapper_taylor()
Examples
m <- bru_mapper_matrix(labels = c("a", "b"))
ibm_values(m)
#> [1] a b
#> Levels: a b
ibm_eval2(m, input = matrix(1:6, 3, 2), state = 2:3)
#> $offset
#> [1] 14 19 24
#>
#> $jacobian
#> 3 x 2 Matrix of class "dgeMatrix"
#> a b
#> [1,] 1 4
#> [2,] 2 5
#> [3,] 3 6
#>
m <- bru_mapper_matrix(labels = 2L)
ibm_values(m)
#> [1] 1 2
ibm_eval2(m, input = matrix(1:6, 3, 2), state = 2:3)
#> $offset
#> [1] 14 19 24
#>
#> $jacobian
#> 3 x 2 Matrix of class "dgeMatrix"
#> 1 2
#> [1,] 1 4
#> [2,] 2 5
#> [3,] 3 6
#>