A function (smokeplot.R
) for visualizing results uncertainty. The function draws from a user-supplied posterior distribution p(θ|y), generally in the form of three column vectors: (1) covariate values, (2) mean estimates and (3) error estimates. The draws are then graphed with visual weighting so that areas of the posterior with concentrated uncertainty are emphasized, whereas areas with diffuse uncertainty are less prominent.
The aim is to avoid emphasizing the limits of the confidence interval at the expense of regions that are more information-rich. The function uses geom_raster and interpolation to produce smaller files with smoother edges. Traditional confidence intervals, a median line, and spaghetti lines can be added as options.
The code is adapted from Felix Schönbrodt and is motivated by Solomon Hsiang's paper.
mat <- as.matrix(read.table("https://raw.github.com/george-wood/SmokePlot/master/example_matrix.txt", header=FALSE))
source("https://raw.github.com/george-wood/SmokePlot/master/smokeplot.R")
smokeplot(mat, palette=magma(10), slices=1000, smoke.alpha=0.5,
ylim=c(-4, 1), title='color spectrum')
ggplot2
ggthemes
reshape2
viridis
plyr