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.6.tar.gz (602.5 kB view details)

Uploaded Source

Built Distributions

muarch-0.1.6-cp37-cp37m-win_amd64.whl (600.8 kB view details)

Uploaded CPython 3.7m Windows x86-64

muarch-0.1.6-cp37-cp37m-manylinux1_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.7m

muarch-0.1.6-cp37-cp37m-macosx_10_9_x86_64.whl (430.8 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

muarch-0.1.6-cp36-cp36m-win_amd64.whl (600.8 kB view details)

Uploaded CPython 3.6m Windows x86-64

muarch-0.1.6-cp36-cp36m-manylinux1_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.6m

muarch-0.1.6-cp36-cp36m-macosx_10_7_x86_64.whl (432.7 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: muarch-0.1.6.tar.gz
  • Upload date:
  • Size: 602.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.6.tar.gz
Algorithm Hash digest
SHA256 70dced2dc7533a9c6b6feb85bf7560155b173ae2742cb6d5cb83be6cc51d8755
MD5 3ddac9ec64661947de1774444ce0b863
BLAKE2b-256 6415b7259b7074672284119050ccfe9c0ac12b7fb0857cb85bdae0913962970a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.6-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 600.8 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.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d561f0552a4b14c0603188e9faad32a1a60b8fe36a738fb4ad8cd29ace8d31a9
MD5 1277d38b1d46ca214b4f9810b61d5ec6
BLAKE2b-256 6b1f5c7c2e8aa024494949c1feb389d59107555c0a116889e58ac1494b834b2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.6-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.3 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.7.3

File hashes

Hashes for muarch-0.1.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 99b15dee3efd5f2d963481237675460f3280031fc495543183fc0bcf77706f67
MD5 561551192eb276246ecf7f8acfae2d42
BLAKE2b-256 ad862628b56b342b25a7c5fa3b16f52937c9be2401d0189a4837e4a493d9a8e2

See more details on using hashes here.

File details

Details for the file muarch-0.1.6-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: muarch-0.1.6-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 430.8 kB
  • Tags: CPython 3.7m, macOS 10.9+ 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.33.0 CPython/3.7.3

File hashes

Hashes for muarch-0.1.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3756f959e3f560088073aa8b7fd296fa646299af78732cd90b91b3a62eda7585
MD5 b813bc511e5bdf76988d63b649284df2
BLAKE2b-256 4c09d7fe74c9064a49be209ffe391ed5fd09d49c7b13330e5c33e8f48cc73037

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.6-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 600.8 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.7.3

File hashes

Hashes for muarch-0.1.6-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 7248128d0c8cfe72fd04f459ac8f37779e89e92644f9d26e9bd2385a91d73f2b
MD5 6ca480ed1c9fd4e5128ebc486c190197
BLAKE2b-256 777f6a3e5cc11c26dcc141ae2fa98b925d577dd3d0e9bae6b84e44827ce84fef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.6-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.3 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.7.3

File hashes

Hashes for muarch-0.1.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2cc52e81563d651334daf194b942a91d52ea1e9983fea99d3cf458e7506e2147
MD5 2ffa8f9ada355bdae0dc8eb56a249b99
BLAKE2b-256 0dd961f46a1afd168bd28af1d013f52f4f435b964e65d8c59d81b81d1f8b9b9b

See more details on using hashes here.

File details

Details for the file muarch-0.1.6-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: muarch-0.1.6-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 432.7 kB
  • Tags: CPython 3.6m, macOS 10.7+ 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.33.0 CPython/3.6.7

File hashes

Hashes for muarch-0.1.6-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 20d6b21a1b6ce2b6af22686772039ebd847877aaf44d7fa9b06ca3ee4ea6f3bc
MD5 03523cde8c4ae001b18093f9628fb24f
BLAKE2b-256 f1865b42b2a46ffd76814aa8f0b7a169287f32d1019fe2bdbee6914501d594e4

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