Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ compiled C engine.

## Unreleased

**`-deseason` is the C's again (BUG-0003).** The port had moved to Box-Cox →
d=1 → deseasonalization in 0.2.0; the C of record now does the same
(atsw-gui `engines/drvarma` BUG-0010). On the seven full-sample `-deseason`
cases of the C's battery the port gives its log-likelihood, iterations,
estimates and forecast table line for line (`tests/test_deseason_as_the_c.py`).

**`-estwin` estimates on the window, as the C (BUG-0034).** The port fitted
the whole sample for the `.out` and the `.forecast` and only the
`.recursive` used the window. Now `estimate_w(estwin=)` (both engines) takes
the start from all the data and the likelihood on the window, `Model(estwin=)`
estimates the seasonal dummies there too, and the three files come from that
one fit, as the C's.

**`-diagar -diagcov` writes its `.out` (BUG-0035).** The Wald blocks indexed
the full AR matrices and the CLI died with an IndexError.

With both, all 11 `-deseason` cases of the C's battery are the C's.

**One abi3 wheel per platform, for every CPython from 3.10 on (BUG-0031).**
The binary wheels were per minor version and stopped at cp314; on CPython
3.15 pip took the pure wheel and every fit ran on the port. Now the wheel is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
id: BUG-0003
title: The seasonal component is estimated and subtracted in LEVELS, before the Box-Cox log, so a multiplicative pattern on a trending index is adjusted at the wrong scale
status: in-progress
status: fixed
severity: medium
component: deseason
found_in: 0.1.3
fixed_in: 0.2.0 (Python; the C pending)
fixed_in: 0.2.0 (Python); the C, atsw-gui engines/drvarma BUG-0010 (2026-11-28)
reported: 2026-07-28
reporter: David / ejercicio de pass-through del petróleo
tags:
Expand Down Expand Up @@ -165,3 +165,27 @@ escrito en `deseason.py` y en `Model._prepare`. Si el C se rehace en la rama
drvarma-v5 (junto con BUG-0001, la fase), el orden a implementar es
log → d=1 → desestacionalización.


## The C (2026-11-28)

The C does the same now (atsw-gui `engines/drvarma` BUG-0010): Box-Cox →
d=1 → deseasonalization, the dummies on the Box-Cox scale without the
rescale factor, and the forecasts, their bands and the recursive forecasts
re-seasonalized there. Its battery's 11 `-deseason` cases were regenerated;
no other case moved.

- `tests/test_deseason_as_the_c.py`: the battery's seven full-sample
`-deseason` cases. With the compiled engine the port gives the C's
log-likelihood, iterations, estimates and forecast table, line for line.
The fdhess standard errors are not compared: at these optima they move by
up to 2.5 % with a perturbation of the data of 1e-13, which is the size of
the difference between GSL's and numpy's least squares in the harmonic
regression.
- Left out, and recorded: the `-estwin` cases (BUG-0034) and the
`-diagar -diagcov` cases (BUG-0035), where the port's CLI differs from the
C's with or without `-deseason`.
- The tests against the frozen 0.4.1 (`tests/_bug0003.py`) stay
`xfail(strict=True)`: that program is frozen and deseasonalizes in levels.
- Still different, outside this bug: the `auto` decision. The port asks
art's HAC F (art BUG-0206); the C, the OLS F. They agree on the battery's
cases.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
id: BUG-0034
title: With -estwin the port's .out and .forecast are the full-sample fit; the C's are the estimation window's
status: fixed
severity: medium
component: cli
found_in: 0.3.4
fixed_in: unreleased (after 0.3.4)
reported: 2026-11-28
reporter: Claude — homologating -deseason with the C (BUG-0003)
tags: [inp-path, estwin, homologation]
references:
- bugs/BUG-0034-repro/repro.py
- src/drvarma/cli.py (the -estwin branch)
- atsw-gui engines/drvarma tests/banco (c4_wti_es_estwin, g1_ipc3_ext_diag, pt_de_ext_diag)
---

## Summary

With `-estwin N` the C (atsw-gui `engines/drvarma`) estimates the model on the
first N raw observations and writes that fit in the `.out`, forecasts from it
and writes the fixed-parameter recursive forecasts. The port's CLI fits the
whole sample for the `.out` and the `.forecast`; only its `.recursive` uses
the window.

## Impact

Medium, on the deprecated `.inp` path only (the ladder has no `-estwin`). The
`.out` of an out-of-sample exercise is not the model the recursive forecasts
come from, and it is not the C's.

## Reproduction

`python3 bugs/BUG-0034-repro/repro.py` (exits 1 while open). WTI_IPC_ES_ext,
`1 0 -mean -forecast 24 -estwin 216`: the C, logL −929.72669923 on 215
observations; the port, −1211.144352 on 262.

## Root cause

`cli.py` fits `Model` on the whole series and passes `-estwin` only to
`write_recursive`.

## Fix

Fit on the window when `-estwin` is given, as the C, and take the `.out` and
the `.forecast` from that fit. Then add the battery's three `-estwin` cases to
`tests/test_deseason_as_the_c.py` / `tests/test_inp_path_as_the_c.py`.

## Validation

The repro exits 0; the three `-estwin` cases of the C's battery give its
numbers.

## Resolution (2026-11-28)

As the C: `estimate_w(estwin=)` takes the start from all of `w` and the
likelihood on the window (the binding's `g_estwin`, there since the copy of
`drvarma.c` but always 0; the pure-Python estimator the same), and returns the
window's residuals. `Model(estwin=)` estimates the seasonal dummies on the
window too, the `.forecast` goes from the end of the sample with the window's
parameters (residuals zero past it), and the `.recursive` comes from the same
fit, as the C's writer. The three `-estwin` cases of the C's battery give its
log-likelihood, iterations, estimates and forecast table line for line, and
its recursive forecasts to the sixth decimal (`tests/test_deseason_as_the_c.py`).
The pure-Python estimator reaches the C's logL too (−929.726699 on the
repro's case).
Loading
Loading