Skip to main content

drvec

VARMA-VEC cointegration models by exact maximum likelihood (Mauricio 2006): a vector error-correction model whose short-run part is a full VARMA, not only a VAR, estimated by the exact Gaussian likelihood. drvec fits the model at a given cointegrating rank, tests the rank (the sequential LR test, with a parametric bootstrap), and writes the C program's reports: estimates and standard errors, the long run (alpha, beta, Pi), restrictions on alpha and beta with their LR tests, diagnostics, forecasts and impulse responses.

It is the Python port of the C program drvec of the ATSW suite (atsw-gui, engines/drvec), and the engine of its cointegrated systems: fue and art build each series' univariate model, drtran the transfer functions, drvarma and sima the stationary VARMA, and drvec the cointegrated system. The assistant that drives it is sima (sima-tseries).

Installation

pip install drvec

drvec's code is Python. What must be fast comes with binary wheels: drvarma (>= 0.3.0) brings the compiled exact VARMA likelihood (AS 311), its optimiser and GSL's eigensolvers, fue (>= 0.1.18) the reader and cast of the .pre files, and drvec's own wheels carry drvec C 0.13, the program the port mirrors, for the long bootstraps (below): Linux x86_64 and aarch64, macOS arm64 and Windows AMD64, with GSL linked in. Nothing to compile, and no system GSL needed. Python 3.10 or later. Elsewhere pip takes the pure-Python wheel, and the bootstraps run in Python.

Check that the compiled engine is in use:

python -c "import drvarma._engine as E, drvec._gsl as G; print(E.engine_backend(), G.backend())"
# c gsl
python -c "from drvec import c_engine; print(c_engine.find())"
# CBinary(path='.../site-packages/drvec/_bin/drvec', version='0.13', source='bundled')

A minimal example

drvec reads one fue .pre file per series: each series' univariate model (its Box-Cox, deterministic terms and ARMA), from which it takes the series in levels. Jenkins and Alavi's muskrat and mink (62 annual observations from 1850), with the files of the test suite: mmpre.muskrat.pre and mmpre.mink.pre.

import drvec

pre = ["mmpre.muskrat.pre", "mmpre.mink.pre"]

# the rank: sequential LR tests (add bootstrap=200 for the bootstrap p-values)
rt = drvec.rank_test(pre, p=1, q=0, case=2)
open("mmrank.out", "w").write(rt.out_text("mmrank"))   # the C program's .out

# a VAR(1)-VEC with one cointegrating relation, Johansen's case 2
r = drvec.fit(pre, p=1, q=0, r=1, case=2)
print(r.loglik)                       # -18.980152265473677
for p in r.params:
    print(f"{p.label:24s} {p.value:9.4f} {p.se:8.4f}")
open("mm.out", "w").write(r.out_text("mm"))

The same from the command line, with the C program's syntax and files:

drvec-py mmpre.muskrat.pre mmpre.mink.pre 1 0 1 -case 2 -name mm
drvec-py mmpre.muskrat.pre mmpre.mink.pre 2 0 1 -case 2 -lrtest -bootstrap 200
drvec-py -h

It is drvec-py and not drvec because drvec is the C program's name on a system with the ATSW suite.

The results as numbers

Everything the .out prints is also there as arrays, computed by the same routine that prints it (the suite checks that each equals the printed number):

r.alpha, r.beta, r.Pi, r.gamma, r.theta, r.Sigma   # in the files' order
r.residuals, r.stationary                          # Ybar's innovations and VARMA
r.level_irf(), r.fevd(), r.long_run()              # the responses in levels
r.diagnostics().hosking_p, r.diagnostics().jb_p    # the residual tests
r.forecasts(8).level                               # (H, M), in each series' units
r.restriction_lr                                   # an LR with its df, when restricted

The list, with the conventions, is in docs/API.md.

Long bootstraps: workers, and drvec C as the engine

A rank test with B = 999 on three series is hours of Python on one core. Two things make it affordable, and neither changes a number:

  • workers=: the replications are drawn in sequence, in the C's order, and refitted in a process pool. The default is DRVEC_WORKERS, else the cores less one; workers=1 runs in-process. The output is byte-identical whatever the number.
  • engine=: "auto" (the default) runs the bootstrap on drvec C 0.13 when it finds the binary -- DRVEC_BIN, then the one bundled in the wheel (drvec/_bin/drvec), then drvec on the PATH, then the ATSW install directory -- and on the parallel Python otherwise. The C's replications are read back into the same result objects; on Linux x86_64 the files are the same bytes. "python" and "c" force one or the other.
rt = drvec.rank_test(pre, p=2, q=0, case=2, bootstrap=999, boot_path="mm.boot",
                     progress=lambda b, rep: print(rep.h0, b, rep.status))
print(rt.provenance.engine, rt.provenance.version)   # c 0.13, or python 0.1.0

seed= gives another stream for a Monte Carlo check (always in Python: the C's generator is fixed at its seed); the default is the C's.

The C oracle and the platform convention

The port is homologated, case by case, against its oracle: the C program drvec 0.13 (atsw-gui commit ae95446; the bundled build is 800a540, with BUG-61 to BUG-64 fixed, -gzero and the I(1, r) check before the rank bootstrap, and the oracle files are that build's where it moves them (tests/data/oracle/SOURCE); its tag drvec-v0.13 comes with the suite's release). On these cases it is not "within tolerance" of the C: it is the same computation.

  • Exact on Linux x86_64, the oracle's platform: every number and every line of the .out, .boot, .forecast and .irfboot files is byte for byte the C's.
  • A tolerance tier elsewhere (Linux aarch64, macOS, Windows): the compiled likelihood and libm round the last bits differently, and the optimiser can amplify them on a flat likelihood. There the log-likelihood agrees to 1e-5 and the estimates to 1e-4, and every decision -- the winning start, the rank test's verdicts, the bootstrap's statuses and p-values -- must still be the C's.
  • Ill-defined fits (a search that stops on a flat ridge, a gate verdict that rounding can flip) are compared off that platform on what they declare, not on the point.

The details, decision by decision, are in docs/PORT.md; the rules of the convention in tests/conftest.py.

Not ported in this version, and refused by name when asked for (exit 2, with the C's words): the options starred in drvec-py -h -- -specs, -warma, -mawarma, -matest, -artest, -rankadm, -eval, the seed options (-seed, -seedybar, -seedgate, -noladder, -seedjoh, -seedb2) and the writers (-writeres, -writeinp) --, -m 2, the .inp route, and the rank test's and -rungs' combinations that the C has and the port does not yet (docs/PORT.md §10).

Documentation and changes

License

GPL-2.0-or-later (see COPYING).

Metadata

Release files for drvec 0.1.0

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

Source distribution (sdist)

Source distribution for drvec 0.1.0
File Size Uploaded Provenance Actions
drvec-0.1.0.tar.gz 1.0 MB With provenance Details for drvec-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for drvec 0.1.0
File Actions
drvec-0.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for drvec-0.1.0-py3-none-win_amd64.whl
drvec-0.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for drvec-0.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
drvec-0.1.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details for drvec-0.1.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
drvec-0.1.0-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details for drvec-0.1.0-py3-none-macosx_14_0_arm64.whl
drvec-0.1.0-py3-none-any.whl Python 3 none any Details for drvec-0.1.0-py3-none-any.whl

Total release size: 3.3 MB

Release files / drvec-0.1.0.tar.gz

Download URL drvec-0.1.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
26e2af3f7ba3f13cc17032aeabdb9bf0ce56af7fc58fdf7b99fa685d90b6a226
BLAKE2b-256 checksum
How to use checksums
b36ed290876bf39b202f7e8c41d5b7088302c52251e2d91aed44148966392db9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / drvec-0.1.0-py3-none-win_amd64.whl

Download URL drvec-0.1.0-py3-none-win_amd64.whl
Size 565.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
9cfb8ccd6065b5bb67053c2a6195b6f33c8c6e47f65027f6e89a89ce352ff0da
BLAKE2b-256 checksum
How to use checksums
a667ea90f4579e01770720866abe6e5ba8b17f150aa90475b7bac7c22b36bd64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / drvec-0.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL drvec-0.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 541.5 kB
Tags Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
5c08f6e197c0243bcc44e1635e5791bd4524c52e904e93d1fb7eca9f356013df
BLAKE2b-256 checksum
How to use checksums
2ba8c7522aa8958c0b80c77e84ddb379e36cc9f661a1da5417176a14934f7b37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / drvec-0.1.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL drvec-0.1.0-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 496.2 kB
Tags Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
43c17575795806b57b57b984708a3617cdd92f527aeece752dfcf8a0927af82d
BLAKE2b-256 checksum
How to use checksums
b0311f866fa02fb91f111da0158ff2ab5978c44d2d0e13da778c3c723c18b64d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / drvec-0.1.0-py3-none-macosx_14_0_arm64.whl

Download URL drvec-0.1.0-py3-none-macosx_14_0_arm64.whl
Size 534.3 kB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
8720de065a56d0ada59ae7b078a4b04a75007e6ec5bcae75e0d9db40f6201921
BLAKE2b-256 checksum
How to use checksums
614ed191596c74944ee6107e3f97faea3b35c6572cc9e5a1546b02caa8ccd85e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / drvec-0.1.0-py3-none-any.whl

Download URL drvec-0.1.0-py3-none-any.whl
Size 123.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae94b23ab5e6f3ffb0ae6507a3a8a9386a25d97a44474ef0bcc3ac1cda1f7ecb
BLAKE2b-256 checksum
How to use checksums
7e4719aded3e270580b59b861b2fb1ef3ae1c5c04bbe6730606a5cb65e2e690b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for drvec 0.1.0

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for drvec-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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