Skip to main content

stats-transformer

Table of Contents


1. Overview

stats-transformer is a Python library for data transformation, econometric modeling, and visualization. It automates feature engineering, model estimation, and reporting across time-series, panel, and cross-sectional datasets using a reproducible configuration workflow.

  • Reproducible Workflows: Research decisions from data ingestion to publication output are driven by a single config (params.yaml), in four stages; each run lands in a timestamped run folder with a provenance manifest.json (config and input checksums, git SHA, stages run, written files)
    • Data stage: ingest, resample, merge
    • Features stage: transform into analysis variables
    • Model stage: estimate with diagnostics and a JSON summary
    • Reporting stage: charts and publication tables
  • Broad Econometric Coverage: Covers cross-sectional (OLS, robust OLS), panel (fixed effects), time-series (VAR, VECM, SVAR, local projections), IV (2SLS), discrete choice (Logit), and unsupervised methods (PCA, KMeans).
    • Validated via legacy software: Model estimation and transformation validated against MATLAB, R, and Stata

2. Documentation


3. Quickstart

3.1. Installation

To use it in your project via PyPI:

pip install stats-transformer

Or add it with uv:

uv add stats-transformer

To run the notebooks under notebooks/, install the notebooks extra:

pip install "stats-transformer[notebooks]"

For local development from this repository:

uv sync

3.2. Usage

3.2.1. With params.yaml

Define your data sources, pipeline parameters, and model specifications in a params.yaml file:

data:
  featurization:
    entity_column: country
  datasets:
    - name: macro_data
      path: data/raw/macro_indicators.csv
      frequency: Q

model:
  model_type: panel_ols
  target_variable: gdp_growth
  independent_variables:
    - interest_rate
    - inflation

reporting:
  output_dir: reports/visualizations

Execute the full pipeline via the command line using the Pipeline orchestrator:

uv run python -m stats_transformer.pipeline --config params.yaml

Or drive the same configuration programmatically:

from stats_transformer import Pipeline

pipeline = Pipeline(params_path="params.yaml")
merged_data = pipeline.run(stage="data")
transformed_data = pipeline.run(stage="features")
model_results = pipeline.run(stage="model")
pipeline.run(stage="reporting")

3.2.2. With the API directly

Skip the YAML file and instantiate model classes directly. Start from a packaged example dataset:

from stats_transformer.data import list_examples, load_example

print(list_examples())
df = load_example("macrodb_gdp_inflation")

Then fit any model class on the data:

from stats_transformer.models.regression.robust_ols import RobustOLSModel
from stats_transformer.reporting.models.regression_viz import RegressionVisualizer

model = RobustOLSModel(
    target="gdp",
    independent_variables=["inflation"],
    cov_type="HC3",
)
model.fit(df)
print(model.get_summary())

viz = RegressionVisualizer(output_dir="reports/visualizations")
paths = viz.visualize_from_json(model_summary=model.get_model_metadata())

All 32 model classes accept direct instantiation like this; see Implemented Models for each class's arguments. End-to-end examples live in the notebooks.

3.3. Testing

Verify the installation and library integrity by running the test suite:

uv run python -m pytest -q

For more details on test coverage, see the Testing Suite.


4. Agent Skill

Source checkouts of this repository include an optional stats-transformer-architecture agent skill for AI coding tools. It gives agents a compact map of the library architecture, pipeline stages, model contracts, and feature-engineering vocabulary.

The canonical skill source lives at .agents/skills/stats-transformer-architecture/. From the repository root, use the local terminal to run scripts/install-agent-skill.sh, which installs or refreshes tool-specific copies for Claude Code, OpenAI Codex, or Kilo Code:

./scripts/install-agent-skill.sh all

You can also target one tool at a time:

./scripts/install-agent-skill.sh claude
./scripts/install-agent-skill.sh codex
./scripts/install-agent-skill.sh kilo

Metadata

Release files for stats-transformer 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stats-transformer 1.9.0
File Size Uploaded Provenance Actions
stats_transformer-1.9.0.tar.gz 6.5 MB With provenance Details for stats_transformer-1.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stats-transformer 1.9.0
File Interpreter ABI Platform Actions
stats_transformer-1.9.0-py3-none-any.whl Python 3 none any Details for stats_transformer-1.9.0-py3-none-any.whl

Total release size: 13.2 MB

Release files / stats_transformer-1.9.0.tar.gz

Download URL stats_transformer-1.9.0.tar.gz
Size 6.5 MB
Tags Source
SHA-256 checksum
How to use checksums
3ce2b70ebd0d5dd269697428a841bb1ea6316eeb558d2dfc9c79722fd990bac3
BLAKE2b-256 checksum
How to use checksums
80a1b402d55ed6c7ee65aace7984236f1b050b433511f41d249ddfed351424b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 14, 2026.

Transparency log

Release files / stats_transformer-1.9.0-py3-none-any.whl

Download URL stats_transformer-1.9.0-py3-none-any.whl
Size 6.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
9f4e32b8769403c695ba1561be1d90188414a9ec728e610f50bfeae0a4e89c0e
BLAKE2b-256 checksum
How to use checksums
d15b971255a7f03ec81190415616f34d2777d5aa3592c98d109bb9ef86d88c7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 14, 2026.

Transparency log

Security for stats-transformer 1.9.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for stats_transformer-1.9.0.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 Oct 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