logsum: logsum

View source: R/flashfm.R

logsumR Documentation

logsum

Description

Internal function, logsum (copied from coloc package)

Usage

logsum(x)

Arguments

x

numeric vector

Details

This function calculates the log of the sum of the exponentiated logs taking out the max, i.e. insuring that the sum is not Inf

ie, you want sum(x), but have x already stored in logs. log(sum(exp(x))) might fail, but logsum(x) should work.

Value

max(x) + log(sum(exp(x - max(x))))

Author(s)

Claudia Giambartolomei

Examples

x <- 1:10
log(sum(x))

jennasimit/flashfm documentation built on July 31, 2022, 7:32 p.m.