tsdisagg


Nametsdisagg JSON
Version 1.3.2 PyPI version JSON
download
home_pageNone
SummaryTemporal Disaggregation of Time Series Data in Python
upload_time2025-10-13 23:49:37
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License Copyright (c) 2022 jessegrabowski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords datetime decomposition econometrics time series
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tsdisagg
Tools for converting low time series data to high frequency, based on the R package `tempdisagg`, and espeically the accompanying paper by [Sax and Steiner 2013](https://journal.r-project.org/archive/2013-2/sax-steiner.pdf).

`tsdisagg` allows the user to convert low frequency time series data (e.g., yearly or quarterly) to a higher frequency (e.g., quarterly or monthly) in a way that preserves desired aggregate statistics in the high frequency data. It should, for example, sum back to the original low-frequency data.

In addition, regression-based methods are also implemented that allow the user to supply "indicator series", allowing variation from correlated high-frequency time series to be imputed into the low frequency data.

If you have any questions or issues, please open a thread. Pull requests to add features or fix bugs are welcome. Please clone the repository locally to have access to the testing suite.

## Installation
`tsdisagg` is distributed on `conda-forge`. To install, use conda/mamba:

```
conda install -c conda-forge tsdisagg
```

Or, of course, you can install using pip:

```
pip install tsdisagg
```

## Current Features
Currently, only conversion between yearly, quarterly, and monthly data is supported. Conversion to lower frequencies is non-trivial due to the calendar math that needs to be added, but this is on my to-do list.

The following interpolation methods have been implemented:

Single series, non-parametric methods:
- Denton
- Denton-Cholette

Multiseries, regression-based methods:
- Chow-Lin
- Litterman


## Examples

Disaggregate a timeseries using the univariate Denton-Cholette method:
```python
import pandas as pd
from tsdisagg import disaggregate_series
from tsdisagg.datasets import load_data

# Load example data
sales_a = load_data("annual_sales")


# Disaggregate from annual to quarterly using Denton-Cholette method
sales_q_dc = disaggregate_series(
    sales_a.resample("YS").last(), # Use `.resample` to ensure the frequency is set correctly
    target_freq="QS", # Desired output frequency
    method="denton-cholette", # Disaggregation method
    agg_func="sum", # Sales are flow data, so we want the quarters to sum back to the annual data
    h=1, # Differencing order (1 in this case to preserve the trend)
)
```

Disaggregate a timeseries using the multivariate Chow-Lin method with an indicator series:
```python
import pandas as pd
from tsdisagg import disaggregate_series
from tsdisagg.datasets import load_data

# Load example data
sales_a = load_data("annual_sales")
exports_q = load_data("quarterly_exports")

# Disaggregate from annual to quarterly using Chow-Lin method with quarterly sales as indicator
sales_q_chow_lin = disaggregate_series(
    sales_a.resample("YS").last(), # Target series, annual frequency
    exports_q.assign(intercept=1), # Indicator matrix. We can have as many series as we want here; so we use
                                   # Exports at quarterly frequency, plus a deterministic intercept term.
    method="chow-lin", # Disaggregation method
    agg_func="sum", # Sales are flow data, so we want the quarters to sum back to the annual data
    optimizer_kwargs={"method": "powell"}, # Additional arguments to the optimizer
)
```

# Citing `tsdisagg`
If you use `tsdisagg` in your research, please use the following citation:

```bibtex
@software{tsdisagg,
author = {Jesse Grabowski},
title = {tsdisagg: Temporal Disaggregation of Time Series Data in Python},
version = {0.1.0},
url = {https://github.com/jessegrabowski/tsdisagg},
howpublished = {GitHub},
year = {2025},
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tsdisagg",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "datetime, decomposition, econometrics, time series",
    "author": null,
    "author_email": "Jesse Grabowski <jessegrabowski@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/77/5f/75a0bd21a87ccec5eddd598b5d3d3e3885389d3f513a351b78a5f478be7d/tsdisagg-1.3.2.tar.gz",
    "platform": null,
    "description": "# tsdisagg\nTools for converting low time series data to high frequency, based on the R package `tempdisagg`, and espeically the accompanying paper by [Sax and Steiner 2013](https://journal.r-project.org/archive/2013-2/sax-steiner.pdf).\n\n`tsdisagg` allows the user to convert low frequency time series data (e.g., yearly or quarterly) to a higher frequency (e.g., quarterly or monthly) in a way that preserves desired aggregate statistics in the high frequency data. It should, for example, sum back to the original low-frequency data.\n\nIn addition, regression-based methods are also implemented that allow the user to supply \"indicator series\", allowing variation from correlated high-frequency time series to be imputed into the low frequency data.\n\nIf you have any questions or issues, please open a thread. Pull requests to add features or fix bugs are welcome. Please clone the repository locally to have access to the testing suite.\n\n## Installation\n`tsdisagg` is distributed on `conda-forge`. To install, use conda/mamba:\n\n```\nconda install -c conda-forge tsdisagg\n```\n\nOr, of course, you can install using pip:\n\n```\npip install tsdisagg\n```\n\n## Current Features\nCurrently, only conversion between yearly, quarterly, and monthly data is supported. Conversion to lower frequencies is non-trivial due to the calendar math that needs to be added, but this is on my to-do list.\n\nThe following interpolation methods have been implemented:\n\nSingle series, non-parametric methods:\n- Denton\n- Denton-Cholette\n\nMultiseries, regression-based methods:\n- Chow-Lin\n- Litterman\n\n\n## Examples\n\nDisaggregate a timeseries using the univariate Denton-Cholette method:\n```python\nimport pandas as pd\nfrom tsdisagg import disaggregate_series\nfrom tsdisagg.datasets import load_data\n\n# Load example data\nsales_a = load_data(\"annual_sales\")\n\n\n# Disaggregate from annual to quarterly using Denton-Cholette method\nsales_q_dc = disaggregate_series(\n    sales_a.resample(\"YS\").last(), # Use `.resample` to ensure the frequency is set correctly\n    target_freq=\"QS\", # Desired output frequency\n    method=\"denton-cholette\", # Disaggregation method\n    agg_func=\"sum\", # Sales are flow data, so we want the quarters to sum back to the annual data\n    h=1, # Differencing order (1 in this case to preserve the trend)\n)\n```\n\nDisaggregate a timeseries using the multivariate Chow-Lin method with an indicator series:\n```python\nimport pandas as pd\nfrom tsdisagg import disaggregate_series\nfrom tsdisagg.datasets import load_data\n\n# Load example data\nsales_a = load_data(\"annual_sales\")\nexports_q = load_data(\"quarterly_exports\")\n\n# Disaggregate from annual to quarterly using Chow-Lin method with quarterly sales as indicator\nsales_q_chow_lin = disaggregate_series(\n    sales_a.resample(\"YS\").last(), # Target series, annual frequency\n    exports_q.assign(intercept=1), # Indicator matrix. We can have as many series as we want here; so we use\n                                   # Exports at quarterly frequency, plus a deterministic intercept term.\n    method=\"chow-lin\", # Disaggregation method\n    agg_func=\"sum\", # Sales are flow data, so we want the quarters to sum back to the annual data\n    optimizer_kwargs={\"method\": \"powell\"}, # Additional arguments to the optimizer\n)\n```\n\n# Citing `tsdisagg`\nIf you use `tsdisagg` in your research, please use the following citation:\n\n```bibtex\n@software{tsdisagg,\nauthor = {Jesse Grabowski},\ntitle = {tsdisagg: Temporal Disaggregation of Time Series Data in Python},\nversion = {0.1.0},\nurl = {https://github.com/jessegrabowski/tsdisagg},\nhowpublished = {GitHub},\nyear = {2025},\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2022 jessegrabowski\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Temporal Disaggregation of Time Series Data in Python",
    "version": "1.3.2",
    "project_urls": {
        "Issues": "https://github.com/jessegrabowski/tsdisagg/issues",
        "Repository": "https://github.com/jessegrabowski/tsdisagg.git"
    },
    "split_keywords": [
        "datetime",
        " decomposition",
        " econometrics",
        " time series"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "11de4d28615db3296668aa4d3623dec39785163ab9f5c9d8ca7d63e62c4c02c1",
                "md5": "965c79436d5fc5285cf8e26e4287bb42",
                "sha256": "7858bf0557d96d4277d737d81f6b197711868f93a20c6d58a91d06b6703ae90d"
            },
            "downloads": -1,
            "filename": "tsdisagg-1.3.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "965c79436d5fc5285cf8e26e4287bb42",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 13844,
            "upload_time": "2025-10-13T23:49:36",
            "upload_time_iso_8601": "2025-10-13T23:49:36.132096Z",
            "url": "https://files.pythonhosted.org/packages/11/de/4d28615db3296668aa4d3623dec39785163ab9f5c9d8ca7d63e62c4c02c1/tsdisagg-1.3.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "775f75a0bd21a87ccec5eddd598b5d3d3e3885389d3f513a351b78a5f478be7d",
                "md5": "3143fac9c75f57d4ffb038b2776ea647",
                "sha256": "2a3a4ffe16f06122e8a5e36dca851b1b03bd5dca1f9f5998111cde5f1061328d"
            },
            "downloads": -1,
            "filename": "tsdisagg-1.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3143fac9c75f57d4ffb038b2776ea647",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 104250,
            "upload_time": "2025-10-13T23:49:37",
            "upload_time_iso_8601": "2025-10-13T23:49:37.501939Z",
            "url": "https://files.pythonhosted.org/packages/77/5f/75a0bd21a87ccec5eddd598b5d3d3e3885389d3f513a351b78a5f478be7d/tsdisagg-1.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-13 23:49:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jessegrabowski",
    "github_project": "tsdisagg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tsdisagg"
}
        
Elapsed time: 0.93530s