% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mappers.R
\name{bm_logitaverage}
\alias{bm_logitaverage}
\title{Mapper for logit-sum-inverse-logit aggregation}
\usage{
bm_logitaverage(n_block = NULL)
}
\arguments{
\item{n_block}{Predetermined number of output blocks. If \code{NULL}, overrides
the maximum block index in the inputs. The priority order is \code{input$n_block},
the mapper definition \code{n_block}, then \code{max(input$block)}.}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
Constructs a mapper that averages elements of \code{plogis(state)}, with optional
non-negative weighting, and then takes the \code{qlogis()}.  Relies on the input
handling methods for \code{bm_aggregate}. To avoid numerical issues, it uses
\code{plogis(x, log.p = TRUE)}, \code{plogis(-x, log.p = TRUE)}, and the equivalent of
two applications of \code{\link[=bm_logsumexp]{bm_logsumexp()}} to evaluate
\eqn{\log(p_k)-\log(1-p_k)}{log(p[k])-log(1-p[k])}, where

\eqn{p_k=\sum_{i\in I_k} w_i / (1+e^{-\eta_i}) / \sum_{i\in I_k} w_i
}{p[k]=sum(w[i] * plogis(eta[i])) / sum(w[i])}
}
\examples{
m <- bm_logitaverage()
ibm_eval2(m, list(block = c(1, 2, 1, 2), weights = 1:4), 11:14)
ibm_eval2(m, list(block = c(1, 2, 1, 2), weights = 1:4, n_block = 3), 11:14)

}
\seealso{
\link{bru_mapper}, \link{bru_mapper_generics}

Other mappers: 
\code{\link{bm_aggregate}()},
\code{\link{bm_collect}()},
\code{\link{bm_const}()},
\code{\link{bm_factor}()},
\code{\link{bm_fm_mesh_1d}},
\code{\link{bm_fmesher}()},
\code{\link{bm_harmonics}()},
\code{\link{bm_index}()},
\code{\link{bm_linear}()},
\code{\link{bm_logsumexp}()},
\code{\link{bm_marginal}()},
\code{\link{bm_matrix}()},
\code{\link{bm_multi}()},
\code{\link{bm_pipe}()},
\code{\link{bm_reparam}()},
\code{\link{bm_repeat}()},
\code{\link{bm_scale}()},
\code{\link{bm_shift}()},
\code{\link{bm_sum}()},
\code{\link{bm_taylor}()},
\code{\link{bru_get_mapper}()},
\code{\link{bru_mapper}()}
}
\concept{mappers}
