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

Uploaded Source

Built Distributions

muarch-0.2.2-cp38-cp38-win_amd64.whl (432.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

muarch-0.2.2-cp38-cp38-manylinux1_x86_64.whl (916.0 kB view details)

Uploaded CPython 3.8

muarch-0.2.2-cp37-cp37m-win_amd64.whl (431.6 kB view details)

Uploaded CPython 3.7m Windows x86-64

muarch-0.2.2-cp37-cp37m-manylinux1_x86_64.whl (907.2 kB view details)

Uploaded CPython 3.7m

File details

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

File metadata

  • Download URL: muarch-0.2.2.tar.gz
  • Upload date:
  • Size: 436.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for muarch-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e81649e7eef494d9a10e20db6f87cc4edf45b19076ec5334bfd250881cb8636f
MD5 a362f9214b2ec0de819d7f70b5058bd8
BLAKE2b-256 ad33c6becec25f5783e34305efd2377de0f652623fec1cde2401cb1f6a9928bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.2.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 432.5 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/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for muarch-0.2.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 6687ee7e9e2ddabbb0d2f580df107aa971784c3c106d3edb6bb625b37a953c4f
MD5 69041aec927aadd675dfb668df6a6cc0
BLAKE2b-256 e80eae596486bcc4344ed3ef165e044345de83fcf43c29a35c35d8acb8ea3e5a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.2.2-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 916.0 kB
  • 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/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for muarch-0.2.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a16b95da7c2c7bd98f37fc0f855d9ccd0011504cc387022073dfcad11c8ccee7
MD5 2fbca162bb9917c6cdb15a200cd4b762
BLAKE2b-256 7e0651acca595647d0ccdb0fc23944103f91da0ce175d8c112f4c904df3dd873

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.2.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 431.6 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for muarch-0.2.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b687fd9ef04ab9fcd1917de249c536e92e812d174d3d668ff6e60cc1b9a16678
MD5 9bde79c02e1aacf5e03ee5011a96da8a
BLAKE2b-256 ea386ccc0fa635ec9927dfb53b6c1f71b363be25bae41ff34a0194225458a623

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.2.2-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 907.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for muarch-0.2.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4236436f7ab6aca26304aba06cc455f0499e26bb3f41fc6fce6a379d357d037d
MD5 6d81256386ecf5e7ccb5ccd5ff26b1c1
BLAKE2b-256 90eb0cf6b1b4cb2420eb42788d892c6b6204d62ce5978765e628d352bd293492

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