diff --git a/.Rbuildignore b/.Rbuildignore index cfa3e1fb..a444da16 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -13,3 +13,4 @@ images/* book/* docs/* Rplots.pdf +tests/figs/* diff --git a/R/bayesplot-package.R b/R/bayesplot-package.R index ae1696bc..a0697fbd 100644 --- a/R/bayesplot-package.R +++ b/R/bayesplot-package.R @@ -91,3 +91,13 @@ #' } #' NULL + + +# internal ---------------------------------------------------------------- + +# release reminders (for devtools) +release_questions <- function() { # nocov start + c( + "Have you reduced the size of the vignettes for CRAN?", + ) +} # nocov end diff --git a/vignettes/plotting-mcmc-draws.Rmd b/vignettes/plotting-mcmc-draws.Rmd index d3fa7ade..a2fd7901 100644 --- a/vignettes/plotting-mcmc-draws.Rmd +++ b/vignettes/plotting-mcmc-draws.Rmd @@ -166,10 +166,18 @@ transform the draws in advance or use the `transformations` argument. ```{r, mcmc_hist-transform, message=FALSE} color_scheme_set("blue") -mcmc_hist(posterior, pars = c("wt", "sigma"), +mcmc_hist(posterior, pars = c("wt", "sigma"), transformations = list("sigma" = "log")) ``` +<!-- ```{r, mcmc_hist-transform, message=FALSE, eval=FALSE} --> +<!-- # not evaluated to reduce vignette size for CRAN --> +<!-- # full version available at mc-stan.org/bayesplot/articles --> +<!-- color_scheme_set("blue") --> +<!-- mcmc_hist(posterior, pars = c("wt", "sigma"), --> +<!-- transformations = list("sigma" = "log")) --> +<!-- ``` --> + Most of the other functions for plotting MCMC draws also have a `transformations` argument. @@ -267,6 +275,14 @@ mcmc_pairs(posterior, pars = c("(Intercept)", "wt", "sigma"), off_diag_args = list(size = 1.5)) ``` +<!-- ```{r, mcmc_pairs, message=FALSE, eval=FALSE} --> +<!-- # not evaluated to reduce vignette size for CRAN --> +<!-- # full version available at mc-stan.org/bayesplot/articles --> +<!-- color_scheme_set("pink") --> +<!-- mcmc_pairs(posterior, pars = c("(Intercept)", "wt", "sigma"), --> +<!-- off_diag_args = list(size = 1.5)) --> +<!-- ``` --> + The univariate marginal posteriors are shown along the diagonal as histograms, but this can be changed to densities by setting `diag_fun="dens"`. Bivariate plots are displayed above and below the diagonal as scatterplots, but it is also @@ -325,11 +341,18 @@ by side, and `strip.position="left"` moves the facet labels to the y-axis The [`"viridis"` color scheme](https://CRAN.R-project.org/package=viridis) is also useful for trace plots because it is comprised of very distinct colors: -```{r, viridis-scheme} +```{r, viridis-scheme, eval=FALSE} color_scheme_set("viridis") mcmc_trace(posterior, pars = "(Intercept)") ``` +<!-- ```{r, viridis-scheme, eval=FALSE} --> +<!-- # not evaluated to reduce vignette size for CRAN --> +<!-- # full version available at mc-stan.org/bayesplot/articles --> +<!-- color_scheme_set("viridis") --> +<!-- mcmc_trace(posterior, pars = "(Intercept)") --> +<!-- ``` --> + #### mcmc_trace_highlight The `mcmc_trace_highlight` function uses points instead of lines and reduces the diff --git a/vignettes/visual-mcmc-diagnostics.Rmd b/vignettes/visual-mcmc-diagnostics.Rmd index 89eb4742..620a1ac1 100644 --- a/vignettes/visual-mcmc-diagnostics.Rmd +++ b/vignettes/visual-mcmc-diagnostics.Rmd @@ -253,21 +253,27 @@ visualizations. #### mcmc_parcoord -The parallel coordinates plot (`mcmc_parcoord`) is probably the first plot to -have look at if you have no idea, where the divergences in your model might be -coming from. This function works in general without including information about -the divergences, but if the optional `np` argument is used to pass NUTS -parameter information, then divergences will be colored in the plot (by default -in red). +The `mcmc_parcoord` plot shows one line per iteration, connecting the parameter +values at this iteration. This lets you see global patterns in the divergences. + +This function works in general without including information about the +divergences, but if the optional `np` argument is used to pass NUTS parameter +information, then divergences will be colored in the plot (by default in red). ```{r, mcmc_parcoord-1} color_scheme_set("darkgray") mcmc_parcoord(posterior_cp, np = np_cp) ``` -The `mcmc_parcoord` plot shows one line per iteration, connecting the parameter -values at this iteration. This lets you see any global patterns in the -divergences. Here, you may notice that divergences in the centered + +<!-- ```{r, mcmc_parcoord-1, eval=FALSE} --> +<!-- # not evaluated to reduce vignette size for CRAN --> +<!-- # full version available at mc-stan.org/bayesplot/articles --> +<!-- color_scheme_set("darkgray") --> +<!-- mcmc_parcoord(posterior_cp, np = np_cp) --> +<!-- ``` --> + +Here, you may notice that divergences in the centered parameterization happen exclusively when `tau`, the hierarchical standard deviation, goes near zero and the values of the `theta`s are essentially fixed. This makes `tau` immediately suspect. @@ -289,10 +295,17 @@ Let's look at how `tau` interacts with other variables, using only one of the `theta`s to keep the plot readable: ```{r, mcmc_pairs} -mcmc_pairs(posterior_cp, np = np_cp, pars = c("mu","tau","theta[1]"), +mcmc_pairs(posterior_cp, np = np_cp, pars = c("mu","tau","theta[1]"), off_diag_args = list(size = 0.75)) ``` +<!-- ```{r, mcmc_pairs, eval=FALSE} --> +<!-- # not evaluated to reduce vignette size for CRAN --> +<!-- # full version available at mc-stan.org/bayesplot/articles --> +<!-- mcmc_pairs(posterior_cp, np = np_cp, pars = c("mu","tau","theta[1]"), --> +<!-- off_diag_args = list(size = 0.75)) --> +<!-- ``` --> + Note that each bivariate plot is present twice -- by default each of those contain half of the chains, so you also get to see if the chains produced similar results (see the documentation for the `condition` argument for