Description Usage Arguments Details Author(s)
calculates the log(sum(exp(x))) in numerically safer way
1 | twLogSumExp(x, shiftUpperBound = FALSE, shiftLowerBound = FALSE)
|
x |
vector to be summed |
shiftUpperBound |
use this if x has a clear upper bound |
shiftLowerBound |
use this if x has a clear lower bound |
Before taking the exponent, all x are shifted towards zero. By default the median of x is subtracted. If shiftUpperBound then max(x) is subtracted. This is useful if the distribution of x has a strong left tail but a defined upper bound. If shiftLowerBound then min(x) is subtracted. This is useful if the distribution of x has a strong right tail but a defined lower bound.
Thomas Wutzler
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.