xfim / ggmcmc

Graphical tools for analyzing Markov Chain Monte Carlo simulations from Bayesian inference
111 stars 31 forks source link

add ggs_pairs function to make plot matrices #39

Closed mbjoseph closed 9 years ago

mbjoseph commented 9 years ago

Pairs plots are useful for assessing posterior correlation (e.g. rstan::pairs.stanfit). This function uses the GGally::ggpairs function along with the functionality in ggmcmc (especially get_family) to produce flexible pairs plots that can include actual points from posterior simulations, 2d density contours, coloration by chains, and other aesthetic tweaks (some shown in examples). Might be useful as a diagnostic tool - and any suggestions are welcome.

ggs_pairs(ggs(s),
          upper=list(continuous="density", params=c(color="black")),
          lower=list(params=c(alpha=.2, shape=1))) + 
  theme_classic()

image

xfim commented 9 years ago

Thank you very much for your contribution, @mbjoseph .

I have been thinking a lot about it, because it touches one of the principles that I have tried to follow in the development of the package: stay away from depending from many packages, and keep plots as simple as possible to let the user combine them.

But after some days playing with the GGally library, I am convinced that it library can really make a difference in ggmcmc, by facilitating some of the figures. So let's go with it.

In the following days I will try to also implement using different colors for different chains.

xfim commented 9 years ago

Sorry I mentioned the "implementation using different colors for the chains". I still have to learn a lot about GGally, and I saw that in the examples you already provided an example with it. Sorry.