log_sum_exp: Rethinking utility functions

View source: R/distributions.r

log_sum_expR Documentation

Rethinking utility functions

Description

Numerically stable computation of log sums of exponentiated values.

Usage

log_sum_exp( x )

Arguments

x

vector of values

Details

This function is used by WAIC to compute the log average probability used in the formula for WAIC. In that context, a vector of log-probabilities is passed to log_sum_exp, obviating the need to explicitly exponentiate. This helps to avoid rounding errors that occur when working with direct probabilities.

Author(s)

Richard McElreath


rmcelreath/rethinking documentation built on Aug. 26, 2024, 5:54 p.m.