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.
Specific implementations for bm_aggregate,
bm_collect,
bm_const,
bm_expr,
bm_list,
bm_logitaverage,
bm_logsumexp,
bm_marginal,
bm_multi,
bm_pipe,
bm_reparam,
bm_repeat,
bm_scale,
bm_shift,
bm_sum,
bm_taylor,
bru_comp,
bru_comp_list,
bru_model, bru_obs,
bru_obs_list, default.
Usage
ibm_eval(mapper, input, state = NULL, ...)
# Default S3 method
ibm_eval(mapper, input, state = NULL, ..., jacobian = NULL)
# S3 method for class 'bru_obs'
ibm_eval(
mapper,
input,
state,
...,
multi = FALSE,
comp_mappers,
eval_fun = NULL
)
# S3 method for class 'bru_obs_list'
ibm_eval(
mapper,
input,
state,
...,
multi = FALSE,
comp_mappers,
eval_fun = 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
ibm_eval_methodsloglogical; control
logoutput. DefaultTRUE, see theibm_eval()details forlogsumexpmappers.logitlogical; control
logitoutput. DefaultTRUE, see theibm_eval()details forlogitaveragemappers.reverselogical; control
bm_marginalevaluation. DefaultFALSE. WhenTRUE, reverses the direction of the mapping, see details formarginalmappers.pre_Asub_linInternal, optional pre-computed sub-mapper information
data_maskA data mask object to use for evaluating the expression. If
NULLor missing, a data mask will be constructed withbru_data_mask()from thedata,state,derived, and.envirarguments. This can be used to avoid redundant construction of the data mask when evaluating different expressions multiple times with the same input and state..envirThe environment in which to evaluate the expression. By default, this is set to the caller environment.
derivedThe state vectors of variables derived from the root variables. If
NULLor missing, defaults to an empty list.inla_flogical; when
TRUEforibm_n()andibm_values(), the result must be compatible with theINLA::f(...)and correspondingINLA::inla.stack(...)constructions. Foribm_{eval,jacobian,linear}, theinputinterpretation 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.datashould be a list with data objects, with the main object called
data; seebm_expr()for details.
- jacobian
For
ibm_eval()methods, an optional pre-computed Jacobian, typically supplied by internal methods that already have the Jacobian.- multi
logical; If
TRUE(or positive), recurse one level into sub-mappers- comp_mappers
A list of mappers, typically from
as_bm_list<bru_comp_list>.- eval_fun
A list of functions, typically from
bru_eval_fun().
Methods (by class)
ibm_eval(default): Verifies that the mapper is linear withibm_is_linear(), and then computes a linear mapping asibm_jacobian(...) %*% state. WhenstateisNULL, a zero vector of lengthibm_n_output()is returned.