logmeanexp: The log-mean-exp trick

Description Usage Arguments Value Author(s) Examples

Description

logmeanexp computes

log mean exp(x_i),

avoiding over- and under-flow in doing so.

Usage

1
logmeanexp(x, se = FALSE)

Arguments

x

numeric

se

logical; give approximate standard error?

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 kingaa at umich dot edu

Examples

1
2
3
4
5
6
7
  ## generate a bifurcation diagram for the Ricker map
  pompExample(ricker)
  ll <- replicate(n=5,logLik(pfilter(ricker,Np=1000)))
  ## an estimate of the log likelihood:
  logmeanexp(ll)
  ## with standard error:
  logmeanexp(ll,se=TRUE)

Example output

newly created object(s):
 ricker 
[1] -139.4272
                         se 
-139.42722214    0.04643413 

pomp documentation built on May 2, 2019, 4:09 p.m.

Related to logmeanexp in pomp...