arch: ARCH for Python

repository·main·Indexed 23 days ago

https://github.com/bashtage/arch

A Python library for financial econometrics specializing in Autoregressive Conditional Heteroskedasticity (ARCH) models and volatility modeling. Core capabilities include univariate volatility models (GARCH, TARCH, EGARCH, EWMA), unit root tests (ADF, Phillips-Perron, KPSS), cointegration analysis, long-run covariance estimation using HAC kernels like Bartlett, and various bootstrap methods (IID, Stationary, Circular Block, Moving Block) for confidence interval construction.

Tokens
22.4K
Snippets
45
Records
140
Agent score
81%

What's inside arch

  1. Overview of arch capabilities

    main

    The arch library is a specialized toolkit for financial econometrics in Python. Its core capabilities include:

    • Volatility Modeling: Univariate models including ARCH, GARCH, TARCH, EGARCH, and EWMA/RiskMetrics, with support for various mean models and error distributions.
    • Unit Root Tests: Tests for stationarity such as Augmented Dickey-Fuller, Phillips-Perron, KPSS, and Zivot-Andrews.
    • Cointegration Analysis: Testing for cointegration (Engle-Granger, Phillips-Ouliaris) and estimating cointegration vectors (DOLS, FMOLS).
    • Bootstrapping: Various block bootstrap methods for covariance estimation and confidence interval construction.
    • Multiple Comparison Procedures: Tools like Model Confidence Set (MCS) and Test of Superior Predictive Ability (SPA).
    • Long-run Covariance Estimation: Kernel-based estimators like the Bartlett (Newey-West) kernel.
  2. Overview of the arch.bootstrap module

    main
    The arch.bootstrap module provides high-level and low-level interfaces for bootstrapping data. It supports data contained in NumPy arrays, pandas Series, or pandas DataFrames. All bootstrap methods in this module share a consistent interface, differing only in their specific names, setup parameters, and internal sampling schemes.
  3. Overview of the ARCH toolbox capabilities

    main

    The arch package is a Python toolbox designed for financial data analysis. It provides specialized routines for modeling volatility, statistical testing, and resampling methods.

    Key capabilities include:

    • Univariate volatility models: Modeling time-varying volatility in single time series.
    • Bootstrapping: Resampling methods for statistical inference.
    • Multiple comparison procedures: Adjusting for multiple testing problems.
    • Unit root tests: Testing for stationarity in time series.
    • Cointegration Testing and Estimation: Analyzing long-term relationships between non-stationary series.
    • Long-run covariance estimation: Estimating covariance matrices for time series data.
  4. Perform Cointegration Analysis and Vector Estimation

    main

    The arch.unitroot module extends single-series testing to multiple series via cointegration testing and cointegrating vector estimation.

    Cointegration Testing

    Use these to test for the existence of a cointegrating relationship between multiple series:

    • arch.unitroot.cointegration.engle_granger (Engle-Granger Test)
    • arch.unitroot.cointegration.phillips_ouliaris (Phillips-Ouliaris Tests)

    Cointegrating Vector Estimation

    Use these to estimate the cointegrating vector once a relationship is identified:

    • arch.unitroot.cointegration.DynamicOLS (Dynamic OLS)
    • arch.unitroot.cointegration.FullyModifiedOLS (Fully Modified OLS)
    • arch.unitroot.cointegration.CanonicalCointegratingReg (Canonical Cointegrating Regression)
  5. Specify univariate volatility models with arch.univariate

    main

    The arch.univariate module provides two ways to specify univariate volatility models:

    1. High-level API: Use arch_model to quickly specify a model by providing the data and model type. This is the recommended approach for most users.
    2. Low-level API: Use specific mean and volatility model methods (detailed in the mean-models section) for more granular control over model specification.

    Once a model is specified, you can generate forecasts using:

    • Analytical methods: When the model is mathematically tractable.
    • Simulation-based methods: Using Monte Carlo simulation or residual Bootstrap.
  6. Perform Unit Root Tests with arch.unitroot

    main

    The arch.unitroot module provides several statistical tests to check for the presence of a unit root in a time series. These tests help determine if a series is stationary or non-stationary.

    Available test implementations include:

    • ADF: Augmented Dickey-Fuller test.
    • DFGLS: Dickey-Fuller GLS test.
    • PhillipsPerron: Phillips-Perron test.
    • ZivotAndrews: Zivot-Andrews test (for structural breaks).
    • VarianceRatio: Variance ratio test.
    • KPSS: Kwiatkowski-Phillips-Schmidt-Shin test.
  7. Perform Unit Root Testing with arch.unitroot

    main

    The arch.unitroot module provides routines to determine if a time series is stationary or contains a unit root.

    Most tests in this module (ADF, DFGLS, Phillips-Perron, and Zivot-Andrews) assume a null hypothesis of a unit root and an alternative of a stationary process.

    However, the KPSS test is an exception: it assumes a null hypothesis of a stationary process with an alternative of a unit root.

  8. Use the bootstrap framework in ARCH v1.1

    main

    Version 1.1 introduced a general-purpose bootstrap framework. You can interact with this framework in two ways:

    1. High-level functions: Use functions like conf_int (for confidence intervals) or cov (for covariance estimation) which utilize the bootstrap framework internally.
    2. Low-level iteration: Use the bootstrap function directly as an iterator for custom bootstrap procedures.