logmeanexp | R Documentation |

`logmeanexp`

computes

`\log\frac{1}{N}\sum_{n=1}^N\!e^x_i,`

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

```
logmeanexp(x, se = FALSE, ess = FALSE)
```

`x` |
numeric |

`se` |
logical; give approximate standard error? |

`ess` |
logical; give effective sample size? |

When `se = TRUE`

, `logmeanexp`

uses a jackknife estimate of the
variance in `log(x)`

.

When `ess = TRUE`

, `logmeanexp`

returns an estimate of the effective sample size.

`log(mean(exp(x)))`

computed so as to avoid over- or underflow.
If `se = TRUE`

, the approximate standard error is returned as well.
If `ess = TRUE`

, the effective sample size is returned also.

Aaron A. King

```
# takes too long for R CMD check
## an estimate of the log likelihood:
ricker() |>
pfilter(Np=1000) |>
logLik() |>
replicate(n=5) -> ll
logmeanexp(ll)
## with standard error:
logmeanexp(ll,se=TRUE)
## with effective sample size
logmeanexp(ll,ess=TRUE)
```

pomp documentation built on Aug. 8, 2023, 1:08 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.