R/logmeanexp.R

logmeanexp <- function (x, se = FALSE) {
  mx <- max(x)
  mean <- mx+log(mean(exp(x-mx)))
  if (se) {
    se <- sd(exp(x-mx))/exp(mean-mx)
    c(mean,se=se)
  } else {
    mean
  }
}

Try the pomp package in your browser

Any scripts or data that you put into this service are public.

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