This folder contains replication files for the paper "ARCHModels.jl: Estimating ARCH models in Julia" by Simon A. Broda and Marc S. Paolella.

Running benchmarks with Docker
------------------------------

There are 4 subdirectories containing code for different languages: "julia", "matlab", "python", and "r". The subdirectory "data" contains two data sets.
Detailed instructions for each language follow below. Here we describe how to run the benchmarks automatically using Docker on a Linux system.

To run the run_benchmarks.bash script you will need the following software installed:
- MATLAB R2021b with Econometrics Toolbox
- Docker

Make sure run_benchmarks.bash is executable ('chmod +x ./run_benchmarks.bash'), then run './run_benchmarks.bash'
with the MATLAB environment variable set if you would like to run with a specific version of MATLAB, if multiple verisons are installed on your machine:

MATLAB=/usr/local/MATLAB/R2021b/bin/matlab ./run_benchmarks.bash


------------------------------------------------------------------------------------------------------------------------------------------

Running benchmarks manually and replicating figures and other results
------------------------------------------------------------------------------------------------------------------------------------------

Notes:
- The instructions below assume that Julia, MATLAB, R and Rscript, and Python and pip are installed and on the path.
- The commands should be issued from the directory containing this file.
- All code and instructions have been tested on Windows 11 and Ubuntu 20.04.
- Versions used in the paper:
	- ARCHModels.jl 2.3.3 on Julia 1.8.5
	- MATLAB R2021b with Econometrics Toolbox
	- rugarch 1.4-9 and rmgarch 1.3-9 on R 4.2.2
	- arch 5.3.1 on Python 3.10.9

------------------------------------------------------------------------------------------------------------------------------------------
Julia:

Run

julia --threads auto julia/replication_script.jl

from the directory containing this file. The script will automatically install all its dependencies.

The code will produce Figures 1 and 2 in the paper, the estimation results shown in Section 5, and the Julia benchmarks in Tables 1 and 2.

------------------------------------------------------------------------------------------------------------------------------------------
MATLAB:

Run

matlab -sd "matlab" -batch replication_script

from the directory containing this file. The code requires the Econometrics Toolbox.
The code will reproduce the MATLAB benchmarks in Table 1.

------------------------------------------------------------------------------------------------------------------------------------------
Python:

Make sure that the required packages are installed:

pip install numpy pandas arch==5.3.1

Then, run

python python/replication_script.py

from the directory containing this file.
The code will reproduce the Python benchmarks in Table 1.

------------------------------------------------------------------------------------------------------------------------------------------
R:

On Ubuntu 20.04, install the following packages needed for the rmgarch package:

sudo apt-get install libmpfr-dev libgmp3-dev tk -y

Install the required packages:

R -e "install.packages(c('remotes', 'microbenchmark'));"

R -e "require(remotes); \
  install_version('rugarch', version = '1.4-9')"

R -e "require(remotes); \
  install_version('rmgarch', version = '1.3-9')"

Then, run

Rscript r/replication_script.R

from the directory containing this file.
The code will reproduce the R benchmarks in Tables 1 and 2.
