logmeanexp: The log-mean-exp trick

Description Usage Arguments Details Value Author(s) Examples

Description

logmeanexp computes

log mean exp(x_i),

avoiding over- and under-flow in doing so. It can optionally return an estimate of the standard error in this quantity.

Usage

1
logmeanexp(x, se = FALSE)

Arguments

x

numeric

se

logical; give approximate standard error?

Details

When se = TRUE, logmeanexp uses a jackknife estimate of the variance in log(x).

Value

log(mean(exp(x))) computed so as to avoid over- or underflow. If se = FALSE, the approximate standard error is returned as well.

Author(s)

Aaron A. King

Examples

1
2
3
4
5
## an estimate of the log likelihood:
ll <- replicate(n=5,logLik(pfilter(ricker(),Np=1000)))
logmeanexp(ll)
## with standard error:
logmeanexp(ll,se=TRUE)

kidusasfaw/pomp documentation built on May 20, 2019, 2:59 p.m.