mlad - maximizing likelihood functions using automatic differentiation

mlad maximizes a log-likelihood function where the log-likelihood function is programmed in Python. This enables the gradients and Hessian matrix to be obtained using automatic differentiation and makes better use of multiple CPUs. With large datasets mlad tends to be substantially faster than ml and has the important advantage that you don’t have to derive the gradients and the Hessian matrix analytically.

You can install mlad within Stata using

. ssc install mlad

You will also need access to Python from Stata and the following Python modules installed, jax, jaxlib, numpy, scipy and importlib.

Please note that it is currently not possible to install a compiled version of jaxlib for Windows. I use Linux for development. It is possible to compile jaxlib from source for Windows. I can’t help with installation on Windows.

Using mlad

Examples of using mlad

I have developed some tutorial examples using mlad. There are speed tests and of course speed depends on the capabilities of your computer. All speed tests are performed on the following.

  • AMD Ryzen 7 3700X - 8 Cores (2 threads per core)
  • CPU speed 4200 MHz
  • RAM 32Gb
  • Running Linux Mint 20.1 Cinnamon
  • Cost $\approx £650$

I have Stata MP2, but I restrict to 1 processor for most examples.

The examples are below - I intend to add more examples in the future.


See mlad_updates.txt

Professor of Biostatistics