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

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

Built distributions (wheels)

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

Total release size: 4.0 MB

Release files / drvec-0.1.2.tar.gz

Download URL drvec-0.1.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
af6430800f3e2688954148ae325338f5a9f44bf49c7764d967ca153c33b52dba
BLAKE2b-256 checksum
How to use checksums
8e5e7c6f06072710bde1f79931f6caaaf5e712b813615f28cef17acd851ea581
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 16, 2026.

Transparency log

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

Download URL drvec-0.1.2-py3-none-win_amd64.whl
Size 566.1 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
1c9a13b69122b3e41105ab08a230fe020a1928bb1bbf67d49498a297636f1f87
BLAKE2b-256 checksum
How to use checksums
a43cc388e237927af32020027676e0c46bcb4ec53e5bca1dd67540574fc6f764
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 16, 2026.

Transparency log

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

Download URL drvec-0.1.2-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 541.8 kB
Tags Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
0294c9a0be19ab707b27b863cacd77ff4f5d38264590a905bd4ffa247bfbb5ee
BLAKE2b-256 checksum
How to use checksums
c332be035dcdb704e75e502a6af89642679c22f40c5ece78180551e518f9a51e
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 16, 2026.

Transparency log

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

Download URL drvec-0.1.2-py3-none-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 496.6 kB
Tags Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
110fb10bdb60728359d508f57271fd3e594ab731e0ff9d8e0fc195cccc4a8110
BLAKE2b-256 checksum
How to use checksums
2034f52fdf1ef59960f0193474ba9723739476a198beb136a787abd3a816880a
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 16, 2026.

Transparency log

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

Download URL drvec-0.1.2-py3-none-macosx_11_0_x86_64.whl
Size 669.2 kB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
12fcf1ee7c18021cec213e27a8c05b5cb822563e066ededa0bf84c068c03c369
BLAKE2b-256 checksum
How to use checksums
270841941f0fddaa654466b650f4c257bd52e3243312cc21dd8c708309bda761
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 16, 2026.

Transparency log

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

Download URL drvec-0.1.2-py3-none-macosx_11_0_arm64.whl
Size 554.3 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
92e569f4cf9a9a23f90b93059fc18ab45f6fefc7197581f5dbf6302b1abb5f6c
BLAKE2b-256 checksum
How to use checksums
c25e081f7b273d31055e455e3926d0b56e4c9ab6a3ed5f915ce3f911711acde3
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 16, 2026.

Transparency log

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

Download URL drvec-0.1.2-py3-none-any.whl
Size 123.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2948c75f0e471c3b62d3574796579166c4202c7679efc8950656ea5f6787472
BLAKE2b-256 checksum
How to use checksums
5c1fcdc24a1322bf8110d58a6a72c85d248529fad8187a70d96c0449fc1fc9f5
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 16, 2026.

Transparency log

Security for drvec 0.1.2

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.2.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 16, 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