Conversation
Implement the Fractionally Integrated Asymmetric Power ARCH model, extending FIGARCH with an asymmetry parameter (gamma) and a flexible power parameter (delta). Includes Python and Cython recursions, FIAPARCHUpdater for ARCH-in-mean support, simulation and forecasting, arch_model integration via vol="fiaparch", and comprehensive tests. Made-with: Cursor
Made-with: Cursor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #833 +/- ##
==========================================
+ Coverage 99.53% 99.56% +0.03%
==========================================
Files 78 78
Lines 15817 16694 +877
Branches 1294 1367 +73
==========================================
+ Hits 15743 16622 +879
+ Misses 39 38 -1
+ Partials 35 34 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| raise ValueError("o must be either 0 or 1.") | ||
| if self._truncation <= 0: | ||
| raise ValueError("truncation must be a positive integer") | ||
| self._num_params = 2 + p + q + o + int(self._est_delta) |
| if self._truncation <= 0: | ||
| raise ValueError("truncation must be a positive integer") | ||
| self._num_params = 2 + p + q + o + int(self._est_delta) | ||
| self._name = self._generate_name() |
| return sigma2 | ||
|
|
||
|
|
||
| fiaparch_recursion = jit(fiaparch_recursion_python, nopython=True) |
There was a problem hiding this comment.
fiaparch_recursion is consumed by volatility.py through the rec alias
There was a problem hiding this comment.
Pull request overview
Adds the Fractionally Integrated Asymmetric Power ARCH (FIAPARCH) volatility process and wires it into the high-level arch_model API, including recursions/updaters and unit tests.
Changes:
- Implement
FIAPARCHvolatility process (variance recursion, simulation, forecasting, constraints/bounds, parameter naming). - Add Cython + Python (Numba) recursions and
FIAPARCHUpdaterfor ARCH-in-mean compatibility. - Integrate
vol="fiaparch"intoarch_modeland add targeted tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
arch/univariate/volatility.py |
Adds the FIAPARCH volatility process implementation and hooks it to recursion/updater code. |
arch/univariate/recursions.pyx |
Adds the Cython FIAPARCH recursion and volatility updater. |
arch/univariate/recursions.pyi |
Exposes typing for the new recursion and updater. |
arch/univariate/recursions_python.py |
Adds the Python/Numba FIAPARCH recursion and updater implementation. |
arch/univariate/mean.py |
Enables arch_model(..., vol="fiaparch") selection. |
arch/univariate/__init__.py |
Exports FIAPARCH at package level. |
arch/tests/univariate/test_volatility.py |
Adds unit tests for FIAPARCH recursion, updater, simulation, and parameterization variants. |
arch/tests/univariate/test_mean.py |
Tests arch_model integration for vol="fiaparch". |
Comments suppressed due to low confidence (2)
arch/univariate/mean.py:2004
arch_modelnow acceptsvol="fiaparch"(viaknown_vol), but the function signature type annotation and docstring list of supported volatility models still omit FIAPARCH. This makes the public API docs/type checking inconsistent with runtime behavior. Update thevol: Literal[...]annotation and the docstring’s supported options to include FIAPARCH (and keep casing/aliases consistent with the existing options).
known_mean = ("zero", "constant", "harx", "har", "ar", "arx", "ls")
known_vol = (
"arch",
"figarch",
"fiaparch",
"aparch",
"garch",
"harch",
"constant",
"egarch",
)
arch/univariate/mean.py:2045
- The
p-type validation checksvol(original input) against a lowercase tuple. This meansarch_model(..., vol="FIAPARCH")(or other uppercase variants) won’t trigger the intendedTypeErrorwhenpis not anint, and will instead fail later via anassert isinstance(p, int)branch. Usevol_model(the lowercased value) in this condition to make validation case-insensitive and avoidAssertionErrorfor user input.
if vol in ("arch", "garch", "figarch", "fiaparch", "egarch", "aparch") and not isinstance(
p, int
):
raise TypeError(
"p must be a scalar int for all volatility processes except HARCH."
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I've only just skimmed and it looks good on first pass. Any chance you could hit edge cases that are missed in coverage? |
Thanks! @bashtage Let me resolve the comments and think more on the edge cases. |
- Add FIAPARCH to arch_model vol parameter type hint and docstring - Fix delta assignment bug in FIAPARCH.__init__ (used raw delta instead of self._delta for range check, then reassigned) - Fix arch_model using `vol` instead of `vol_model` for p type check - Parametrize updater-vs-recursion test over o and delta - Add tests for no-beta/no-asym compute_variance, simulation, backcast_transform, fixed-delta str, and high-persistence warnings - Include FIAPARCH in forecast test volatilities list Made-with: Cursor
Fix bug using vol_model instead of vol in arch_model type check. Add tests for FIAPARCH with reduced p, o, q combinations including forecasting, simulation, parameter names, and backcast_transform. Made-with: Cursor
Cover the two partial-coverage lines flagged by Codecov (q=0 branch in fiaparch_recursion_python, persistence >= 1 simulation path) and exercise additional edge cases: p=0/q=0 recursion, updater buffer reuse, and compute_variance sigma_delta reuse. Made-with: Cursor
The `if persistence < 1` guard is unnecessary since the test parameters always yield persistence < 1. The persistence >= 1 case is already covered by dedicated tests. Made-with: Cursor
Made-with: Cursor
Matches the Cython updater so pickle round-tripping works when the extension is not built (e.g. ARCH_NO_BINARY CI), fixing test_fiaparch_updater_reduce_setstate. Made-with: Cursor
Implements the Fractionally Integrated Asymmetric Power ARCH (FIAPARCH) volatility model, partially addressing #531
FIAPARCH extends FIGARCH with an asymmetry parameter (gamma) and a flexible power parameter (delta). Includes Python/Cython recursions, FIAPARCHUpdater for ARCH-in-mean support, arch_model(..., vol="fiaparch") integration, and tests.