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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

armagarch-1.0.4-py3-none-any.whl (43.4 kB view hashes)

Uploaded Python 3

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