ggfan v0.1.0

0

Monthly downloads

0th

Percentile

Summarise a Distribution Through Coloured Intervals

Implements the functionality of the 'fanplot' package as 'geoms' for 'ggplot2'. Designed for summarising MCMC samples from a posterior distribution, where a visualisation is desired for several values of a continuous covariate. Increasing posterior intervals of the sampled quantity are mapped to a continuous colour scale.

Readme

ggfan

Jason Hilton 14 November, 2017

Build Status

Summarise a distribution through coloured intervals

This package is a ggplot-based implementation of some of the functionality of the fanplot package by Guy Abel. Fanplot provides methods to visualise probability distributions by representing intervals of the distribution function with colours. Plotting samples from posterior distributions obtained through MCMC is a particular aim. A ggplot-based implementation is useful as it allows leverage of the power of ggplot2 features allowing, for example, facetting and easy theming.

Installation

The package has recently been submitted to CRAN. Installation directly from CRAN will be possible if and when the package is accepted: install.packages("ggfan") Otherwise, the package can be installed directly from github using the devtools package: devtools::install_github("jasonhilton/ggfan").

Quick Start

The provided fake_df data gives and example of the type of data you might want to plot with ggfan: it consists of 1000 samples of an outcome variable of interest at each value of a covariate x. We can plot this simply using standard ggplot2 syntax and geom_fan. Convenient ggplot features such as themes, colour scales and facetting can also be used.

ggplot(fake_df, aes(x=x, y=y)) + geom_fan() + theme_minimal() + scale_fill_distiller(palette="Spectral")

Further Information

A full description of the functionality of ggfan is provided in the vignette, provided here.

A brief example of using ggfan to plot stan output is given in a second vignette here

Functions in ggfan

Name Description
geom_fan Fan plot visualising intervals of a distribution
gp_model_fit A stan_fit object used in the ggfan_stan vignette, containing posterior samples from a latent gaussian process model. This is provided as data to avoid having to conduct computationally expensive sampling when producing the vignettes.
GeomIntervalPath See ggplot2-ggproto
stat_interval Line plot visualising intervals of a distribution
GeomIntervalPoly See ggplot2-ggproto
stat_sample Plots a randomly chosen sample of the specified groups using geom_line
StatInterval See ggplot2-ggproto
StatIntervalFctr See ggplot2-ggproto
StatSample See ggplot2-ggproto
calc_quantiles Calculate quantiles of a tidy dataframe
geom_interval Line plot visualising intervals of a distribution
ggfan Fanplots for ggplot2
fake_df Fake dataset intended to resemble a set of MCMC samples of a variable over one covariate (perhaps time),
No Results!

Vignettes of ggfan

Name
geom_fan.Rmd
geom_fan.md
ggfan_stan.Rmd
ggfan_stan.md
make_github.R
No Results!

Last month downloads

Details

Type Package
License GPL-2 | file LICENSE
LazyData TRUE
URL https://github.com/jasonhilton/ggfan
BugReports https://github.com/jasonhilton/ggfan/issues
VignetteBuilder knitr
RoxygenNote 6.0.1
NeedsCompilation no
Packaged 2017-11-14 16:55:48 UTC; jdh1d15
Repository CRAN
Date/Publication 2017-11-14 18:15:52 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/ggfan)](http://www.rdocumentation.org/packages/ggfan)