(testing is done on latest stable release of Julia, for Linux, Windows, and MacOS)
First year graduate level econometrics notes with embedded examples using the Julia language.
The notes cover linear regression models in the first half (about 30 hours of class time). The second half (another 30-40 hours of class time) moves on to nonlinear optimization, maximum likelihood and GMM estimation of potentially nonlinear models. After these core methods, there are several chapters which introduce more specialized topics such as panel data, quantile regression, nonparametric methods, etc.
The notes are in the file econometrics.pdf. It is not recommended to use this file by itself, as one will not have access to the linked code and examples. The notes were prepared with the expectation that the example code will be examined, run, and experimented with. See below for how to make full use of the materials.
The basic introductory videos:
- Introduction: short description of what's here
- Installation: how to install this as a Julia project
- Speed: how to compile a system image to make it fast
- Comfort: how to set up VS Code for comfortable use
Practical summary videos:
- Ch. 12, Numerical Optimization: explains how to use the practical summaries, and does the summary for Ch. 12.
You need to install this repository as a Julia project. Do this as follows:
-
download the code: (a) download a zip of the repo, and uncompress it in a convenient directory, or (b) git clone the repository to the desired location
-
Go to that directory and start Julia using
julia --proj
-
In Julia, the first time you use the files, do
using Pkg; Pkg.instantiate()
This will take some time, as Econometrics relies on a number of other packages. -
then do
using Econometrics
in Julia to use the package. The first time you do this, it will take a long time, maybe 15 minutes or so. Don't worry, this is normal. All of the packages that were downloaded are being compiled for the first time. We will be able to make this go much, much faster when we want to use the code. -
To run examples, cd into the relevant subdirectory of Econometrics/Examples, and then just include the script you would like to run.
-
Once this is done, you can use the code at any time by repeating steps 2 and 4.
-
You can see some examples by typing
ols() mleresults() gmmresults() mcmc() npreg() samin()
when in Julia.
-
To run examples, cd into the relevant subdirectory of Econometrics/Examples, and then just include the script you would like to run.
-
I recommend setting your operating system to open .jl files with your favorite editor, to make the links in econometrics.pdf open in that editor.
-
To speed things up a lot, type
ìnclude("MakeSysimage.jl")
from Julia, having started Julia withjulia --proj
in the directory where you installed the notes. This will compile all of the packages, and keep the compiled images for re-use. If you do this, when you start Julia in the future, usejulia --proj -J JuliaSysimage.so
(caveat: I have only tried this using Linux. If you're a Windows or OSX user, please open an issue if these instructions don't work)
- they are available in editable form (econometrics.lyx), so that you can modify them to suit your needs: see the first chapter for more information, and get LyX from www.lyx.org.
- they contain links that point to example programs using the Julia language. The examples show how to use the methods and illustrate properties of estimators. The example code can be modified to allow exploration.
To get an idea of how this works, the following figure, on the R, shows an explanation in the pdf version of the notes, with a link to an example. The code of the example is visible in the upper L, and the output of running the example in Julia is at the lower L. The plot appears in the VScode plot frame.