## 3.6 Bayesian Statistics

Now, let’s repeat some of our previous analyses with Bayesian versions. First we’ll install and load the package which contains the Bayesian statistics functions we’ll use:

# Install and load the BayesFactor package
install.packages('BayesFactor')
library(BayesFactor)

Now that the packages is installed and loaded, we’re good to go! Let’s do a Bayesian version of our earlier t-test asking if pirates who wear a headband are older or younger than those who do not.

# Bayesian t-test comparing the age of pirates with and without headbands
## Bayes factor type: BFindepSample, JZS