Learn R Programming

mvc (version 1.3)

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

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

logsum(logx)

Arguments

logx
a vector of log numbers (need not be probabilities)

Value

Examples

Run this code
x=c(1,2,3)
exp(logsum(log(x)))
# 6
}

Run the code above in your browser using DataLab