Skip to main content

archette

GARCH is a minimal implementation of the GARCH(1,1) model with zero mean and Gaussian noise.

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/xiaochuany/archette.git

Documentation

Documentation can be found hosted on this GitHub repository’s pages.

How to use

import numpy as np
from archette import GARCHETTE
y = np.random.randn(20)
mod = GARCHETTE()
mod.fit(y)
<archette.core.GARCHETTE>

One can get inspect the fit params: a triplet of omega, alpha and beta as in

$$ \begin{align*} Y_t &= \sigma_t W_t \ \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \end{align*} $$

mod.params
array([1.46162489e+00, 0.00000000e+00, 4.34165554e-16])

The conditional variance of the fit model is computed by the recursion

$$ \hat{\sigma}t^2 = \hat{\omega} + \hat{\alpha} + \hat{\beta} \hat{\sigma}{t-1}^2 $$

which depends entirely on the unobserved $\sigma_0^2$. The model sets a sensible default value for it.

mod.vs
array([1.6637509 , 1.46162489, 1.46162489, 1.46162489, 1.46162489,
       1.46162489, 1.46162489, 1.46162489, 1.46162489, 1.46162489,
       1.46162489, 1.46162489, 1.46162489, 1.46162489, 1.46162489,
       1.46162489, 1.46162489, 1.46162489, 1.46162489, 1.46162489])

The standardised residual is deduced from the conditional variance

$$ r_t = \frac{y_t}{\hat{\sigma}_t} $$

mod.std_resids
array([ 1.83606806,  0.40202783, -0.05913285, -0.47174874, -0.59056739,
       -2.20575562,  0.71528908,  0.26541164, -0.20129438,  1.33214741,
       -0.50849529,  0.2951227 , -0.84969512,  1.53542218,  0.44267321,
       -1.95023795, -1.68947028, -0.23377285, -0.18693467,  0.7959041 ])

Finally, one can forecast the condtional variance and simulate the process with the fit parameters with a given horizon

mod.forecast_vs(horizon=5)
array([1.46162489, 1.46162489, 1.46162489, 1.46162489, 1.46162489])
mod.simulate(horizon=5, method="bootstrap", n_rep=2, seed=1)
array([[-2.66670736,  0.35679649, -1.02726169, -0.24336023,  1.61053531],
       [ 0.35679649, -2.66670736, -2.35779243,  2.21976368, -2.04253036]])

Metadata

Release files for archette 0.1.1

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

Source distribution (sdist)

Source distribution for archette 0.1.1
File Size Uploaded Provenance
archette-0.1.1.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for archette 0.1.1
File Interpreter ABI Platform
archette-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / archette-0.1.1.tar.gz

Download URL archette-0.1.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4b9296aaaa9919823824103450c30714ce0c76ba30fd268fb366c60ac43b0589
BLAKE2b-256 checksum
How to use checksums
e015ca08b209cfeda5b26e73e83e313a1b04db0c957bb605106b03895da54b92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.29

Release files / archette-0.1.1-py3-none-any.whl

Download URL archette-0.1.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3763b31badb0d432e6e6273bc8618cf366b0b7d47a984ea38399df0fd169e593
BLAKE2b-256 checksum
How to use checksums
ad3a259ea36e271427e831c071ee0860e074b0b1ff40d338c1a7cf9e82abdcdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.29

Security for archette 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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