The visualizeBF package is useful for teaching about Bayes Factors, providing two different visual interpretations of the concept.

This is mostly a toy package useful for teaching.

Installation

You need the devtools package to install this from github.

install.packages("devtools")

Then install visualizeBF.

devtools::install_github("mcbeem/visualizeBF")

And then load it.

library(visualizeBF)
library(visualizeBF)

Example

First, simulate some data.

set.seed(1)
data <- rnorm(n=50, mean=.3, sd=1)

Visualize the BF as the ratio of the weighted average likelihood under $H_1$ to the likelihood of the data under $H_0$ (via plot=1).

visualizeBF(data, plot=1)

Visualize the BF as the ratio of prior to posterior density under $H_0$ (via plot=2).

visualizeBF(data, plot=2)


mcbeem/visualizeBF documentation built on Nov. 19, 2019, 12:35 a.m.