Skip to content

Instantly share code, notes, and snippets.

@davharris
davharris / bayes-reproducibility-density.R
Last active September 2, 2015 06:10
Code for a kernel density plot showing the Bayes Factors associated with the "Bayesian Reproducibility Project" blog post by Alex Etz.
# Start by running the code on Alex Etz's blog post
# http://alexanderetz.com/2015/08/30/the-bayesian-reproducibility-project/
# Cap the Bayes Factor at 10^12 to allow zooming in further
bfRepCapped = pmin(bfRep, 1E12)
# Kernel density estimate of the log-transformed Bayes Factors
D = density(log(bfRepCapped))
library('shiny')
# the code (with a little cleaning up) for the visualisations is from
# http://alexanderetz.com/2015/07/25/understanding-bayes-updating-priors-via-the-likelihood/
# Alex Etz runs a really nice blog -- go check it out!
shinyApp(
ui = shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
div(style = 'display: inline-block;', numericInput('a', label = h4('a'), value = 1)),