logsum: Computes the cumulative sum in terms of logarithmic in- and...

Description Usage Arguments Value Examples

View source: R/mvc-utils.R

Description

Computes the cumulative sum in terms of logarithmic in- and output Useful to avoid numerical underflow when summing products of probabilities When using this function, one can sum sums of log probabilities See also: http://goo.gl/aJopi

Usage

1
logsum(logx)

Arguments

logx

a vector of log numbers (need not be probabilities)

Value

the log of the sum of the exponentiated input

Examples

1
2
3
4
5
{
x=c(1,2,3)
exp(logsum(log(x)))
# 6
}

mvc documentation built on May 2, 2019, 11:27 a.m.

Related to logsum in mvc...