Skip to content

bayesplot v1.7.0

Compare
Choose a tag to compare
@jgabry jgabry released this 23 May 15:36

bayesplot v1.7.0 is now on CRAN. There are a bunch of new features and fixes in this release. Release notes are available below and also at mc-stan.org/bayesplot/news.

Installation

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) 

Release notes

  • The pars argument of all MCMC plotting functions now supports tidy variable
    selection. See help("tidy-params", package="bayesplot") for details and
    examples. (#161, #183, #188)

  • Two new 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
    histogram (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.

  • Added mcmc_trace_data(), which returns the data used for plotting the trace
    plots and rank histograms. (Advances #97)

  • ColorBrewer palettes are now available as color schemes via color_scheme_set().
    For example, color_scheme_set("brewer-Spectral") will use the Spectral
    palette. (#177, #190)

  • MCMC plots now also accept objects with an as.array method as
    input (e.g., stanfit objects). (#175, #184)

  • mcmc_trace() gains an argument iter1 which can be used to label the traceplot starting
    from the first iteration after warmup. (#14, #155, @mcol)

  • mcmc_areas() gains an argument area_method which 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.
    Alternatively "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 "equal height" using
    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_intervals() and mcmc_areas() raise a warning if prob_outer is ever
    less than 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)

  • Added "viridisD" as an alternative name for "viridis" to the supported colors.

  • Added "viridisE" (the cividis version of viridis) to the supported colors.

  • ppc_bars() and ppc_bars_grouped() now allow negative integers as input. (#172, @jeffpollock9)