View source: R/plot_diagnostics.R
| n_divergent | R Documentation |
Counts divergent transitions recorded by an HMC/NUTS fit, reading whichever
field the backend populated (the top-level $divergent flag vector every
sampler in this package writes, or $diagnostics$divergent,
$diagnostics$divergent_idx, $diagnostics$n_divergent, $n_divergent).
It reads the same record plot_divergences() locates the divergent rows
from, so the two always agree on one fit.
n_divergent(fit)
fit |
A |
Integer count of divergent transitions (0 if none are recorded).
plot_divergences(), check_diagnostics()
set.seed(1)
d <- data.frame(x = rnorm(60))
d$y <- rpois(60, exp(0.5 + 0.3 * d$x))
fit <- tulpa(y ~ x, data = d, family = "poisson", mode = "hmc",
control = list(n_iter = 400L, warmup = 200L, n_chains = 2L,
seed = 1L))
n_divergent(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.