Julia for Statistics - a tutorial

This tutorial was initially prepared as part of the COST action HiTEc for the Econometrics & Statistics (EcoSta) conference in Tokyo, and updated to a second version for the Joint Conference CFE-CMStatistics 2025 in London, with an additional module on Probabilistic Programming contributed by the Turing.jl team.
![]() |
![]() |
Aim
This tutorial introduces the Julia programming language and its use for statistical analysis.
The following topics will be covered:
introduction to the Julia programming language
the package manager and tooling
managing data and plotting in Julia
statistical distributions
numerical optimization and automatic differentiation
working with R and Python in Julia
Instructor

Mattias Villani
Professor of Statistics
Stockholm University
Before the tutorial
You may want to install Julia, some packages, and VS code before the tutorial, to follow along in the interactive demos and also experiment yourself.
- Install Julia. Here are the instructions.
- (optional) Install VS code (IDE similar to RStudio for R). Instructions are here.
- Activate an environment and install some Julia packages:
- Download this Project.toml file to your directory of choice. This file lists some of the most important packages used in the tutorial.
- Start Julia by typing
juliain the terminal. - In Julia, change working directory to your chosen directory by typing
cd("PathToYourDirectory"). - In Julia, type
]and pressEnterto enter the package manager. The prompt should change to something withpkg>. - activate the environment by typing
activate .andEnter. (that isactivatefollowed by space and a dot). - still at the
pkg>prompt, typeupdateto install the most important packages for the tutorial, including Turing.jl. Go back to thejulia>prompt by pressingBackspace.
If you want all packages used in the tutorial (takes longer) in exactly the same state as in my presentation, do this:
- Download the Manifest.toml file and place it in your directory of choice. This file list all packages and their dependencies with the same version used in the tutorial.
- Start Julia by typing
juliain the terminal. - In Julia, cd to your directory by typing
cd("PathToYourDirectory"). - In Julia, type
]and pressEnterto enter the package manager. The prompt should change to something withpkg>. - activate the environment by typing
activate .andEnter. (that isactivatefollowed by space and a dot). - still at the
pkg>prompt, typeinstantiateandEnterto install all packages used in the tutorial, with the exact same versions. Go back to thejulia>prompt by pressingBackspace.
Plan and material
Lecture 1 - The Julia programming language and tooling
Reading: Getting started with Julia
Live demo: Basic Julia
Lecture 2 - Working with data in Julia
Reading: Read, managing and plotting data
Code: DataFrames.jl | Tidier.jl | Plots
Lecture 3 - Statistics in Julia
Reading: Distributions and Optimization | Interop with R and Python
Code: Distributions | Optimization | Working with R and Python
More material
Books, courses and podcasts etc about Julia
A collection of Julia links
Writing Julia packages
More on packages and the package manager

