Evaluate a mapping
Source:R/mappers.R
, R/mapper_collect.R
, R/mapper_repeat.R
, and 1 more
ibm_eval.Rd
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.
Usage
ibm_eval(mapper, input, state = NULL, ...)
# Default S3 method
ibm_eval(mapper, input, state = NULL, ..., jacobian = NULL)
# S3 method for class 'bm_taylor'
ibm_eval(mapper, input = NULL, state = NULL, ...)
# S3 method for class 'bm_const'
ibm_eval(mapper, input, state = NULL, ...)
# S3 method for class 'bm_shift'
ibm_eval(mapper, input, state = NULL, ..., sub_lin = NULL)
# S3 method for class 'bm_scale'
ibm_eval(mapper, input, state = NULL, ..., sub_lin = NULL)
# S3 method for class 'bm_aggregate'
ibm_eval(mapper, input, state = NULL, ..., sub_lin = NULL)
# S3 method for class 'bm_logsumexp'
ibm_eval(mapper, input, state = NULL, log = TRUE, ..., sub_lin = NULL)
# S3 method for class 'bm_marginal'
ibm_eval(mapper, input, state = NULL, ..., reverse = FALSE)
# S3 method for class 'bm_pipe'
ibm_eval(mapper, input, state = NULL, ...)
# S3 method for class 'bm_multi'
ibm_eval(
mapper,
input,
state = NULL,
inla_f = FALSE,
...,
jacobian = NULL,
pre_A = deprecated()
)
# S3 method for class 'bm_collect'
ibm_eval(
mapper,
input,
state,
inla_f = FALSE,
multi = FALSE,
...,
sub_lin = NULL
)
# S3 method for class 'bm_repeat'
ibm_eval(mapper, input, state, multi = FALSE, ..., sub_lin = NULL)
# S3 method for class 'bm_sum'
ibm_eval(mapper, input, state, multi = FALSE, ..., sub_lin = NULL)
Arguments
- mapper
A mapper S3 object, inheriting from
bru_mapper
.- input
Data input for the mapper.
- state
A vector of latent state values for the mapping, of length
ibm_n(mapper, inla_f = FALSE)
- ...
Arguments passed on to other methods
- jacobian
For
ibm_eval()
methods, an optional pre-computed Jacobian, typically supplied by internal methods that already have the Jacobian.- sub_lin
Internal, optional pre-computed sub-mapper information
- log
logical; control
log
output. DefaultTRUE
, see theibm_eval()
details forlogsumexp
mappers.- reverse
logical; control
bm_marginal
evaluation. DefaultFALSE
. WhenTRUE
, reverses the direction of the mapping, see details formarginal
mappers.- 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 bybm_collect
.- pre_A
- multi
logical; If
TRUE
(or positive), recurse one level into sub-mappers
Methods (by class)
ibm_eval(default)
: Verifies that the mapper is linear withibm_is_linear()
, and then computes a linear mapping asibm_jacobian(...) %*% state
. Whenstate
isNULL
, a zero vector of lengthibm_n_output()
is returned.ibm_eval(bm_taylor)
: Evaluates linearised mapper information at the givenstate
. Theinput
argument is ignored, so that the usual argument orderibm_eval(mapper, input, state)
syntax can be used, but alsoibm_eval(mapper, state = state)
. For a mapper with a named jacobian list, thestate
argument must also be a named list. Ifstate
isNULL
, all-zero is assumed.ibm_eval(bm_const)
: Returns the input values, with NA replaced by 0.ibm_eval(bm_logsumexp)
: Whenlog
isTRUE
(default),ibm_eval()
forlogsumexp
returns the log-sum-weight-exp value. IfFALSE
, thesum-weight-exp
value is returned.ibm_eval(bm_marginal)
: Whenxor(mapper[["inverse"]], reverse)
isFALSE
,ibm_eval()
formarginal
returnsqfun(pnorm(x), param)
, evaluated in a numerically stable way. Otherwise, evaluates the inverseqnorm(pfun(x, param))
instead.
See also
Other mapper methods:
bru_mapper_generics
,
ibm_eval2()
,
ibm_inla_subset()
,
ibm_invalid_output()
,
ibm_is_linear()
,
ibm_jacobian()
,
ibm_linear()
,
ibm_n()
,
ibm_n_output()
,
ibm_names()
,
ibm_simplify()
,
ibm_values()
Other specific bm_taylor method implementations:
bm_taylor()
,
ibm_jacobian()
,
ibm_n()
,
ibm_n_output()
,
ibm_values()
Other specific bm_const method implementations:
bm_const()
,
ibm_jacobian()
,
ibm_n()
,
ibm_values()
Other specific bm_shift method implementations:
bm_shift()
,
ibm_jacobian()
,
ibm_n()
,
ibm_n_output()
,
ibm_values()
Other specific bm_scale method implementations:
bm_scale()
,
ibm_jacobian()
,
ibm_n()
,
ibm_n_output()
,
ibm_values()
Other specific bm_aggregate method implementations:
bm_aggregate()
,
ibm_jacobian()
,
ibm_n()
,
ibm_n_output()
,
ibm_values()
Other specific bm_logsumexp method implementations:
bm_logsumexp()
,
ibm_jacobian()
Other specific bm_marginal method implementations:
bm_marginal()
,
ibm_jacobian()
,
ibm_n()
,
ibm_n_output()
,
ibm_values()
Other specific bm_pipe method implementations:
bm_pipe()
,
ibm_eval2()
,
ibm_jacobian()
,
ibm_n()
,
ibm_n_output()
,
ibm_simplify()
,
ibm_values()
Other specific bm_multi method implementations:
bm_multi()
,
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:
bm_collect()
,
ibm_invalid_output()
,
ibm_is_linear()
,
ibm_jacobian()
,
ibm_linear()
,
ibm_n()
,
ibm_n_output()
,
ibm_names()
,
ibm_values()
Other specific bm_repeat method implementations:
bm_repeat()
,
ibm_invalid_output()
,
ibm_jacobian()
,
ibm_linear()
,
ibm_n()
,
ibm_n_output()
,
ibm_values()
Other specific bm_sum method implementations:
bm_sum()
,
ibm_invalid_output()
,
ibm_is_linear()
,
ibm_jacobian()
,
ibm_linear()
,
ibm_n()
,
ibm_n_output()
,
ibm_names()
,
ibm_values()