% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mappers.R, R/mapper_collect.R,
%   R/mapper_repeat.R, R/mapper_sum.R
\name{ibm_eval}
\alias{ibm_eval}
\alias{ibm_eval.default}
\alias{ibm_eval.bm_taylor}
\alias{ibm_eval.bm_const}
\alias{ibm_eval.bm_shift}
\alias{ibm_eval.bm_scale}
\alias{ibm_eval.bm_aggregate}
\alias{ibm_eval.bm_logsumexp}
\alias{ibm_eval.bm_logitaverage}
\alias{ibm_eval.bm_marginal}
\alias{ibm_eval.bm_pipe}
\alias{ibm_eval.bm_multi}
\alias{ibm_eval.bm_reparam}
\alias{ibm_eval.bm_collect}
\alias{ibm_eval.bm_repeat}
\alias{ibm_eval.bm_sum}
\title{Evaluate a mapping}
\usage{
ibm_eval(mapper, input, state = NULL, ...)

\method{ibm_eval}{default}(mapper, input, state = NULL, ..., jacobian = NULL)

\method{ibm_eval}{bm_taylor}(mapper, input = NULL, state = NULL, ...)

\method{ibm_eval}{bm_const}(mapper, input, state = NULL, ...)

\method{ibm_eval}{bm_shift}(mapper, input, state = NULL, ...)

\method{ibm_eval}{bm_scale}(mapper, input, state = NULL, ...)

\method{ibm_eval}{bm_aggregate}(mapper, input, state = NULL, ...)

\method{ibm_eval}{bm_logsumexp}(mapper, input, state = NULL, log = TRUE, ...)

\method{ibm_eval}{bm_logitaverage}(mapper, input, state = NULL, logit = TRUE, ...)

\method{ibm_eval}{bm_marginal}(mapper, input, state = NULL, ..., reverse = FALSE)

\method{ibm_eval}{bm_pipe}(mapper, input, state = NULL, ...)

\method{ibm_eval}{bm_multi}(
  mapper,
  input,
  state = NULL,
  inla_f = FALSE,
  ...,
  jacobian = NULL,
  pre_A = deprecated()
)

\method{ibm_eval}{bm_reparam}(mapper, input, state = NULL, ..., jacobian = NULL)

\method{ibm_eval}{bm_collect}(
  mapper,
  input,
  state,
  inla_f = FALSE,
  multi = FALSE,
  ...,
  sub_lin = NULL
)

\method{ibm_eval}{bm_repeat}(mapper, input, state, multi = FALSE, ..., sub_lin = NULL)

\method{ibm_eval}{bm_sum}(mapper, input, state, multi = FALSE, ..., sub_lin = NULL)
}
\arguments{
\item{mapper}{A mapper S3 object, inheriting from \code{bru_mapper}.}

\item{input}{Data input for the mapper.}

\item{state}{A vector of latent state values for the mapping,
of length \code{ibm_n(mapper, inla_f = FALSE)}}

\item{...}{Arguments passed on to other methods}

\item{jacobian}{For \code{ibm_eval()} methods, an optional pre-computed Jacobian, typically
supplied by internal methods that already have the Jacobian.}

\item{log}{logical; control \code{log} output. Default \code{TRUE}, see the
\code{ibm_eval()} details for \code{logsumexp} mappers.}

\item{logit}{logical; control \code{logit} output. Default \code{TRUE}, see the
\code{ibm_eval()} details for \code{logitaverage} mappers.}

\item{reverse}{logical; control \code{bm_marginal} evaluation. Default
\code{FALSE}. When \code{TRUE}, reverses the direction of the mapping, see details
for \code{marginal} mappers.}

\item{inla_f}{logical; when \code{TRUE} for \code{ibm_n()} and \code{ibm_values()}, the
result must be compatible with the \code{INLA::f(...)} and corresponding
\code{INLA::inla.stack(...)} constructions.  For \verb{ibm_\{eval,jacobian,linear\}},
the \code{input} 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 by \code{bm_collect}.}

\item{pre_A}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} in favour of \code{jacobian}.}

\item{multi}{logical;
If \code{TRUE} (or positive), recurse one level into sub-mappers}

\item{sub_lin}{Internal, optional pre-computed sub-mapper information}
}
\description{
Implementations must return a vector of length \code{\link[=ibm_n_output]{ibm_n_output()}}.
The \code{input} contents must
be in a format accepted by \code{\link[=ibm_jacobian]{ibm_jacobian()}}
for the mapper.
}
\section{Methods (by class)}{
\itemize{
\item \code{ibm_eval(default)}: Verifies that the mapper is linear
with \code{\link[=ibm_is_linear]{ibm_is_linear()}}, and then computes a linear mapping
as \code{ibm_jacobian(...) \%*\% state}.  When \code{state} is \code{NULL},
a zero vector of length \code{\link[=ibm_n_output]{ibm_n_output()}} is returned.

\item \code{ibm_eval(bm_taylor)}: Evaluates linearised
mapper information at the given \code{state}. The \code{input} argument is ignored,
so that the usual argument order
\code{ibm_eval(mapper, input, state)} syntax can be used, but also
\code{ibm_eval(mapper, state = state)}.  For a mapper with a named jacobian list,
the \code{state} argument must also be a named list.  If \code{state} is \code{NULL},
all-zero is assumed.

\item \code{ibm_eval(bm_const)}: Returns the input values, with NA replaced by 0.

\item \code{ibm_eval(bm_logsumexp)}: When \code{log} is \code{TRUE} (default), \code{ibm_eval()}
for \code{logsumexp} returns the log-sum-weight-exp value. If \code{FALSE}, the
\code{sum-weight-exp} value is returned.

\item \code{ibm_eval(bm_logitaverage)}: When \code{logit} is \code{TRUE} (default), \code{ibm_eval()}
for \code{logitaverage} returns the logit-sum-weight-inverse-logit value.
If \code{FALSE}, the \code{sum-weights=invere-logit} value is returned.

\item \code{ibm_eval(bm_marginal)}: When \code{xor(mapper[["inverse"]], reverse)} is
\code{FALSE}, \code{ibm_eval()}
for \code{marginal} returns \code{qfun(pnorm(x), param)}, evaluated in a numerically
stable way. Otherwise, evaluates the inverse \code{qnorm(pfun(x, param))} instead.

}}
\seealso{
Other mapper methods: 
\code{\link{bru_mapper_generics}},
\code{\link{ibm_eval2}()},
\code{\link{ibm_inla_subset}()},
\code{\link{ibm_invalid_output}()},
\code{\link{ibm_is_linear}()},
\code{\link{ibm_is_rowwise}()},
\code{\link{ibm_jacobian}()},
\code{\link{ibm_linear}()},
\code{\link{ibm_n}()},
\code{\link{ibm_n_output}()},
\code{\link{ibm_names}()},
\code{\link{ibm_simplify}()},
\code{\link{ibm_values}()}
}
\concept{mapper methods}
