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

Uploaded Source

Built Distributions

muarch-0.1.8-cp38-cp38-win_amd64.whl (426.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

muarch-0.1.8-cp38-cp38-manylinux1_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8

muarch-0.1.8-cp38-cp38-macosx_10_9_x86_64.whl (787.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

muarch-0.1.8-cp37-cp37m-win_amd64.whl (433.6 kB view details)

Uploaded CPython 3.7m Windows x86-64

muarch-0.1.8-cp37-cp37m-manylinux1_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m

muarch-0.1.8-cp37-cp37m-macosx_10_7_x86_64.whl (613.1 kB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

muarch-0.1.8-cp36-cp36m-win_amd64.whl (433.6 kB view details)

Uploaded CPython 3.6m Windows x86-64

muarch-0.1.8-cp36-cp36m-manylinux1_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.6m

muarch-0.1.8-cp36-cp36m-macosx_10_7_x86_64.whl (438.8 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: muarch-0.1.8.tar.gz
  • Upload date:
  • Size: 435.1 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.4

File hashes

Hashes for muarch-0.1.8.tar.gz
Algorithm Hash digest
SHA256 2ac9b345ce2d3c36b31712bda1101360a35b015dba3ad429aa6952d50a13bf62
MD5 69d196693b684d0f61597e92b0403d70
BLAKE2b-256 fb1dc0049530abc1a6cfe658c65cd06dfbbbaf731de86e169f9a590054d11f02

See more details on using hashes here.

File details

Details for the file muarch-0.1.8-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: muarch-0.1.8-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 426.4 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for muarch-0.1.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ba7ff25f6b9ddd2fa74b3871f0d783b069ee6454e848db310690bd8361f189c0
MD5 0f1669eefec59cb28959972de49a58c5
BLAKE2b-256 3e27193932de1c067a87332a58c2adb082103dbd3c8ed9465cee68023b2eb256

See more details on using hashes here.

File details

Details for the file muarch-0.1.8-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: muarch-0.1.8-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for muarch-0.1.8-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8f195091280ea0a64d1666aa0e63538dbc9fc1e109372cac4a6249c892b7ab9a
MD5 8f15c4d274b56c9f7fccd7740f3b9d45
BLAKE2b-256 d09410d1ab88b3de6839f2281c702e6e3ed3899932b9ffa2f95bee684eaab4e7

See more details on using hashes here.

File details

Details for the file muarch-0.1.8-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: muarch-0.1.8-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 787.7 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1.post20191125 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

File hashes

Hashes for muarch-0.1.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1413bd37a1dc0bff384986f7f5553f84251d43c0b7a038036f01931d86fc267c
MD5 ef394a3c57f69e70760ca089bde8d9e0
BLAKE2b-256 dbd34f04db38e014ea1c0f1ca5cb45f11187f5fca65f88aca7c550ea115e7236

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.8-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 433.6 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.4

File hashes

Hashes for muarch-0.1.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 dc3514e2e46141d3b8a43eecf63d5c8c51174609dcb0012cf9fb3c4b36a37376
MD5 536d3f92f3237a1d3ade4ca9f74b9cad
BLAKE2b-256 7ab5352f3446f17b6ed624fed54f70d06bc428488316eed6cbf9c6f6f17eb027

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.8-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 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.4

File hashes

Hashes for muarch-0.1.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0add2bffb2bc8a9f0a5fa1c8ddc90e6e0e5919479fcb161350fdc14c34d371a1
MD5 bd6f0f29c8018167eb594c6d3bb5fd7b
BLAKE2b-256 dff41aeaa1cd6c4a0e596d87fe28273b2d8c27e1e7f2fc22737a8cc4efc73153

See more details on using hashes here.

File details

Details for the file muarch-0.1.8-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: muarch-0.1.8-cp37-cp37m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 613.1 kB
  • Tags: CPython 3.7m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5

File hashes

Hashes for muarch-0.1.8-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 b20fc85a9b6d39baaa573840abfd566252e058070b120a1529b94e7b9c71d527
MD5 396ea91f0a1688727d8fb47aa1c16ed0
BLAKE2b-256 795c04ee858c5d8cf497efbd4b6bd673dc280f6ab497d0e71b418724d73309e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.8-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 433.6 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.8-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 786e95f3108a042363d1cffcb8623450d426ce90f4279a0afa4ab1eaecd20724
MD5 354111d98d9e95b1eec45866f29659a7
BLAKE2b-256 eab75aacfebf67338fac39cd5d4ad63dd1f8c775a9d3603d6420fbf0ab492ef9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.8-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 1.2 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.4

File hashes

Hashes for muarch-0.1.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f0496b8bb65f1e88cd8202928f3c5569a48445841a498aad8b79934de5a107af
MD5 678bab5249a7aed59e7494845f66784a
BLAKE2b-256 05009d92669229161ec9fec88be626eee960dc6fb95215c6cc070f5d3893ffca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.8-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 438.8 kB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9

File hashes

Hashes for muarch-0.1.8-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 c8d1bc57e2d8ce4dc1ab27cb9a529e4ecd756922e92ea9b1d868dbe28ea36936
MD5 52db00f75fc26675382e787d7f47c8f4
BLAKE2b-256 0facc0f0893eb6b591cfc5a22004590161394a0ff592c6729b363a33be386e64

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