Skip to main content

tempdisagg

Temporal disaggregation of time series in Python
From annual to quarterly, monthly or daily — consistent with the totals, validated against R.

Python License R parity Status

Quarterly sales estimated from annual totals

Official statistics often exist only once a year while analysis needs quarters or months. tempdisagg estimates the high-frequency path from related indicators, and every result adds up exactly to the published figures. It implements the methods of the R package tempdisagg (Sax and Steiner, 2013) with the same names and defaults, reproduces its results to machine precision, and adds what production work usually needs: extra constraints, reconciliation of several series, backtesting and full diagnostics.

Installation

pip install tempdisagg            # numpy, pandas, scipy
pip install "tempdisagg[plot]"    # adds matplotlib for plotting

Quick start

import tempdisagg as td
from tempdisagg.datasets import load_swisspharma

sales, trade = load_swisspharma()          # annual sales, quarterly exports and imports

result = td.TemporalDisaggregator("chow-lin-maxlog").fit(sales, trade[["exports"]])
result.values                              # quarterly series
print(result.summary())                    # coefficients, rho, R², log-likelihood
result.prediction_interval(0.95)           # interval for each quarter

td.disaggregate(sales, method="denton-cholette", high_freq="Q")   # no indicator needed

Methods

Method Idea Presets
Chow-Lin regression on the indicators, AR(1) residuals chow-lin-maxlog (default), chow-lin-minrss-ecotrim, chow-lin-minrss-quilis, chow-lin-fixed, fast
Litterman random-walk residuals with AR(1) changes litterman-maxlog, litterman-minrss, litterman-fixed
Fernández random-walk residuals fernandez
Dynamic Chow-Lin the target depends on its own lag (experimental) dynamic-maxlog, dynamic-minrss, dynamic-fixed
OLS regression without residual correlation ols
Denton adjusts one indicator to the totals, additive or proportional denton-cholette, denton
Uniform splits each total evenly uniform

Every method is configurable — intercept, rho criterion and bounds, truncation, Denton criterion and order — and describe() lists each setting with its R equivalent:

td.TemporalDisaggregator("fernandez", include_intercept=False)
td.TemporalDisaggregator("chow-lin-maxlog", truncated_rho=-1)
td.TemporalDisaggregator("denton-cholette", criterion="additive", h=2)

Beyond a single series

Need Tool
Some quarters or months are known from another source constraints=td.known_values(...) / td.aggregate_constraints(...)
Series that must add up to a total every period td.CrossSectionalReconciler
Rates and shares (not additive) td.disaggregate_ratio, or aggregation_weights=
Choosing between models and indicators td.backtest
Structural breaks td.level_shift, td.impulse as extra indicators
Incomplete years, padding of the ends td.CompletionSettings, td.PaddingSettings
Non-negative output td.NonNegativeReconciler
Methodological breaks between two versions of a series td.SeriesSplicer

Contradictory inputs are rejected with the values that clash; nothing is imputed silently; every artificial value and every warning is recorded in the result.

Validated against R

All 29 reference cases — every method, the four aggregation rules, with and without intercept, Denton orders 0–2 and the Denton (1971) example — were run in R 4.5.3 with tempdisagg 1.2.0. Predictions, coefficients, standard errors and every reported statistic agree to between 1e-13 and 3e-9. When rho is estimated, R's optimiser stops near 1e-4; the Python optimum is never worse on the estimation criterion, and refitting at R's rho restores agreement to 1e-13.

Python vs R estimates

Agreement with R per case

The reference files are committed in tests/reference/, so the comparison runs with every pytest. To regenerate them: Rscript tests/reference/generate_r_reference.R.

Examples and data

examples/tempdisagg_examples.ipynb goes through every method with real data: Chow-Lin and its variants, Denton with and without an indicator, a test against known quarters, backtesting, known values as constraints, reconciliation of exports and imports, rates, incomplete years and padding.

The data ship with the package:

from tempdisagg.datasets import load_swisspharma, load_denton1971

load_swisspharma() returns the Swiss chemical and pharmaceutical industry data distributed with the R package (annual sales 1975–2010; quarterly exports and imports 1972–2011; sources: Swiss Federal Statistical Office and Federal Customs Administration). load_denton1971() is the textbook example of Denton (1971).

Documentation

Methodology formulas and derivations of every method
Statistics every number in a result, and its R equivalent
Configuration settings of each method
Architecture how the code is organised
Testing what each test guarantees
Migration changes from 0.2.x

Citation

@misc{verajaramillo2025tempdisagg,
  title         = {tempdisagg: A Python Library for Temporal Disaggregation of Time Series},
  author        = {Jaime A. Vera-Jaramillo},
  year          = {2025},
  eprint        = {2503.22054},
  archivePrefix = {arXiv},
  primaryClass  = {econ.EM}
}

Please also cite Sax and Steiner (2013), Temporal Disaggregation of Time Series, The R Journal 5(2), 80–88, for the methods and the reference implementation.

License

MIT. The swisspharma data come from the R package tempdisagg and Swiss official statistics.

Metadata

Release files for tempdisagg 0.6.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 tempdisagg 0.6.2
File Size Uploaded Provenance Actions
tempdisagg-0.6.2.tar.gz 100.7 kB Without provenance Details for tempdisagg-0.6.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tempdisagg 0.6.2
File Interpreter ABI Platform Actions
tempdisagg-0.6.2-py3-none-any.whl Python 3 none any Details for tempdisagg-0.6.2-py3-none-any.whl

Total release size: 193.3 kB

Release files / tempdisagg-0.6.2.tar.gz

Download URL tempdisagg-0.6.2.tar.gz
Size 100.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3cc29ac5128b81fb011794114cccf4fe93ae8e35677dbca64b596ecf06e7569f
BLAKE2b-256 checksum
How to use checksums
6685a29245f98d692d10adf09b293464e98ae9f5f1b03cd00e7b048f3632a131
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / tempdisagg-0.6.2-py3-none-any.whl

Download URL tempdisagg-0.6.2-py3-none-any.whl
Size 92.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c93ef6bbe31b4a01a33c80b0accb8bdbc12969b4071668893b6a71de81f175c
BLAKE2b-256 checksum
How to use checksums
7cb770a51c9e6fab7c415fe9840fbb4be94008f2b113ee0ace5fd10eeae93f45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for tempdisagg 0.6.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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