Skip to main content

GARCH(1,1) with GED Innovations

A fast C++ implementation of GARCH(1,1) model with Generalized Error Distribution (GED) innovations, with Python bindings via pybind11.

Features

  • Fast C++ Implementation: Core algorithms implemented in C++ for optimal performance
  • GED Innovations: Support for Generalized Error Distribution for heavy-tailed financial returns
  • Easy Python Interface: Simple and intuitive Python API similar to popular packages like arch
  • Comprehensive Output: Get fitted volatilities, residuals, forecasts, and model statistics
  • Parameter Validation: Built-in parameter constraints and stationarity checks

Installation

pip install garch11_ged

From Source

git clone https://github.com/yourusername/garch11_ged.git
cd garch11_ged
pip install .

Development Installation

git clone https://github.com/yourusername/garch11_ged.git
cd garch11_ged
pip install -e ".[dev]"

Quick Start

import numpy as np
import garch11_ged

# Generate sample return data
np.random.seed(42)
returns = np.random.normal(0, 0.01, 1000)

# Fit GARCH(1,1) model with GED innovations
model = garch11_ged.GARCH11_GED()
model.fit(returns)

# Print model summary
print(model.summary())

# Get parameter estimates
params = model.parameters
print(f"Parameters: {params}")

# Get fitted volatilities
volatilities = model.volatilities

# Forecast volatility
forecast = model.predict_volatility(horizon=10)
print(f"10-step forecast: {forecast}")

API Reference

GARCH11_GED Class

Constructor

model = garch11_ged.GARCH11_GED()
model = garch11_ged.GARCH11_GED(mu, omega, alpha, beta, nu)

Methods

  • fit(returns, max_iter=1000, tolerance=1e-6): Fit the model to data
  • predict_volatility(horizon=1): Forecast volatility
  • get_parameters(): Get parameter estimates [mu, omega, alpha, beta, nu]
  • get_volatilities(): Get fitted conditional volatilities
  • get_residuals(): Get fitted residuals
  • get_standardized_residuals(): Get standardized residuals
  • get_log_likelihood(): Get log-likelihood value
  • get_aic(): Get AIC (Akaike Information Criterion)
  • get_bic(): Get BIC (Bayesian Information Criterion)
  • summary(): Get detailed model summary

Properties

  • parameters: Model parameters
  • volatilities: Fitted volatilities
  • residuals: Fitted residuals
  • standardized_residuals: Standardized residuals
  • log_likelihood: Log-likelihood value
  • aic: AIC value
  • bic: BIC value
  • fitted: Whether model is fitted

Convenience Functions

# Fit model in one line
model = garch11_ged.fit_garch(returns)

Model Specification

The GARCH(1,1) model with GED innovations is specified as:

Mean Equation:

r_t = μ + ε_t

Variance Equation:

σ²_t = ω + α·ε²_{t-1} + β·σ²_{t-1}

Innovation Distribution:

ε_t | F_{t-1} ~ GED(0, σ_t, ν)

Where:

  • μ is the mean return
  • ω > 0 is the constant term
  • α ≥ 0 is the ARCH parameter
  • β ≥ 0 is the GARCH parameter
  • α + β < 1 for stationarity
  • ν > 0 is the GED shape parameter

Performance

This implementation is significantly faster than pure Python implementations:

import time
import numpy as np

# Generate large dataset
returns = np.random.normal(0, 0.01, 10000)

# Time the fitting
start_time = time.time()
model = garch11_ged.GARCH11_GED()
model.fit(returns)
end_time = time.time()

print(f"Fitting time: {end_time - start_time:.3f} seconds")

Requirements

  • Python ≥ 3.7
  • NumPy ≥ 1.17.0
  • C++14 compatible compiler

License

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Citation

If you use this package in your research, please cite:

@software{garch11_ged,
  title={GARCH(1,1) with GED Innovations},
  author={Your Name},
  year={2024},
  url={https://github.com/yourusername/garch11_ged}
}

Acknowledgments

This implementation is based on the GARCH modeling framework from the rugarch R package by Alexios Ghalanos.

Metadata

Release files for garch11-ged 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for garch11-ged 0.1.0
File Size Uploaded
garch11_ged-0.1.0.tar.gz 33.9 kB Details

Release files / garch11_ged-0.1.0.tar.gz

Download URL garch11_ged-0.1.0.tar.gz
Size 33.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d7155d16f90835598f4d7f144808a44ea586cdbd2c22dc2acb70e61344af38b3
BLAKE2b-256 checksum
How to use checksums
a936b2fe7cb2fbcfccba22189cc487aee86f143eb6deb885c8a12c3bdc9dc1e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page