As a bonus, I will occasionally post Notebooks where you can interactively play around with some Bayesian analyses. I will use a new type of notebook system called Pluto in the Julia programming language. The advantage of Pluto is that it is reactive: changing one variable in the notebook immediately updates the parts of the notebook that depend on the variable.
Here is what you need to do to access this bonus feature:
- Download Julia and install it.
- Start up Julia to get the
julia>
prompt where you can type commands. - Install and start Pluto by typing in the following commands at the
julia>
promptusing Pkg # initializes the package manager Pkg.add("Pluto") # installs the Pluto package. import Pluto # loads the Pluto package. Pluto.run() # Opens up Pluto in your browser (Firefox or Chrome)
- Open up a notebook file in the Pluto browser tab and start playing around by changing value in the cells.
Note that the notebooks uses modules (like R packages) that you need to install (similar to how you have to install.packages() in R). So you have to do Pkg.add("NameOfPackage") to install each package at the Julia prompt. This is only done once. The first cell of the notebook shows the needed modules (look for the using
and import
statements). Here is for example what you need to install for running the BernBeta.jl notebook:
Pkg.add("Plots") # The basic plotting module
Pkg.add("LaTeXStrings") # The get LaTeX maths in plots
Pkg.add("Distributions") # Module with probability distributions
Pkg.add("PlutoUI") # A module with fancy sliders etc for Pluto
Pkg.add("ColorSchemes") # Fancy colors for plotting
Julia is a very attractive programming language for numerical and statistical analysis. If you are curious and want to use if for more than Notebooks, I suggest downloading the fantastic editor VS Code and the Julia for VS Code extension that turns VS Code into an RStudio-like experience for Julia.
Here is an animated GIF to give you a feel for how it works for the Bernoulli model: Bernoulli notebook