A lightweight modelling syntax for defining likelihoods and priors and for computing Bayes factors for simple one parameter models. It includes functionality for computing and plotting priors, likelihoods, and model predictions. Additional functionality is included for computing and plotting posteriors.
The goal of bayesplay is to provide an interface for calculating Bayes factors for simple models. It does this in a way that makes the calculations more transparent and it is therefore useful as a teaching tools.
bayesplay is now on CRAN. You can install it with:
install.packages("bayesplay")
Or if you want to live on the edge, you can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("bayesplay/bayesplay")
The bayesplay package comes with three basic functions for computing
Bayes factors.
The likelihood() function for specifying likelihoods
The prior() function for specifying priors
And the integral() function
Currently the following distributions are supported for likelihoods and priors
Normal distribution (normal)
Uniform distribution (uniform)
Scaled and shifted t distribution (student_t)
Cauchy distributions (cauchy)
Beta distribution (beta)
Normal distribution (normal)
Scaled and shifted t distribution (student_t)
Binomial distribution (binomial)
Various noncentral t distributions, including:
Noncentral t distribution (noncentral_t)
Noncentral t distribution scaled for a paired samples/one sample
Cohen’s d (noncentral_d)
Noncentral t distribution scaled for an independent samples
Cohen’s d (noncentral_d2)
For worked examples of the basic usage see basic usage. Or for basic plot functionality see basic plotting
Breaking changes for < v0.9.0
distributionparameter for specifying likelihoods and priors has been renamedfamily
noncentral_dandnoncentral_d2are now parametrised in terms of sample size rather than df