Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
refactor mcmc_intervals() and mcmc_areas() #115
Advances #97 (add
These plots now use a discrete y-axis. Previously, we used a continuous y-axis, but relabeled the integer labels with parameter names. This caused some unexpected behavior.
We also use ggridges to draw the density curves in order to keep a discrete y-axis. One possibly unexpected implementation detail is that the point estimate in mcmc_areas() is no longer a vertical line segment, but a very narrow interval drawn by ggridges as well.
The main visual differences are:
Previously, a flat, thin density curve would be stretched vertically and look like a wall.
Now it looks more like a flat density curve and the spikes in the other parameters look like spikes.
(Of course, neither of these plots is any good, because of the variables being plotted.)
These are the plots in the examples.
@@ Coverage Diff @@ ## master #115 +/- ## ========================================= - Coverage 99.6% 99.51% -0.1% ========================================= Files 30 30 Lines 3816 3881 +65 ========================================= + Hits 3801 3862 +61 - Misses 15 19 +4
I haven't had a chance to go through the code thoroughly yet, but at first glance this all looks great! There seems to be a segfault with Travis on R-devel but that was happening before this PR, so we'll deal with that separately. My hunch is that it's related to RStan but I haven't looked into it yet. Anyway, I'll take a more thorough look at the PR later today or tomorrow and either suggest some changes or merge it.…
On Tue, Sep 19, 2017 at 10:11 PM Codecov ***@***.***> wrote: Codecov <https://codecov.io/gh/stan-dev/bayesplot/pull/115?src=pr&el=h1> Report Merging #115 <https://codecov.io/gh/stan-dev/bayesplot/pull/115?src=pr&el=desc> into master <https://codecov.io/gh/stan-dev/bayesplot/commit/492e91fe2227cc63666c4ef1e457027c2e9a0202?src=pr&el=desc> will *decrease* coverage by 0.43%. The diff coverage is 98.58%. [image: Impacted file tree graph] <https://codecov.io/gh/stan-dev/bayesplot/pull/115?src=pr&el=tree> @@ Coverage Diff @@## master #115 +/- ## ==========================================- Coverage 99.6% 99.17% -0.44% ========================================== Files 30 30 Lines 3816 3878 +62 ==========================================+ Hits 3801 3846 +45 - Misses 15 32 +17 Impacted Files <https://codecov.io/gh/stan-dev/bayesplot/pull/115?src=pr&el=tree> Coverage Δ R/mcmc-diagnostics.R <https://codecov.io/gh/stan-dev/bayesplot/pull/115?src=pr&el=tree#diff-Ui9tY21jLWRpYWdub3N0aWNzLlI=> 99% <100%> (+0.02%)
library(ggplot2) library(ggridges) devtools::load_all(".") chains <- example_mcmc_draws() %>% prepare_mcmc_array() %>% melt_mcmc() %>% compute_column_density(c(Parameter, Chain), Value) %>% dplyr::filter(Parameter != "alpha", Parameter != "sigma") ggplot(chains) + aes(x = x, y = Parameter) + geom_density_ridges(aes(height = density, color = factor(Chain)), stat = "identity", fill = NA)