View source: R/hb_diagnostics.R
| mcse | R Documentation |
Monte Carlo standard error (MCSE) of the posterior mean or median, using
the rank-normalized bulk/tail ESS from ess.
kind = "mean": MCSE = SD / sqrt(ess_bulk). kind =
"median": MCSE = sqrt(pi/2) * SD / sqrt(ess_tail) (the closed-form
normal asymptotic-efficiency approximation; 2/pi is the asymptotic
relative efficiency of the sample median vs. the mean under normality).
mcse(draws, kind = c("mean", "median"))
draws |
A matrix of posterior draws (rows = iterations, columns = parameters) for a single chain, or a list of such matrices (one per chain, identical dimensions). |
kind |
|
Named numeric vector, one value per parameter (NA when the
underlying ESS or pooled SD is undefined).
set.seed(42)
draws <- matrix(rnorm(2000), ncol = 2,
dimnames = list(NULL, c("a", "b")))
mcse(draws)
mcse(draws, kind = "median")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.