## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## -----------------------------------------------------------------------------
set.seed(1)
post_samples <- cbind(rnorm(400), rnorm(400))
lps <- apply(post_samples, 1, function(z) sum(dnorm(z, log = TRUE)))
log_post_fn <- function(theta) sum(dnorm(theta, log = TRUE))

fit <- ECMLE::ecmle(
  post_samples = post_samples,
  lps = lps,
  log_post_fn = log_post_fn,
  hpd_level = 0.75,
  seed = 123
)

fit
summary(fit)

