Skip to contents

[Experimental] Constructs a mapper that averages elements of plogis(state), with optional non-negative weighting, and then takes the qlogis(). Relies on the input handling methods for bm_aggregate. To avoid numerical issues, it uses plogis(x, log.p = TRUE), plogis(-x, log.p = TRUE), and the equivalent of two applications of bm_logsumexp() to evaluate \(\log(p_k)-\log(1-p_k)\), where

\(p_k=\sum_{i\in I_k} w_i / (1+e^{-\eta_i}) / \sum_{i\in I_k} w_i \)

Usage

bm_logitaverage(n_block = NULL)

Arguments

n_block

Predetermined number of output blocks. If NULL, overrides the maximum block index in the inputs. The priority order is input$n_block, the mapper definition n_block, then max(input$block).

See also

Examples

m <- bm_logitaverage()
ibm_eval2(m, list(block = c(1, 2, 1, 2), weights = 1:4), 11:14)
#> $offset
#> [1] 12.04555 12.85907
#> 
#> $jacobian
#> 2 x 4 sparse Matrix of class "dgCMatrix"
#>                                             
#> [1,] 0.7112239 .         0.2887761 .        
#> [2,] .         0.7869824 .         0.2130176
#> 
ibm_eval2(m, list(block = c(1, 2, 1, 2), weights = 1:4, n_block = 3), 11:14)
#> $offset
#> [1] 12.04555 12.85907      NaN
#> 
#> $jacobian
#> 3 x 4 sparse Matrix of class "dgCMatrix"
#>                                             
#> [1,] 0.7112239 .         0.2887761 .        
#> [2,] .         0.7869824 .         0.2130176
#> [3,] .         .         .         .        
#>