Skip to content

Commit

Permalink
Website created and minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestripp committed May 4, 2020
1 parent 3745b3b commit 05f0c4d
Show file tree
Hide file tree
Showing 59 changed files with 5,277 additions and 27 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: backfillz
Type: Package
Title: MCMC visualisation package
Version: 0.9.9900
Version: 1.0
Authors@R: c(
person('James', 'Tripp', email = 'james.tripp@warwick.ac.uk', role = c('aut', 'cre')),
person('Gregory', 'McInerny', email = 'G.McInerny@warwick.ac.uk', role = 'aut')
Expand All @@ -11,4 +11,4 @@ Description: Visualisation package for creating diagnostic plots for MCMC chains
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NEWS
================

# lecat v1.00 (Release date: 2020-04-04)

Changes:

- Used pkgdown to create site
- Created tutorials
- Plot save and recall added
13 changes: 13 additions & 0 deletions NEWS.rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "NEWS"
output: github_document
---

Backfillz v1.00 (Release date: 2020-04-04)
==============

Changes:

* Used pkgdown to create site
* Created tutorials
* Plot save and recall added
2 changes: 1 addition & 1 deletion R/df_to_stanarray.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Converts a data frame to the output structure of extract(stan_object, permuted = TRUE)
#' Converts a data frame to the output structure of extract
#'
#' @param df data frame with the column names 'parameters', 'iterations' and 'chains'
#' @return An array from df with the dimensions [iteration, chain, parameters]
Expand Down
2 changes: 1 addition & 1 deletion R/plot_slice_histogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ plot_slice_histogram <- function(object = NULL, slices = NULL, save_plot = FALSE
data.frame(
ID = ID,
Date = date(),
Event = 'Slice Historgram',
Event = 'Slice Histogram',
R_version = R.Version()$version.string,
Saved = save_plot,
stringsAsFactors = FALSE
Expand Down
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
![](fig1.png)

[![Build
Status](https://travis-ci.org/warwickCIM/lecat.svg?branch=master)](https://travis-ci.org/WarwickCIM/backfillz)
[![DOI](https://zenodo.org/badge/176701637.svg)](https://zenodo.org/badge/latestdoi/176701637)

<img src="https://github.com/WarwickCIM/backfillz/raw/master/fig1.png" width=100% alt=""/>

# New View of MCMC

Backfillz.R provides new visual diagnostics for understanding MCMC (Markov Chain Monte Carlo) analyses and outputs. MCMC chains can defy a simple line graph. Unless the chain is very short (which isn’t often the case), plotting tens or hundreds of thousands of data points reveals very little other than a ‘trace plot’ where we only see the outermost points. Common plotting methods may only reveal when an MCMC really hasn’t worked, but not when it has.
Expand All @@ -12,48 +14,42 @@ BackFillz.R slices and dices MCMC chains so increasingly parameter rich, complex
```r
install.packages(devtools)
devtools::install_github('warwickCIM/backfillz')
require(backfillz)
library(backfillz)

# convert sample data to backfillz object
x <- as_backfillz(sample_stanfit)

slices <- data.frame(
parameters = c('mu', 'mu', 'eta[1]', 'eta[1]'),
lower = c(0, 0.6, 0.2, 0.7),
upper= c(0.4, 0.9, 0.25, 1),
stringsAsFactors = FALSE
)

# change theme
x <- set_theme(x, 'demo 1')

# plot via generic plot method
x <- plot(x, plotType = 'slice_histogram')

# create prototype plots
x <- plot_slice_histogram(x, slices)
x <- plot_trace_dial(x)
x <- plot_spiral_stream(x)
```

# Current prototype

In this first prototype we have implemented three new MCMC visual diagnostics. More functionality and tutorials to come! The documentation is available through R and the full package will be coming soon.
# Current prototype plots

## Pretzel Plot – plot_trace_dial()

This plot shows the chain and summary histograms in a format that can be easily arranged as a grid. The trace plot is stretched, clearly indicating ‘burn-in’, with density plots showing the burn-in and remainder of the chain in context.

![](fig2.png)
<img src="https://github.com/WarwickCIM/backfillz/raw/master/fig2.png" width=100% alt=""/>

## Slice plot - plot_slice_histogram()

By partitioning chain slices, in a faceted view, users can assess chain convergence. The slices are currently specified by the user and display density plots for each slice. Have my chains converged? The slice plot offers a clear view of when and how convergence is achieved. Further statistical diagnostics can be embedded in these plots as colour encodings or additional layers and annotations.

![](fig3.png)
<img src="https://github.com/WarwickCIM/backfillz/raw/master/fig3.png" width=100% alt=""/>

## Splash plot - plot_spiral_stream()

Based on a Theodorus spiral, we turn MCMC chains into glyphs and extract properties to answer – What does ‘good mixing’ look like? In these plots variance windows are calculated across chains and parameters. The glyphs have clear diagnostic features and will allow gridded plots to investigate large numbers of parameters.

![](fig4.png)
<img src="https://github.com/WarwickCIM/backfillz/raw/master/fig4.png" width=100% alt=""/>

# Acknowledgements

Expand Down
158 changes: 158 additions & 0 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 05f0c4d

Please sign in to comment.