Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rstan/rstan/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Imports:
loo (>= 2.4.1),
pkgbuild (>= 1.2.0),
QuickJSR,
ggplot2 (>= 3.3.5)
ggplot2 (>= 3.3.5),
posterior (>= 1.6.1)
Depends:
R (>= 3.4.0),
StanHeaders (>= 2.36.0)
Expand Down
6 changes: 3 additions & 3 deletions rstan/rstan/R/check_hmc_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@ throw_sampler_warnings <- function(object) {
call. = FALSE, noBreaks. = TRUE)

sims <- as.array(object)
rhat <- apply(sims, MARGIN = 3, FUN = Rhat)
rhat <- apply(sims, MARGIN = 3, FUN = posterior::rhat)
if (any(rhat > 1.05, na.rm = TRUE))
warning("The largest R-hat is ", round(max(rhat), digits = 2),
", indicating chains have not mixed.\n",
"Running the chains for more iterations may help. See\n",
"https://mc-stan.org/misc/warnings.html#r-hat", call. = FALSE)
bulk_ess <- apply(sims, MARGIN = 3, FUN = ess_bulk)
bulk_ess <- apply(sims, MARGIN = 3, FUN = posterior::ess_bulk)
if (any(bulk_ess < 100 * ncol(sims), na.rm = TRUE))
warning("Bulk Effective Samples Size (ESS) is too low, ",
"indicating posterior means and medians may be unreliable.\n",
"Running the chains for more iterations may help. See\n",
"https://mc-stan.org/misc/warnings.html#bulk-ess", call. = FALSE)
tail_ess <- apply(sims, MARGIN = 3, FUN = ess_tail)
tail_ess <- apply(sims, MARGIN = 3, FUN = posterior::ess_tail)
if (any(tail_ess < 100 * ncol(sims), na.rm = TRUE))
warning("Tail Effective Samples Size (ESS) is too low, indicating ",
"posterior variances and tail quantiles may be unreliable.\n",
Expand Down
Loading