log_sum_exp: Compute stable Log-Sum-Exp

Description Usage Arguments Value References Examples

View source: R/utils.R

Description

log_sum_exp computes the log sum exp trick for avoiding numeric underflow and have numeric stability in computations of small numbers.

Usage

1

Arguments

x

A vector of observations

Value

The logs-sum-exp value

References

https://hips.seas.harvard.edu/blog/2013/01/09/computing-log-sum-exp/

Examples

1
2
x <- c(0.001, 0.5, 2, 1.4, 1.5)
out <- log_sum_exp(x)

andreaskapou/mpgex documentation built on Nov. 25, 2017, 8:08 a.m.