Releases: stan-dev/bayesplot
bayesplot v1.7.0
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
parsargument of all MCMC plotting functions now supports tidy variable
selection. Seehelp("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.arraymethod as
input (e.g., stanfit objects). (#175, #184) -
mcmc_trace()gains an argumentiter1which can be used to label the traceplot starting
from the first iteration after warmup. (#14, #155, @mcol) -
mcmc_areas()gains an argumentarea_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.
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()andmcmc_areas()raise a warning ifprob_outeris ever
less thanprob. 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()andppc_bars_grouped()now allow negative integers as input. (#172, @jeffpollock9)
bayesplot v1.6.0
bayesplot v1.6.0 is now on CRAN.
See release notes below or 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=FALSE will be much faster and you can always access
# the vignettes at mc-stan.org/bayesplot/articles/
devtools::install_github("stan-dev/bayesplot", ref = "v1.6.0", build_vignettes = TRUE) Release notes
(GitHub issue/PR numbers in parentheses)
-
Loading bayesplot no longer overrides the ggplot theme! Rather, it sets a theme
specific for bayesplot. Some packages using bayesplot may still override the
default ggplot theme (e.g., rstanarm does but only until next release),
but simply loading bayesplot itself will not. There are new functions for controlling
the ggplot theme for bayesplot that work like their ggplot2 counterparts but
only affect plots made using bayesplot. Thanks to Malcolm Barrett. (#117, #149).bayesplot_theme_set()bayesplot_theme_get()bayesplot_theme_update()bayesplot_theme_replace()
-
The Visual MCMC Diagnostics vignette
has been reorganized and has a lot of useful new content thanks to Martin Modrák. (#144, #153) -
The LOO predictive checks
now require loo version>= 2.0.0. (#139) -
Histogram plots gain a
breaksargument that can be used as an alternative tobinwidth. (#148) -
mcmc_pairs()
now has an argumentgrid_argsto provide a way of passing optional arguments to
gridExtra::arrangeGrob(). This can be used to add a title to the plot, for example. (#143) -
ppc_ecdf_overlay()
gains an argumentdiscrete, which isFALSEby default, but can be used to make the
Geom more appropriate for discrete data. (#145) -
PPC intervals plots
and LOO predictive checks
now draw both an outer and an inner probability interval, which can be
controlled through the new argumentprob_outerand the already existing
prob. This is consistent with what is produced bymcmc_intervals().
(#152, #154, @mcol)
bayesplot v1.5.0
bayesplot v1.5.0 is now on CRAN.
See release notes below or 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=FALSE will be much faster and you can always access
# the vignettes at mc-stan.org/bayesplot/articles/
devtools::install_github("stan-dev/bayesplot", ref = "v1.5.0", build_vignettes = TRUE) Release notes
(GitHub issue/PR numbers in parentheses)
-
New package documentation website: http://mc-stan.org/bayesplot/
-
Two new plots that visualize posterior density using ridgelines (ggridges pkg). These work well when parameters have similar values and similar densities, as in hierarchical models. (#104)
mcmc_dens_chains()draws the kernel density of each sampling chain.mcmc_areas_ridges()draws the kernel density combined across chains.- Both functions have a corresponding
_data()function to return the data plotted by
each function.
-
mcmc_intervals()andmcmc_areas()have been rewritten. (#103)- They now use a discrete y-axis. Previously, they used a continuous
scale with numeric breaks relabelled with parameter names; this design
caused some unexpected behavior when customizing these plots. mcmc_areas()now uses geoms from the ggridges package to draw density
curves.
- They now use a discrete y-axis. Previously, they used a continuous
-
Added
mcmc_intervals_data()andmcmc_areas_data()that return data
plotted bymcmc_intervals()andmcmc_areas(). Similarly,ppc_data()
returns data plottedppc_hist()and other ppc plot. (Advances #97) -
Added
ppc_loo_pit_overlay()function for a better LOO PIT predictive check.
(#123) -
Started using vdiffr to add visual unit tests to the existing PPC unit tests. (#137)
bayesplot v1.4.0
bayesplot v1.4.0 is now on CRAN.
Until CRAN binaries are built (usually a few days) you can install the update using
install.packages("bayesplot", type = "source", repos = "https://cran.rstudio.com/")or by installing from GitHub using
devtools::install_github("stan-dev/bayesplot", ref = "v1.4.0", build_vignettes = TRUE)Release notes
(GitHub issue/PR numbers in parentheses)
- New plotting function
mcmc_parcoord()for parallel coordinates plots of
MCMC draws (optionally including HMC/NUTS diagnostic information). (#108) mcmc_scattergains annpargument for specifying NUTS parameters, which
allows highlighting divergences in the plot. (#112)- New functions with names ending with suffix
_datadon't make the plots,
they just return the data prepared for plotting (more of these to come in
future releases): ppc_stat_grouped(),ppc_stat_freqpoly_grouped()gain afacet_args
argument for controlling ggplot2 faceting (many of themcmc_functions
already have this).- The
divergencesargument tomcmc_trace()has been deprecated in favor
ofnp(NUTS parameters) to match the other functions that have annp
argument. - Fixed an issue where duplicated rhat values would break
mcmc_rhat()(#105).
bayesplot v1.3.0
Release notes
(GitHub issue/PR numbers in parentheses)
The biggest change is:
bayesplot::theme_defaultis now set as the default ggplot2 plotting theme
when bayesplot is loaded instead of hardcoded for each plot. This makes
changing the default theme usingggplot2::theme_setpossible.
Thanks to @gavinsimpson. (#87)
Some minor changes:
mcmc_histandmcmc_hist_by_chainnow take afreqargument that defaults
toTRUE(behavior is likefreqargument to R'shistfunction).- Using a
tsobject foryin PPC plots no longer results in an error. Thanks
to @helske. (#94) mcmc_intervalsdoesn't use round lineends anymore as they slightly
exaggerate the width of the intervals. Thanks to @tjmahr. (#96)
bayesplot v1.2.0
bayesplot v1.2.0 is now on CRAN and can be installed with install.packages("bayesplot").
There is a lot of new stuff in this release!
Release notes
(GitHub issue/PR numbers in parentheses)
Fixes
- Avoid error in some cases when
divergencesis specified in call to
mcmc_tracebut there are not actually any divergent transitions. - The
merge_chainsargument tomcmc_nuts_energynow defaults toFALSE.
New features in existing functions
- For
mcmc_*functions, transformations are recycled iftransformations
argument is specified as a single function rather than a named list. Thanks to @tklebel. (#64) - For
ppc_violin_groupedthere is now the option of showingyas a violin,
points, or both. Thanks to @silberzwiebel. (#74) color_scheme_getnow has an optional argumentifor selecting only a
subset of the colors.- New color schemes: darkgray, orange, viridis, viridisA, viridisB, viridisC.
The viridis schemes are better than the other schemes for trace plots (the
colors are very distinct from each other).
New functions
mcmc_pairs, which is essentially a ggplot2+grid implementation of rstan's
pairs.stanfitmethod. (#67)mcmc_hex, which is similar tomcmc_scatterbut usinggeom_hexinstead of
geom_point. This can be used to avoid overplotting. (#67)overlay_functionconvenience function. Example usage: add a Gaussian (or any
distribution) density curve to a plot made withmcmc_hist.mcmc_recover_scatterandmcmc_recover_hist, which are similar tomcmc_recover_intervalsand compare estimates to "true" values used to simulate data. (#81, #83)- New PPC category Discrete with functions:
ppc_rootogramfor use with models for count data. Thanks to @paul-buerkner. (#28)ppc_bars,ppc_bars_groupedfor use with models for ordinal, categorical
and multinomial data. Thanks to @silberzwiebel. (#73)
- New PPC category LOO (thanks to suggestions from @avehtari) with functions:
bayesplot v1.1.0
bayesplot v1.1.0 is now on CRAN and can be installed using install.packages("bayesplot").
Release notes
(GitHub issue/PR numbers in parentheses)
Fixes
- Images in vignettes should now render properly using
pngdevice. Thanks to
TJ Mahr. (#51) xaxis_title(FALSE)andyaxis_title(FALSE)now set axis titles toNULL
rather than changing theme elements toelement_blank(). This makes it easier
to add axis titles to plots that don’t have them by default. Thanks to Bill
Harris. (#53)
New Features
- Introduce
ppc_error_hist_groupedfor plotting predictive errors
by level of a grouping variable. (#40) - Introduce
mcmc_recover_intervalsfor comparing MCMC estimates to "true"
parameter values used to simulate the data. (#56) - Add argument
divergencestomcmc_tracefunction. For models fit using
HMC/NUTS this can be used to display divergences as a rug at the bottom of the
trace plot. (#42) - Introduce
bayesplot_gridfunction for juxtaposing plots and enforcing shared
axis limits. (#59) - The
statargument for allppc_stat_*functions now accepts a function
instead of only the name of a function. (#31)
Initial CRAN release
Update README.md [ci skip]
Beta Release
To install this beta release of the bayespot package you will also need the preview version of the
upcoming ggplot2 update (not the CRAN version):
if (!require("devtools"))
install.packages("devtools")
devtools::install_github("hadley/ggplot2")
devtools::install_github("stan-dev/bayesplot", build_vignettes = TRUE)