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

Uploaded Source

Built Distributions

muarch-0.1.3-cp37-cp37m-win_amd64.whl (600.5 kB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

muarch-0.1.3-cp37-cp37m-macosx_10_9_x86_64.whl (430.5 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

muarch-0.1.3-cp36-cp36m-win_amd64.whl (600.5 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

muarch-0.1.3-cp36-cp36m-macosx_10_7_x86_64.whl (432.5 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: muarch-0.1.3.tar.gz
  • Upload date:
  • Size: 602.2 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.3.tar.gz
Algorithm Hash digest
SHA256 e8087c99a19a2f346d6c41f7ff99eaf002eb58c634958fcd364f129c2ebcc07b
MD5 7500de4a9e93cefa420109b508f06426
BLAKE2b-256 ccda45cd4f18c4a4513ad86d1f89c1740b38b6781dad34f561522afff39b5ebe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 600.5 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.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b467f6a74a2991d6a3a0fa16692994655de24c8432a9fcbdeaf91c320841ed76
MD5 55ab37815b3e5df005268fa6dda8fc47
BLAKE2b-256 dfde9ef28925f219a51143d8b9a95685cb0182209990a281c4a1fe86221947a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.3-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.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 553c52a5817fb52ece1f1dfa5937a77de7b8e38aea0fe238cbb35c6b3be1b529
MD5 334f9887b21be5f547e8afee821d47d3
BLAKE2b-256 9284f3032399ef201c4b3f6bddcadba95f50ad2300ef40fa9cd3b34d9a130b4a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.3-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 430.5 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.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 624fa9154499cbcf1bcf3da07e6701229b813b21427ab9bbc955b3a8da32c87d
MD5 22d893416fdfae84944af1b0251a1652
BLAKE2b-256 c944ee39d148c8dd75ac6173322def27c1f04840a0e79f63efa7d532dcf1f7b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 600.5 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.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 576ad4839db5e86dcfd81e162ebaaa3d44e78fdf4f3289d249e94087960ee8b7
MD5 0c9a5ec266b6ac0be084df62e864b2e1
BLAKE2b-256 c1e69c763d3d35eb64417fc065f7f416a075b1b6db90545246ab24309c8e2f54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.3-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.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c12be37a433f137315eb02c67ed1278785a7b6dec315e6e0ca16346b750d7dd9
MD5 f81c2936bd73bce1c051ae6dec42a752
BLAKE2b-256 fdb1c16220d7621f2f6e74e6ac5a809934d7d46d7b858353c5a96bd4bb2bf49c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: muarch-0.1.3-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 432.5 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.3-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 db34105252395308713050e187120d9dc22de28146ffe052f34410575d9eff70
MD5 c8ee54fcd500581dc43172497a94883a
BLAKE2b-256 a624f7ce7ad77e9e2b01706c3263090326a88994a0f86a8e3337151c74c4572f

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