Skip to content

floswald/julia-bootcamp

Repository files navigation

Julia Bootcamp (for Economists)

🎈 Go to online notebooks 🎈

This is an 8-hours crash course to get going with the julia computing language.

It says in the title for Economists, but that's mainly because I am one myself, and people in the profession asked me to teach this course; That said, you don't need any specific economics knowledge for this course.

Organization

We have 8 blocks of one hour each. Each block will be interrupted several times along the way to check whether what I just said makes sense to you, and to allow you to formulate questions.

Material

We did the first session freestyle, in terminal and VScode (see below). then we switched to notebooks.

Notice that the notebooks are visible online at https://floswald.github.io/julia-bootcamp/. You will need those during the questions in class!

🎈 Go to online notebooks 🎈

Notebooks

You can either download the notebooks from the website to run locally, or you clone this repository - the notebooks are identical, so whatever you prefer.

  1. assigning variables
  2. arrays
  3. datatypes
  4. functions and programming constructs
  5. performance
  6. plotting
  7. interactive plotting and dashboards

Session 1

  • installing julia
  • installing vscode and julia extension
    • Optionally in vscdoe, shift-cmd-p for command palette, then type shell command to put code onto your PATH such that you can start it from the command line.
  • Optionally customize the julia startup file at ~/.julia/config/startup.jl
    • I put my startup.jl here into this repository for you to copy to ~/.julia/config/startup.jl on your computer if you want.
    • It sets sticky shell mode: if you hit ; in the julia REPL, it will switch to shell mode (so you are on your OS console). By default that switches back after your last shell command returns - not with sticky mode, where it will only switch back if you hit backspace.
    • set vscode as standard editor: when you use the @edit macro for instance, it will open vscode to look at the source code.

How to run julia

  • running julia as standalone app
  • running julia inside vscode
  • starting julia from the command line
  • important locations and directories, different julia versions, etc

Working with the REPL

Julia Packages

  • What are packages? In words.
  • How to install? Whose package? Where from?
  • Different package versions and environments. the Project.toml file.
  • installing a package: distributions
    • create file 02.jl, say you want to use the Distributions package and create a normal distribution with n = Normal(1.0,0.5).
    • look at ?quantile (last entry) and ?pdf and finally compute the value of the pdf at the 0.95 quantile of your distribution n

Homeworks and More Material

I have a more complete course, also more relevant for Economists, at this website. Maybe have a look there if you are looking for econ-specific applications. Another great place for such a search is by the way the QuantEcon project by Perla, Sargent and Stachurski.

I will not give you any homeworks, however, you may want to practice a bit more. I have several fully worked homeworks on my course website, which you could have a go at if you wanted.

  1. Lockdown in a SIR model
  2. Spatial epidemic model
  3. Probit Estimator
  4. Portfolio Choice Problem

Finally, I'm quite fond of my julia implementation of @fediskhakov 's et al discrete choice EGM paper, so check it out at https://github.com/floswald/DCEGM.jl, in particular the MLine data type which is really cool 😎.

Other Resources

There are too many things to cover. Let me try with a quick list:

Where did I teach this course?

  1. University of Barcelona. Videos made with consent of participants.
  2. Bocconi
  3. SciencesPo

Resources

I used examples and got inspiration from several excellent tutorials out there to build this boot camp:

  • Think Julia by @benlauwens is fully comprehensive and very complete intro to julia, which I highly recommend.
  • The Julia Express by @bkamins is a much condensed version - great for a quick start.
  • From Zero to Hero by @datseris is a great tutorial series, bit more advanced but great insights for beginners as well.

Have a look at the dedicated section on the julialang website for more great material!