Skip to content

Getting Started


To use Turing, you need to install Julia first and then install Turing.

Install Julia

You will need to install Julia 1.3 or greater, which you can get from the official Julia website.

Install Turing.jl

Turing is an officially registered Julia package, so you can install a stable version of Turing by running the following in the Julia REPL:

julia> ] add Turing

You can check if all tests pass by running

julia> ] test Turing


Here's a simple example showing the package in action:

using Turing
using StatsPlots

# Define a simple Normal model with unknown mean and variance.
@model function gdemo(x, y)
   ~ InverseGamma(2, 3)
  m ~ Normal(0, sqrt())
  x ~ Normal(m, sqrt())
  y ~ Normal(m, sqrt())

#  Run sampler, collect results
chn = sample(gdemo(1.5, 2), HMC(0.1, 5), 1000)

# Summarise results

# Plot and save results
p = plot(chn)