-
-
Notifications
You must be signed in to change notification settings - Fork 86
Rank histogram #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rank histogram #179
Conversation
Thanks for working on this TJ! |
I've added I also added library(bayesplot)
#> This is bayesplot version 1.6.0.9000
#> - Online documentation and vignettes at mc-stan.org/bayesplot
#> - bayesplot theme set to bayesplot::theme_default()
#> * Does _not_ affect other ggplot2 plots
#> * See ?bayesplot_theme_set for details on theme setting
x <- example_mcmc_draws(params = 4)
bayesplot::color_scheme_set("viridisE")
mcmc_rank_overlay(x, "alpha") Created on 2019-04-05 by the reprex package (v0.2.1) |
Nice! Let me know if/when this is ready for review. |
I should add a horizontal line at uniform height... https://arviz-devs.github.io/arviz/generated/arviz.plot_rank.html |
Do I read the pull request correctly that it doesn't yet have a function which would plot the rank histograms in different subplots? (I don't like the overlaid histograms as they get easily messy). |
I've added library(bayesplot)
#> Registered S3 methods overwritten by 'ggplot2':
#> method from
#> [.quosures rlang
#> c.quosures rlang
#> print.quosures rlang
#> This is bayesplot version 1.6.0.9000
#> - Online documentation and vignettes at mc-stan.org/bayesplot
#> - bayesplot theme set to bayesplot::theme_default()
#> * Does _not_ affect other ggplot2 plots
#> * See ?bayesplot_theme_set for details on theme setting
x <- example_mcmc_draws()
color_scheme_set("viridisE")
mcmc_rank_hist(x, c("beta[1]")) mcmc_rank_hist(x, c("alpha", "beta[1]")) Created on 2019-05-10 by the reprex package (v0.2.1) |
Codecov Report
@@ Coverage Diff @@
## master #179 +/- ##
=========================================
Coverage ? 99.33%
=========================================
Files ? 30
Lines ? 4209
Branches ? 0
=========================================
Hits ? 4181
Misses ? 28
Partials ? 0
Continue to review full report at Codecov.
|
Great! I would remove y axis |
Merge branch 'master' into rank-histogram # Conflicts: # R/mcmc-traces.R # man/MCMC-traces.Rd
I have removed the y-axis and created an option to show a reference line. library(bayesplot)
#> This is bayesplot version 1.6.0.9000
#> - Online documentation and vignettes at mc-stan.org/bayesplot
#> - bayesplot theme set to bayesplot::theme_default()
#> * Does _not_ affect other ggplot2 plots
#> * See ?bayesplot_theme_set for details on theme setting
x <- example_mcmc_draws()
color_scheme_set("viridisE")
mcmc_rank_hist(x, c("beta[1]")) mcmc_rank_hist(x, c("beta[1]"), ref_line = TRUE) mcmc_rank_hist(x, c("alpha", "beta[1]"), n_bins = 10) mcmc_rank_hist(x, c("alpha", "beta[1]"), ref_line = TRUE) Created on 2019-05-21 by the reprex package (v0.3.0) |
Ready for review. |
@tjmahr this looks great. Quick question: the |
Yes. Good catch. Then be sure to update the call to |
Looks good! |
Actually same goes for the Line 464 in 0eac0c3
I’m ok with either option (keeping it as is or having |
I think we can drop But we never do |
Ok sounds good. I'll take care of it. |
This is a work-in-progress pull request to address #178.
So far I've added mcmc_trace_data() which prepares a dataframe of the values in each chain. While I was at it, I refactored mcmc_trace() to take advantage of this function.
The results mcmc_trace_data() includes a column
value_rank
. With this addition, we can very quickly make histogram of ranks.Here is a prototype of the main steps.
Created on 2019-03-20 by the reprex package (v0.2.1)