v1.7.0 of the bayesplot R package is now on CRAN! There are a bunch of new features (including ‘tidy’ parameter selection, new plots, new colors) and several fixes in this release. Release notes are copied below but are best viewed at mc-stan.org/bayesplot/news.
After CRAN binaries are built (usually a few days) just use
install.packages("bayesplot"). Before binaries are available the update can be installed from CRAN using
install.packages("bayesplot", type = "source", repos = "https://cran.rstudio.com/")
or from GitHub using
# note: setting build_vignettes=TRUE will be much slower and you can always access # the vignettes online at mc-stan.org/bayesplot/articles/ devtools::install_github("stan-dev/bayesplot", ref = "v1.7.0", build_vignettes = FALSE)
(GitHub issue/PR numbers in parenthesis)
parsargument of all MCMC plotting functions now supports tidy variable selection. See
help("tidy-params", package="bayesplot")or https://mc-stan.org/bayesplot/reference/tidy-params.html for details and examples. (#161, #183, #188)
Two new MCMC diagnostic plots have been added for inspecting the distribution of ranks.
Rank histograms were introduced by the Stan team’s
new paper on MCMC diagnostics. (#178, #179)
mcmc_rank_hist(): A traditional traceplot (
mcmc_trace()) visualizes how
sampled values the MCMC chains mix over the course of sampling. A rank
mcmc_rank_hist()) visualizes how the ranks of values from the
chains mix together. An ideal plot would show the ranks mixing or overlapping
in a uniform distribution.
mcmc_rank_overlay(): Instead of drawing each chain’s histogram in a separate
panel, this plot draws the top edge of the chains’ histograms in a single panel.
mcmc_trace_data(), which returns the data used for plotting the trace plots and rank histograms. (Advances #97)
MCMC plots now also accept objects with an
stanfitobjects). (#175, #184)
mcmc_trace()gains an argument
iter1which can be used to label the traceplot starting
from the first iteration after warmup. (#14, #155, @mcol)
mcmc_areas()gains an argument
area_methodwhich controls how to draw the density
curves. The default
"equal area"constrains the heights so that the curves
have the same area. As a result, a narrow interval will appear as a spike
of density, while a wide, uncertain interval is spread thin over the x axis.
"equal height"will set the maximum height on each curve to
the same value. This works well when the intervals are about the same width.
Otherwise, that wide, uncertain interval will dominate the visual space
compared to a narrow, less uncertain interval. A compromise between the two is
"scaled height"which scales the curves from
height * sqrt(height). (#163, #169)
mcmc_areas()correctly plots density curves where the point estimate
does not include the highest point of the density curve.
(#168, #169, @jtimonen)
mcmc_areas_ridges()draws the vertical line at x = 0 over the curves so
that it is always visible.
mcmc_areas()raise a warning if
prob. It sorts these two values into the correct order. (#138)
MCMC parameter names are now always converted to factors prior to
plotting. We use factors so that the order of parameters in a plot matches
the order of the parameters in the original MCMC data. This change fixes a
case where factor-conversion failed. (#162, #165, @wwiecek)
The examples in
?ppc_loo_pit_overlay()now work as expected. (#166, #167)
"viridisD"as an alternative name for
"viridis"to the supported colors.