logdiff: logdiff

Description Usage Arguments Details Value Author(s) Examples

View source: R/marginalpp.R

Description

Internal function, logdiff

Usage

1
logdiff(x, y)

Arguments

x

numeric

y

numeric

Details

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

ie you want log(exp(x) - exp(y))

Value

max(x) + log(exp(x - max(x,y)) - exp(y-max(x,y)))

Author(s)

Chris Wallace

Examples

1
2
3
4
x <- 1001:1010
y <- 1:10
log(x-y)
MFM:::logdiff(log(x),log(y))

jennasimit/MTFM documentation built on Aug. 15, 2019, 6:14 p.m.