## Periodic Reporting for period 1 - juliaeconometrics (Developing a Financial Econometrics Package for the Julia Programming Language)

Reporting period: 2018-03-01 to 2020-02-29

The volatility of a financial asset, usually measured in terms of the standard deviation of its daily returns, is an important input to many problems in finance, including risk management and option pricing. It also plays an important role in the regulation of financial institutions, because it is an ingredient in the risk measures — Value at Risk and expected shortfall — that financial institutions have to report to regulators for the purpose of determining capital requirements.

To determine the volatility, it is typically not sufficient to collect a sample of daily returns over a long period of time and compute its sample standard deviation. The reason is that the volatility tends to change over time, a feature known as volatility clustering. This term refers to the phenomenon that financial markets tend to alternate between periods of financial turmoil, and relatively calmer periods. Computing the standard deviation over a long time series would average these out. Alas, shortening the sample period is not a solution to this problem, as this would result in a less precise estimate. A proper solution requires an econometric model.

Different modeling frameworks for asset volatilities have been proposed in the literature. The workhorse model that is most widely employed is the ARCH (autoregressive conditional heteroskedasticity) model of Engle (Econometrica 1982) and its various extensions. The key insight is that the presence of volatility clustering implies that large (in absolute value) returns will tend to be followed by large (in absolute values) returns, and small returns by small returns. The basic idea of the model, then, is to model the unobserved volatility of an asset as an affine function of the squares of the returns of the past few days. This leads to the ARCH(q) model, in which the past q returns enter the calculation. The various extension of the model expand on this basic idea; for example, in the GARCH(p, q) model of Bollerslev (Journal of Econometrics 1986), the past p values of the squared volatility enter the calculation as well.

Volatility clustering is but one of the so-called stylized facts pertinent to daily asset returns. A second one is known as the (statistical) leverage effect, which describes the observation that large negative returns tend to have a greater impact on future volatility than do large positive returns. The leverage effect can be accounted for by incorporating asymmetries into the basic ARCH or GARCH models, as is done in the TGARCH(o, p, q) model of Glosten et al. (Journal of Finance 1993) and the EGARCH(o, p, q) model of Nelson (Econometrica 1991). A third common observation is that the empirical distribution of asset returns tends not to resemble a Gaussian distribution; rather, returns exhibit a feature known has heavy tails, implying that extreme events tend to occur more frequently than would be predicted by a Gaussian distribution. This, too, can be incorporated in the model. Other stylized facts relate to the co-movement of several assets. One of these is known as correlation breakdown. This describes the fact that the correlation between the returns of two assets tends to increase in times of financial turmoil, potentially negating the benefits of portfolio diversification. Modelling such effects requires multivariate extensions of the model.

The main research objective of this project was to produce an implementation for the Julia language. Julia is a relatively young open source project started at MIT. It promises to combine the ease of use and productivity of high-level languages, such as those mentioned above, with the speed of execution of compiled low-level languages such as C++. Indeed, Julia typically performs well within a factor of 2 of the equivalent C++ code.

The result of the project has been released as ARCHModels.jl an MIT-licensed Julia package that implements estimation, inference, simulation, Value at Risk forecasting, and diagnostic testing for a range of univariate and multivariate ARCH-type models.

To determine the volatility, it is typically not sufficient to collect a sample of daily returns over a long period of time and compute its sample standard deviation. The reason is that the volatility tends to change over time, a feature known as volatility clustering. This term refers to the phenomenon that financial markets tend to alternate between periods of financial turmoil, and relatively calmer periods. Computing the standard deviation over a long time series would average these out. Alas, shortening the sample period is not a solution to this problem, as this would result in a less precise estimate. A proper solution requires an econometric model.

Different modeling frameworks for asset volatilities have been proposed in the literature. The workhorse model that is most widely employed is the ARCH (autoregressive conditional heteroskedasticity) model of Engle (Econometrica 1982) and its various extensions. The key insight is that the presence of volatility clustering implies that large (in absolute value) returns will tend to be followed by large (in absolute values) returns, and small returns by small returns. The basic idea of the model, then, is to model the unobserved volatility of an asset as an affine function of the squares of the returns of the past few days. This leads to the ARCH(q) model, in which the past q returns enter the calculation. The various extension of the model expand on this basic idea; for example, in the GARCH(p, q) model of Bollerslev (Journal of Econometrics 1986), the past p values of the squared volatility enter the calculation as well.

Volatility clustering is but one of the so-called stylized facts pertinent to daily asset returns. A second one is known as the (statistical) leverage effect, which describes the observation that large negative returns tend to have a greater impact on future volatility than do large positive returns. The leverage effect can be accounted for by incorporating asymmetries into the basic ARCH or GARCH models, as is done in the TGARCH(o, p, q) model of Glosten et al. (Journal of Finance 1993) and the EGARCH(o, p, q) model of Nelson (Econometrica 1991). A third common observation is that the empirical distribution of asset returns tends not to resemble a Gaussian distribution; rather, returns exhibit a feature known has heavy tails, implying that extreme events tend to occur more frequently than would be predicted by a Gaussian distribution. This, too, can be incorporated in the model. Other stylized facts relate to the co-movement of several assets. One of these is known as correlation breakdown. This describes the fact that the correlation between the returns of two assets tends to increase in times of financial turmoil, potentially negating the benefits of portfolio diversification. Modelling such effects requires multivariate extensions of the model.

The main research objective of this project was to produce an implementation for the Julia language. Julia is a relatively young open source project started at MIT. It promises to combine the ease of use and productivity of high-level languages, such as those mentioned above, with the speed of execution of compiled low-level languages such as C++. Indeed, Julia typically performs well within a factor of 2 of the equivalent C++ code.

The result of the project has been released as ARCHModels.jl an MIT-licensed Julia package that implements estimation, inference, simulation, Value at Risk forecasting, and diagnostic testing for a range of univariate and multivariate ARCH-type models.

"The research part of the project consisted of implementing the required functionality in Julia. Much thought has been given to the design of the user interface, and to achieving the best possible computational speed. The main result of the project is thus ARCHModels.jl which had its 1.0 release on Feb. 6th, 2020. The package supports simulation, estimation, inference, forecasting, and (C)VaR computations for a variety of univariate and multivariate models of arbitrary order, a large variety of innovation distributions, specification tests, arbitrary order ARMA (auto-regressive moving average) models, regression models, automatic model selection based on information criteria, and a cutting-edge method for very large scale multivariate models. The package features extensive documentation. A paper describing the package is available on SSRN and currently (21/4/2020) in the top ten lists of 3 SSRN eJournals, including 1st place in Econometrics: Computer Programs & Software. The researcher has presented his work on the project at JuliaCon 2018 in London, UK, and at JuliaCon 2019 in Baltimore MD, United States. JuliaCon is an annual conference bringing together the maintainers of the Julia language, package authors, and users.

The training goals of the project (improved coding skills, writing library level code, writing documentation, using git, grant management, interdisciplinary communication skills) have been achieved by training through research. In addition, the researcher has taken the D.A.S. in Data Science program offered by ETH Zurich to study machine learning methods, which he believes to be the ""next big thing"" in volatility modelling."

The training goals of the project (improved coding skills, writing library level code, writing documentation, using git, grant management, interdisciplinary communication skills) have been achieved by training through research. In addition, the researcher has taken the D.A.S. in Data Science program offered by ETH Zurich to study machine learning methods, which he believes to be the ""next big thing"" in volatility modelling."

ARCHModels.jl is the only full-featured implementation of ARCH-type models in the Julia language. Unlike the corresponding packages in other high-level languages, it is entirely implemented in Julia, without resorting to a low-level language like C++ for the computationally expensive parts such as evaluating the likelihood function. This allows it to rely on Julia’s powerful automatic differentiation facilities for likelihood derivatives, and avoids dynamic dispatch during numerical optimization. As a result, ARCHModels.jl beats many other implementations in terms of speed. When fitting a standard GARCH(1, 1) model to a benchmark data set, it is faster than Python’s ARCH package by a factor of about 6, faster than Matlab’s Econometrics Toolbox by a factor of about 12, and faster than R’s rugarch package by a factor of about 50.

Another benefit of the fact that ARCHModels.jl is entirely written in a high-level language is that it makes it easy for scientists doing research on ARCH-type models to implement their desired extensions. It would be a major burden to many researchers if the core of the package were written in C++. Researchers enjoy easy access to the source code of the package, as it is released under an open-source license and hosted on Github.

With open-source software being an important pillar of open science, we hope that the availability of ARCHModels.jl will draw more researchers in the field away from commercial software (Matlab being the standard at the moment), to free and open-source Julia. Speaking more broadly, the availability of a mature and comprehensive package ecosystem is an important factor in the continued growth of Julia’s user base in general. Hopefully ARCHModels.jl can be a small part of that.

Another benefit of the fact that ARCHModels.jl is entirely written in a high-level language is that it makes it easy for scientists doing research on ARCH-type models to implement their desired extensions. It would be a major burden to many researchers if the core of the package were written in C++. Researchers enjoy easy access to the source code of the package, as it is released under an open-source license and hosted on Github.

With open-source software being an important pillar of open science, we hope that the availability of ARCHModels.jl will draw more researchers in the field away from commercial software (Matlab being the standard at the moment), to free and open-source Julia. Speaking more broadly, the availability of a mature and comprehensive package ecosystem is an important factor in the continued growth of Julia’s user base in general. Hopefully ARCHModels.jl can be a small part of that.