Specific ibm_eval method implementations
Source: R/mappers.R, R/mapper_collect.R, R/mapper_expr.R, and 2 more
ibm_eval_methods.RdSpecific ibm_eval() method implementations.
Usage
# 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, ...)
# S3 method for class 'bm_scale'
ibm_eval(mapper, input, state = NULL, ...)
# S3 method for class 'bm_aggregate'
ibm_eval(mapper, input, state = NULL, ...)
# S3 method for class 'bm_logsumexp'
ibm_eval(mapper, input, state = NULL, log = TRUE, ...)
# S3 method for class 'bm_logitaverage'
ibm_eval(mapper, input, state = NULL, logit = TRUE, ...)
# 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_reparam'
ibm_eval(mapper, input, state = NULL, ..., jacobian = NULL)
# S3 method for class 'bm_collect'
ibm_eval(
mapper,
input,
state,
inla_f = FALSE,
multi = FALSE,
...,
sub_lin = NULL
)
# S3 method for class 'bm_expr'
ibm_eval(
mapper,
input,
state = NULL,
...,
derived = NULL,
data = NULL,
data_mask = NULL,
.envir = rlang::caller_env()
)
# 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
- log
logical; control
logoutput. DefaultTRUE, see theibm_eval()details forlogsumexpmappers.- logit
logical; control
logitoutput. DefaultTRUE, see theibm_eval()details forlogitaveragemappers.- reverse
logical; control
bm_marginalevaluation. DefaultFALSE. WhenTRUE, reverses the direction of the mapping, see details formarginalmappers.- inla_f
logical; 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.- jacobian
For
ibm_eval()methods, an optional pre-computed Jacobian, typically supplied by internal methods that already have the Jacobian.- pre_A
- multi
logical; If
TRUE(or positive), recurse one level into sub-mappers- sub_lin
Internal, optional pre-computed sub-mapper information
- derived
The state vectors of variables derived from the root variables. If
NULLor missing, defaults to an empty list.- data
should be a list with data objects, with the main object called
data; seebm_expr()for details.- data_mask
A 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.- .envir
The environment in which to evaluate the expression. By default, this is set to the caller environment.
Functions
ibm_eval(bm_taylor): Evaluates linearised mapper information at the givenstate. Theinputargument 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, thestateargument must also be a named list. IfstateisNULL, all-zero is assumed.ibm_eval(bm_const): Returns the input values, with NA replaced by 0.ibm_eval(bm_logsumexp): WhenlogisTRUE(default),ibm_eval()forlogsumexpreturns the log-sum-weight-exp value. IfFALSE, thesum-weight-expvalue is returned.ibm_eval(bm_logitaverage): WhenlogitisTRUE(default),ibm_eval()forlogitaveragereturns the logit-sum-weight-inverse-logit value. IfFALSE, thesum-weights=invere-logitvalue is returned.ibm_eval(bm_marginal): Whenxor(mapper[["inverse"]], reverse)isFALSE,ibm_eval()formarginalreturnsqfun(pnorm(x), param), evaluated in a numerically stable way. Otherwise, evaluates the inverseqnorm(pfun(x, param))instead.ibm_eval(bm_expr): Accepts astatelist with named entries, one for each variable. Theinputanddataformats should match the description given forbm_expr().