Skip to main content

Library for flexible mean and volatility modelling

Project description

armagarch package

The package provides a flexible framework for modelling time-series data. The main focus of the package is implementation of the ARMA-GARCH type models.

Full documentation is coming soon.

Installation

The latest stable version can be installed by using pip

pip install armagarch

The master branch can be installed with

git clone https://github.com/iankhr/armagarch
cd armagarch
python setup.py install

Example: Modelling conditional volatility of the US excess market returns

The code requires: NumPy, Pandas, SciPy, Shutil, Matplotlib, Pandas_datareader and Statsmodels

import armagarch as ag
import pandas_datareader as web
import matplotlib.pyplot as plt
import numpy as np

# load data from KennethFrench library
ff = web.DataReader('F-F_Research_Data_Factors_daily', 'famafrench')
ff = ff[0]

# define mean, vol and distribution
meanMdl = ag.ARMA(order = {'AR':1,'MA':0})
volMdl = ag.garch(order = {'p':1,'q':1})
distMdl = ag.normalDist()

# create a model
model = ag.empModel(ff['Mkt-RF'].to_frame(), meanMdl, volMdl, distMdl)
# fit model
model.fit()

# get the conditional mean
Ey = model.Ey

# get conditional variance
ht = model.ht
cvol = np.sqrt(ht)

# get standardized residuals
stres = model.stres

# make a prediction of mean and variance over next 3 days.
pred = model.predict(nsteps = 3)

# pred is a list of two-arrays with first array being prediction of mean
# and second array being prediction of variance

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

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

armagarch-1.0.2.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

armagarch-1.0.2-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file armagarch-1.0.2.tar.gz.

File metadata

  • Download URL: armagarch-1.0.2.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for armagarch-1.0.2.tar.gz
Algorithm Hash digest
SHA256 efd13f4787187c1d0f868fbbba5a0e6667b11c8c4282036dc0b08802f0fe5c23
MD5 48cb7a4c737a1b38384f632669b2db62
BLAKE2b-256 240b419d9e56df682fad92f91c32ba6cc47d82b3a08770e9ca78f8a3c7166a99

See more details on using hashes here.

File details

Details for the file armagarch-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: armagarch-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for armagarch-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4941457127534079d24cdeced2491774e37e8bb3a817f121c0d948fab899176d
MD5 719ecbbdb4652efa69a2626c557d4496
BLAKE2b-256 eb87f76b90f201acf322c6679d84138f8831326962ff45daa48bd265a99c7427

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page