Skip to main content

Multiple Univariate ARCH modeling toolbox built on top of the ARCH package

Project description

MUArch

Continuous Integration

Build Status Build status

Documentation

Documentation Status

Coverage

Coverage Status

Installing

Install and update using pip and on conda.

This is a wrapper on top of Kevin Sheppard's ARCH package. The purpose of which are to:

  1. Enable faster Monte Carlo simulation
  2. Simulate innovations through copula marginals

In the package, there are 2 classes to aid you - UArch and MUArch. The UArch class can be defined using a similar API to arch_model in the original arch package. The MUArch is a collection of these UArch models.

Thus, if you have a function that generates uniform marginals, like a copula, you can create a dependence structure among the different marginals when simulating the GARCH processes.

If you need a copula package, I have one here. :)

Example

I'll list out a simple procedure to do AR-GARCH-Copula simulations.

from muarch import MUArch, UArch
from muarch.datasets import load_etf
from copulae import NormalCopula


returns = load_etf()  # load returns data
num_assets = returns.shape[1]

# sets up a MUArch model collection where each model defaults to 
# mean: AR(1)
# vol: GARCH(1, 1)
# dist: normal 
models = MUArch(num_assets, mean='AR', lags=1) 

# set first model to AR(1)-GARCH(1, 1) with skewt innovations  
models[0] = UArch('AR', lags=1, dist='skewt')  

# fit model, if you get complaints regarding non-convergence, you can scale the data up 
# using the scale parameter in the UArch or MUArch. i.e. UArch(..., scale=100). This will
# reduce numerical errors. Don't worry, I'll rescale the simulation values subsequently
models.fit(returns)

# Usually you'll want to fit the residuals to the copula, use the copula to generate the
# residuals and subsequently transform it back to returns 

residuals = models.residuals() # defaults to return the standardized residuals


cop = NormalCopula(dim=num_assets) # use a normal copula, you could of course use a TCopula
cop.fit(residuals)

# simulate 10 steps into the future, over 4 repetitions. This will return a (10 x 4 x 3) array
models.simulate_mc(10, 4, custom_dist=cop.random)

Future Works

This is actually a temporary hack so that others can do GARCH copula simulation. Another issue is that an ARFIMA mean model is not so easily specified (and simulated from) with the original arch package. You could specify an ARFIMA (or even just an ARMA model for the matter), fit it separately then use the residuals to fit a zero-mean model (pure GARCH). However, in such a way, the simulation is not so straightforward as you'll have to stitch the simulations from GARCH process and the mean model process back.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muarch-0.1.7.tar.gz (434.5 kB view details)

Uploaded Source

Built Distributions

muarch-0.1.7-cp37-cp37m-win_amd64.whl (433.0 kB view details)

Uploaded CPython 3.7m Windows x86-64

muarch-0.1.7-cp37-cp37m-manylinux1_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.7m

muarch-0.1.7-cp36-cp36m-win_amd64.whl (433.0 kB view details)

Uploaded CPython 3.6m Windows x86-64

muarch-0.1.7-cp36-cp36m-manylinux1_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.6m

File details

Details for the file muarch-0.1.7.tar.gz.

File metadata

  • Download URL: muarch-0.1.7.tar.gz
  • Upload date:
  • Size: 434.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for muarch-0.1.7.tar.gz
Algorithm Hash digest
SHA256 bf8ec8c6dccfac984d26c140f5405e1cf3ed78f3caf31f53457ff0ee225ae6cd
MD5 b93a5756f0edfcb2b51b4b229440d378
BLAKE2b-256 d0335449caeda3c559583bc3e9d01fffa0ea907b675cc2118983a43b757f2484

See more details on using hashes here.

File details

Details for the file muarch-0.1.7-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: muarch-0.1.7-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 433.0 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for muarch-0.1.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f0a886fac14c044006ffde241ee2f6efba37804eb54cca81a2e86f6c0278bdb7
MD5 977f012732b19eb9c06e05703dfdb621
BLAKE2b-256 248ba6e3fb6ff29e1db8128200b07469ff074876b7e0558c7c9a45bc4f277204

See more details on using hashes here.

File details

Details for the file muarch-0.1.7-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: muarch-0.1.7-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for muarch-0.1.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 12a929292ab6788d2f6e84ebf81f9284b6f58851d6e797e51960a5a603096d74
MD5 5d2f9c0e83653d5bd0e435992ffdebff
BLAKE2b-256 a83df1c51aff5cf5c589ff10e9d05af726c803d8a30325892654452751b39ece

See more details on using hashes here.

File details

Details for the file muarch-0.1.7-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: muarch-0.1.7-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 433.0 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for muarch-0.1.7-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 269b42ef496e84d5e9d537b6adb7c618757062f02d38498b5fcdabf633bcb0bb
MD5 36a8b22d6030e93e6e654a8cfe2d0dda
BLAKE2b-256 d863a8f0d3f07dc93dfa02a2f3fc9b005cf0860de345a31289715ca6df0583c4

See more details on using hashes here.

File details

Details for the file muarch-0.1.7-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: muarch-0.1.7-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for muarch-0.1.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7b703835e52950a11fde73074610611e3c0f5e4fc5ef0d981c470ff159cbb47c
MD5 2a572ce6b6465dca214af0a470383334
BLAKE2b-256 630102129fd92063989fdf78b9d9867161f62bd805fddc0796c39ffc66cc880d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page