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

Uploaded Source

Built Distributions

muarch-0.1.0-cp37-cp37m-win_amd64.whl (408.9 kB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

muarch-0.1.0-cp37-cp37m-macosx_10_9_x86_64.whl (425.2 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

muarch-0.1.0-cp36-cp36m-win_amd64.whl (587.3 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

muarch-0.1.0-cp36-cp36m-macosx_10_7_x86_64.whl (427.1 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: muarch-0.1.0.tar.gz
  • Upload date:
  • Size: 600.4 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.0.tar.gz
Algorithm Hash digest
SHA256 00d307fdde52c9a9d85dec9193babe3a51aed18dbcb6b5849b8f36d9b242592a
MD5 c148f75bf60af798f526b2946aefc107
BLAKE2b-256 4f5b5ff0ad0576ce077a712fd757e50e72b88696b5d3066fd224910a2592608a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 408.9 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.2 CPython/3.7.3

File hashes

Hashes for muarch-0.1.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 982620e61730b083a67826fb99d849065c4ec155e3251a57c1ad257b52b1af21
MD5 90e1df4a9461a6eeb44b62d17bab7bb8
BLAKE2b-256 a71c4392cd78ae5a336c3ac9998071201fb918789008544b47f00b4d79e0e816

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.0-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.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1708a007dec31f6dbc81499e4f536d6001d569c63f775392bb79d1eda7876028
MD5 50bde673ab034447caf4a1cda80b07f2
BLAKE2b-256 eaecae17960697984fe4327c0882c9f137739c50929f1953851cd782d985cb3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 425.2 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.32.2 CPython/3.7.3

File hashes

Hashes for muarch-0.1.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ab8a0d3b3acda34777ef241c2a7e9e7b9722548e0dcfb1d8ca0a7dd670e57fa5
MD5 55fac45c3f8f269234828b72ea21d252
BLAKE2b-256 ab08a6b2182e8716fd171c24528ea4390f04c4bbd65d08a021a881c6397c2ec9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 587.3 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.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 af95e98f78126c62d36b87d30e333f8488e9f43f928c5cd6544a79ce757e5479
MD5 510cbe2cf62131a85470741ed7ee13db
BLAKE2b-256 2ae5c18637853c34e9d397ffcec121dbe9d7a74453cd0ef665afb62a7b0ac14a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.0-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.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 24d771cbc21aa74999af3602fc6e304fdea9f4910154fdb04060530a2e3163da
MD5 d009ab38f2816832e669eb7b01944b74
BLAKE2b-256 593477682a151589b03bfbb6fa4e3e332d15eb066c476bf372bd035b25f06389

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.0-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 427.1 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.32.2 CPython/3.6.7

File hashes

Hashes for muarch-0.1.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 1d24547fa83f1f57bb8a1347bf77598d03eefe236b4e9516cd948717265a9044
MD5 fd43e9c508b41c3717b5dd1306cc313b
BLAKE2b-256 5af6112a1f99ad7705954c6f1aed3740d931853dbc7599a848f049f4a30b0369

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