This package implements the TSRAKING procedure developed by Statistics Canada in Python3.
Project description
TSRaking
TSRaking is a Python library for generalized time series raking (benchmarking) and constrained adjustment of multi-dimensional data.
It implements a Generalized Least Squares (GLS) raking procedure that reconciles:
- High-frequency predictions (e.g., monthly estimates)
- Low-frequency totals (e.g., annual constraints)
- Cross-sectional constraints (e.g., provincial totals summing to national totals)
TSRaking is designed for statistical agencies, researchers, and practitioners who need to enforce accounting identities or hierarchical consistency in time series data.
Features
- Generalized least squares raking
- Lightweight (NumPy-based)
- Suitable for hierarchical time series benchmarking and frequency table rebalancing
The raking adjustment is computed via:
$$\hat{\theta} = x + V_e G^\top (G V_e G^\top + V_\varepsilon)^{-1} (g - Gx)$$
If the constraint system is rank-deficient, then Moore–Penrose matrix inversion is used to obtain a unique solution.
System Requirements
Software Requirements
- Python ≥ 3.8
- NumPy
Optional (for development):
- pytest
Operating Systems
The development version of TSRaking has been tested on:
- Linux (Ubuntu 20.04+)
- macOS
- Windows 10/11
The package is pure Python and should run on any operating system that supports Python 3.8+.
Installation
Install from PyPI
Create a virtual environment (recommended):
python -m venv tsraking-env
source tsraking-env/bin/activate # macOS/Linux
# or
tsraking-env\Scripts\activate # Windows
For developers or users who want the latest features from the main branch:
git clone https://github.com/akil-h/tsrakingpy.git
cd tsrakingpy
python -m venv tsraking-env
source tsraking-env/bin/activate # macOS/Linux
# or
tsraking-env\Scripts\activate # Windows
pip install -e .
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsraking-0.1.3.tar.gz.
File metadata
- Download URL: tsraking-0.1.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da9e97ec73c0d5e954b911bee674167767bb5d33f0458a8a845fd9190b4adf4a
|
|
| MD5 |
7753e53c8d517e962cae7c635f14f8f3
|
|
| BLAKE2b-256 |
fcb0cd02762eab8a09eff2bb4dfe3a2e5c2125b03c46aaace9a33035d59e819a
|
Provenance
The following attestation bundles were made for tsraking-0.1.3.tar.gz:
Publisher:
publish.yml on akil-h/tsrakingpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tsraking-0.1.3.tar.gz -
Subject digest:
da9e97ec73c0d5e954b911bee674167767bb5d33f0458a8a845fd9190b4adf4a - Sigstore transparency entry: 939375198
- Sigstore integration time:
-
Permalink:
akil-h/tsrakingpy@d116bb8fc778a6437aaee6a05871273d68cfe49c -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/akil-h
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d116bb8fc778a6437aaee6a05871273d68cfe49c -
Trigger Event:
release
-
Statement type:
File details
Details for the file tsraking-0.1.3-py3-none-any.whl.
File metadata
- Download URL: tsraking-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7278fdcdd2026b3d05b83a9932a5647a1d7e9d5492d834448035d1b73a352e3b
|
|
| MD5 |
0e6c079a8e79dc7de4c4e95ccfbbeab5
|
|
| BLAKE2b-256 |
f58dff5ef1bfd7b15ddf510783653542139c5888bd4af10e78c94e3a93181cf9
|
Provenance
The following attestation bundles were made for tsraking-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on akil-h/tsrakingpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tsraking-0.1.3-py3-none-any.whl -
Subject digest:
7278fdcdd2026b3d05b83a9932a5647a1d7e9d5492d834448035d1b73a352e3b - Sigstore transparency entry: 939375208
- Sigstore integration time:
-
Permalink:
akil-h/tsrakingpy@d116bb8fc778a6437aaee6a05871273d68cfe49c -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/akil-h
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d116bb8fc778a6437aaee6a05871273d68cfe49c -
Trigger Event:
release
-
Statement type: