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.1

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.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 drvec 0.1.1
File Size Uploaded Provenance Actions
drvec-0.1.1.tar.gz 1.0 MB With provenance Details for drvec-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for drvec 0.1.1
File Actions
drvec-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for drvec-0.1.1-py3-none-win_amd64.whl
drvec-0.1.1-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.1-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
drvec-0.1.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64, Linux glibc 2.24+ ARM64 Details for drvec-0.1.1-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
drvec-0.1.1-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details for drvec-0.1.1-py3-none-macosx_11_0_x86_64.whl
drvec-0.1.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for drvec-0.1.1-py3-none-macosx_11_0_arm64.whl
drvec-0.1.1-py3-none-any.whl Python 3 none any Details for drvec-0.1.1-py3-none-any.whl

Total release size: 4.0 MB

Release files / drvec-0.1.1.tar.gz

Download URL drvec-0.1.1.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
6f6c4545e8910dc9788046059630da46a926a59d02415813905f091f4845259a
BLAKE2b-256 checksum
How to use checksums
0d6ca08e44193372686e48a1fe0344ad495d61a52e532602e59ac6272b00c6b2
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 Nov 14, 2026.

Transparency log

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

Download URL drvec-0.1.1-py3-none-win_amd64.whl
Size 565.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d297c0dd19412108bed2579de5513a4217e7469db70216bcc4b7c72feeb9474a
BLAKE2b-256 checksum
How to use checksums
6afffbe84a4328da31b68f06989c910a48a8b6bd7149e4b54748b093996eaa1a
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 Nov 14, 2026.

Transparency log

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

Download URL drvec-0.1.1-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
27a07f3fe13e047c7a059aaa835c7d6aa03c040e89f3969c1d22d104dc110080
BLAKE2b-256 checksum
How to use checksums
4127e9953b6cbab7fa8b3280a14f332eaef113872ea840e1746f6f27139561b6
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 Nov 14, 2026.

Transparency log

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

Download URL drvec-0.1.1-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
907f8ce42af8c256c1faa1742b821eb2f081a72f8d0139d6ca1c4d5b1b1a4ca8
BLAKE2b-256 checksum
How to use checksums
7e1bf341266bb467b74f3d5cdb101163d2ffc6fde74196040d4816ae7978a734
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 Nov 14, 2026.

Transparency log

Release files / drvec-0.1.1-py3-none-macosx_11_0_x86_64.whl

Download URL drvec-0.1.1-py3-none-macosx_11_0_x86_64.whl
Size 668.9 kB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
0025d7f2ad0f9853ddae6ae5935cc2c7979e18e3ed9aadef438c387b129c02e7
BLAKE2b-256 checksum
How to use checksums
c464d5c2363a5cdf1b7e0660659cc4f9b2889f24b0a9cc0d1adb7fe82189df7d
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 Nov 14, 2026.

Transparency log

Release files / drvec-0.1.1-py3-none-macosx_11_0_arm64.whl

Download URL drvec-0.1.1-py3-none-macosx_11_0_arm64.whl
Size 553.9 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1d65d8d0601eff89df9559428baafc3890555df057f2a1c751822ad1dec8c4d5
BLAKE2b-256 checksum
How to use checksums
5e2222aeee694bd3067a026e8a36947d278799c4d228c2d593bc3f0d384fd716
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 Nov 14, 2026.

Transparency log

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

Download URL drvec-0.1.1-py3-none-any.whl
Size 123.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa31ab0cb56a8c3d3791013233d507e63f7a0ea88cccb5c41afe54bcf1104236
BLAKE2b-256 checksum
How to use checksums
4edd35fcbc932ad617750ba714489274254b04950bd83d7c37995f60621ac40f
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 Nov 14, 2026.

Transparency log

Security for drvec 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.

Full provenance

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

Select from 7 files

Attestation for drvec-0.1.1.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 Nov 14, 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