Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature request/suggestion - point estimate with interval labels to aid in plotting #223
Comments
|
Thanks for the feature request! We have a function in bayesplot called library(bayesplot)
x <- example_mcmc_draws()
mcmc_intervals_data(x) # has some optional arguments to control interval width
but we don't currently provide any way of creating plot labels from this summary table. We do provide other ggplot2 helper functions (https://mc-stan.org/bayesplot/reference/index.html#section-ggplot-helpers) so there's certainly a precedent for bayesplot incorporating something like this. Alternatively, it could be added as a column in the |
|
One thing that would be nice about having it in the same output as other summary information is that when you wish to make plots, you already have it in the same tibble that you are summarising/visualising. I would at least find that more useful than a separate function, but up to you how/if you would think it best implemented! |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

I've found it very useful to have easy access to a 'label' providing a chosen point estimate and density interval, which can be added for example to graphs as a means of providing extra, concise information about a parameter or effect that is depicted. E.g., adding label with the median and 95% HDI from the posterior, or whatever other point estimate/interval you choose, in the form: 5.67 [4.33 - 6.01].
The following R code takes a posterior distribution in the form of a vector and returns a summary. You can ignore most of the probably very inelegant coding, but the function inside of this function called 'point.uncertainty' could be a useful place to begin if you think this feature may be useful.
This requires dplyr and hdinterval packages to run.