# 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
### From PyPI (recommended)
```bash
pip install garch11_ged
```
### From Source
```bash
git clone https://github.com/yourusername/garch11_ged.git
cd garch11_ged
pip install .
```
### Development Installation
```bash
git clone https://github.com/yourusername/garch11_ged.git
cd garch11_ged
pip install -e ".[dev]"
```
## Quick Start
```python
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
```python
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
```python
# 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:
```python
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](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:
```bibtex
@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.
Raw data
{
"_id": null,
"home_page": "https://github.com/yourusername/garch11_ged",
"name": "garch11-ged",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "Your Name <your.email@example.com>",
"keywords": "garch, volatility, financial-modeling, time-series, econometrics",
"author": "Your Name",
"author_email": "Your Name <your.email@example.com>",
"download_url": "https://files.pythonhosted.org/packages/a9/36/b2fe7cb2fbcfccba22189cc487aee86f143eb6deb885c8a12c3bdc9dc1e1/garch11_ged-0.1.0.tar.gz",
"platform": null,
"description": "# GARCH(1,1) with GED Innovations\n\nA fast C++ implementation of GARCH(1,1) model with Generalized Error Distribution (GED) innovations, with Python bindings via pybind11.\n\n## Features\n\n- **Fast C++ Implementation**: Core algorithms implemented in C++ for optimal performance\n- **GED Innovations**: Support for Generalized Error Distribution for heavy-tailed financial returns\n- **Easy Python Interface**: Simple and intuitive Python API similar to popular packages like `arch`\n- **Comprehensive Output**: Get fitted volatilities, residuals, forecasts, and model statistics\n- **Parameter Validation**: Built-in parameter constraints and stationarity checks\n\n## Installation\n\n### From PyPI (recommended)\n\n```bash\npip install garch11_ged\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/yourusername/garch11_ged.git\ncd garch11_ged\npip install .\n```\n\n### Development Installation\n\n```bash\ngit clone https://github.com/yourusername/garch11_ged.git\ncd garch11_ged\npip install -e \".[dev]\"\n```\n\n## Quick Start\n\n```python\nimport numpy as np\nimport garch11_ged\n\n# Generate sample return data\nnp.random.seed(42)\nreturns = np.random.normal(0, 0.01, 1000)\n\n# Fit GARCH(1,1) model with GED innovations\nmodel = garch11_ged.GARCH11_GED()\nmodel.fit(returns)\n\n# Print model summary\nprint(model.summary())\n\n# Get parameter estimates\nparams = model.parameters\nprint(f\"Parameters: {params}\")\n\n# Get fitted volatilities\nvolatilities = model.volatilities\n\n# Forecast volatility\nforecast = model.predict_volatility(horizon=10)\nprint(f\"10-step forecast: {forecast}\")\n```\n\n## API Reference\n\n### GARCH11_GED Class\n\n#### Constructor\n\n```python\nmodel = garch11_ged.GARCH11_GED()\nmodel = garch11_ged.GARCH11_GED(mu, omega, alpha, beta, nu)\n```\n\n#### Methods\n\n- `fit(returns, max_iter=1000, tolerance=1e-6)`: Fit the model to data\n- `predict_volatility(horizon=1)`: Forecast volatility\n- `get_parameters()`: Get parameter estimates [mu, omega, alpha, beta, nu]\n- `get_volatilities()`: Get fitted conditional volatilities\n- `get_residuals()`: Get fitted residuals\n- `get_standardized_residuals()`: Get standardized residuals\n- `get_log_likelihood()`: Get log-likelihood value\n- `get_aic()`: Get AIC (Akaike Information Criterion)\n- `get_bic()`: Get BIC (Bayesian Information Criterion)\n- `summary()`: Get detailed model summary\n\n#### Properties\n\n- `parameters`: Model parameters\n- `volatilities`: Fitted volatilities\n- `residuals`: Fitted residuals\n- `standardized_residuals`: Standardized residuals\n- `log_likelihood`: Log-likelihood value\n- `aic`: AIC value\n- `bic`: BIC value\n- `fitted`: Whether model is fitted\n\n### Convenience Functions\n\n```python\n# Fit model in one line\nmodel = garch11_ged.fit_garch(returns)\n```\n\n## Model Specification\n\nThe GARCH(1,1) model with GED innovations is specified as:\n\n**Mean Equation:**\n```\nr_t = \u03bc + \u03b5_t\n```\n\n**Variance Equation:**\n```\n\u03c3\u00b2_t = \u03c9 + \u03b1\u00b7\u03b5\u00b2_{t-1} + \u03b2\u00b7\u03c3\u00b2_{t-1}\n```\n\n**Innovation Distribution:**\n```\n\u03b5_t | F_{t-1} ~ GED(0, \u03c3_t, \u03bd)\n```\n\nWhere:\n- `\u03bc` is the mean return\n- `\u03c9 > 0` is the constant term\n- `\u03b1 \u2265 0` is the ARCH parameter\n- `\u03b2 \u2265 0` is the GARCH parameter \n- `\u03b1 + \u03b2 < 1` for stationarity\n- `\u03bd > 0` is the GED shape parameter\n\n## Performance\n\nThis implementation is significantly faster than pure Python implementations:\n\n```python\nimport time\nimport numpy as np\n\n# Generate large dataset\nreturns = np.random.normal(0, 0.01, 10000)\n\n# Time the fitting\nstart_time = time.time()\nmodel = garch11_ged.GARCH11_GED()\nmodel.fit(returns)\nend_time = time.time()\n\nprint(f\"Fitting time: {end_time - start_time:.3f} seconds\")\n```\n\n## Requirements\n\n- Python \u2265 3.7\n- NumPy \u2265 1.17.0\n- C++14 compatible compiler\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Citation\n\nIf you use this package in your research, please cite:\n\n```bibtex\n@software{garch11_ged,\n title={GARCH(1,1) with GED Innovations},\n author={Your Name},\n year={2024},\n url={https://github.com/yourusername/garch11_ged}\n}\n```\n\n## Acknowledgments\n\nThis implementation is based on the GARCH modeling framework from the rugarch R package by Alexios Ghalanos.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Fast GARCH(1,1) with GED innovations implementation in C++",
"version": "0.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/yourusername/garch11_ged/issues",
"Documentation": "https://github.com/yourusername/garch11_ged#readme",
"Homepage": "https://github.com/yourusername/garch11_ged",
"Repository": "https://github.com/yourusername/garch11_ged.git"
},
"split_keywords": [
"garch",
" volatility",
" financial-modeling",
" time-series",
" econometrics"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a936b2fe7cb2fbcfccba22189cc487aee86f143eb6deb885c8a12c3bdc9dc1e1",
"md5": "f9e07a7e95a44eb0a50cd85ac0bf1ffa",
"sha256": "d7155d16f90835598f4d7f144808a44ea586cdbd2c22dc2acb70e61344af38b3"
},
"downloads": -1,
"filename": "garch11_ged-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "f9e07a7e95a44eb0a50cd85ac0bf1ffa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 33853,
"upload_time": "2025-07-18T03:28:44",
"upload_time_iso_8601": "2025-07-18T03:28:44.790620Z",
"url": "https://files.pythonhosted.org/packages/a9/36/b2fe7cb2fbcfccba22189cc487aee86f143eb6deb885c8a12c3bdc9dc1e1/garch11_ged-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-18 03:28:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "garch11_ged",
"github_not_found": true,
"lcname": "garch11-ged"
}