stats-transformer 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. stats_transformer-1.2.0/.gitignore +253 -0
  2. stats_transformer-1.2.0/CHANGELOG.md +59 -0
  3. stats_transformer-1.2.0/LICENSE +21 -0
  4. stats_transformer-1.2.0/PKG-INFO +149 -0
  5. stats_transformer-1.2.0/README.md +102 -0
  6. stats_transformer-1.2.0/pyproject.toml +57 -0
  7. stats_transformer-1.2.0/src/examples/academic/bauer_bernanke_milstein.py +82 -0
  8. stats_transformer-1.2.0/src/examples/academic/bauer_swanson.py +116 -0
  9. stats_transformer-1.2.0/src/examples/academic/nakamura_steinsson.py +101 -0
  10. stats_transformer-1.2.0/src/examples/academic/nakamura_steinsson_pca.py +61 -0
  11. stats_transformer-1.2.0/src/examples/base.py +38 -0
  12. stats_transformer-1.2.0/src/examples/configs/__init__.py +0 -0
  13. stats_transformer-1.2.0/src/examples/configs/grunfeld_panel.yaml +15 -0
  14. stats_transformer-1.2.0/src/examples/configs/longley.yaml +17 -0
  15. stats_transformer-1.2.0/src/examples/configs/mincer_wage.yaml +11 -0
  16. stats_transformer-1.2.0/src/examples/configs/mroz_iv.yaml +15 -0
  17. stats_transformer-1.2.0/src/examples/configs/nakamura_steinsson_pca.yaml +12 -0
  18. stats_transformer-1.2.0/src/examples/configs/okuns_law.yaml +8 -0
  19. stats_transformer-1.2.0/src/examples/discrete/spector_logit.py +70 -0
  20. stats_transformer-1.2.0/src/examples/examples_running_from_yaml.py +51 -0
  21. stats_transformer-1.2.0/src/examples/featurization/dbnomics.py +86 -0
  22. stats_transformer-1.2.0/src/examples/featurization/demo.py +77 -0
  23. stats_transformer-1.2.0/src/examples/featurization/example.py +113 -0
  24. stats_transformer-1.2.0/src/examples/featurization/fred.py +82 -0
  25. stats_transformer-1.2.0/src/examples/featurization/monetary.py +151 -0
  26. stats_transformer-1.2.0/src/examples/regression/ghysels_chap1.py +33 -0
  27. stats_transformer-1.2.0/src/examples/regression/ghysels_chap2.py +38 -0
  28. stats_transformer-1.2.0/src/examples/regression/grunfeld.py +86 -0
  29. stats_transformer-1.2.0/src/examples/regression/longley.py +71 -0
  30. stats_transformer-1.2.0/src/examples/regression/mincer_wage.py +86 -0
  31. stats_transformer-1.2.0/src/examples/regression/mroz_iv.py +85 -0
  32. stats_transformer-1.2.0/src/examples/regression/okuns_law.py +127 -0
  33. stats_transformer-1.2.0/src/examples/timeseries/ghysels_chap6.py +21 -0
  34. stats_transformer-1.2.0/src/examples/timeseries/ghysels_chap7.py +21 -0
  35. stats_transformer-1.2.0/src/examples/timeseries/kilian_svar.py +29 -0
  36. stats_transformer-1.2.0/src/examples/timeseries/kilian_vecm.py +24 -0
  37. stats_transformer-1.2.0/src/examples/timeseries/macro_var.py +78 -0
  38. stats_transformer-1.2.0/src/stats_transformer/__init__.py +40 -0
  39. stats_transformer-1.2.0/src/stats_transformer/data/__init__.py +94 -0
  40. stats_transformer-1.2.0/src/stats_transformer/data/macrodb_gdp_inflation.parquet +0 -0
  41. stats_transformer-1.2.0/src/stats_transformer/data/panel_builder.py +232 -0
  42. stats_transformer-1.2.0/src/stats_transformer/featurization/__init__.py +9 -0
  43. stats_transformer-1.2.0/src/stats_transformer/featurization/base.py +69 -0
  44. stats_transformer-1.2.0/src/stats_transformer/featurization/data_merger.py +128 -0
  45. stats_transformer-1.2.0/src/stats_transformer/featurization/event_study.py +145 -0
  46. stats_transformer-1.2.0/src/stats_transformer/featurization/feature_engineering.py +478 -0
  47. stats_transformer-1.2.0/src/stats_transformer/models/__init__.py +7 -0
  48. stats_transformer-1.2.0/src/stats_transformer/models/base.py +189 -0
  49. stats_transformer-1.2.0/src/stats_transformer/models/discrete/logit.py +52 -0
  50. stats_transformer-1.2.0/src/stats_transformer/models/regression/__init__.py +0 -0
  51. stats_transformer-1.2.0/src/stats_transformer/models/regression/diagnostics.py +45 -0
  52. stats_transformer-1.2.0/src/stats_transformer/models/regression/iv.py +60 -0
  53. stats_transformer-1.2.0/src/stats_transformer/models/regression/panel.py +116 -0
  54. stats_transformer-1.2.0/src/stats_transformer/models/regression/panel_diagnostics.py +126 -0
  55. stats_transformer-1.2.0/src/stats_transformer/models/regression/regression.py +190 -0
  56. stats_transformer-1.2.0/src/stats_transformer/models/regression/robust_ols.py +30 -0
  57. stats_transformer-1.2.0/src/stats_transformer/models/regression/spec_runner.py +133 -0
  58. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/__init__.py +18 -0
  59. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/base_irf.py +73 -0
  60. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/diagnostics.py +86 -0
  61. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/granger.py +135 -0
  62. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/local_projections.py +86 -0
  63. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/svar.py +61 -0
  64. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/utilities.py +104 -0
  65. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/var.py +61 -0
  66. stats_transformer-1.2.0/src/stats_transformer/models/timeseries/vecm.py +56 -0
  67. stats_transformer-1.2.0/src/stats_transformer/models/unsupervised/__init__.py +0 -0
  68. stats_transformer-1.2.0/src/stats_transformer/models/unsupervised/unsupervised.py +119 -0
  69. stats_transformer-1.2.0/src/stats_transformer/pipeline.py +310 -0
  70. stats_transformer-1.2.0/src/stats_transformer/py.typed +1 -0
  71. stats_transformer-1.2.0/src/stats_transformer/reporting/__init__.py +3 -0
  72. stats_transformer-1.2.0/src/stats_transformer/reporting/exporters.py +80 -0
  73. stats_transformer-1.2.0/src/stats_transformer/utils/__init__.py +5 -0
  74. stats_transformer-1.2.0/src/stats_transformer/utils/config.py +164 -0
  75. stats_transformer-1.2.0/src/stats_transformer/utils/dict_country_converter.py +1574 -0
  76. stats_transformer-1.2.0/src/stats_transformer/visualization/__init__.py +34 -0
  77. stats_transformer-1.2.0/src/stats_transformer/visualization/base.py +75 -0
  78. stats_transformer-1.2.0/src/stats_transformer/visualization/charts/__init__.py +16 -0
  79. stats_transformer-1.2.0/src/stats_transformer/visualization/charts/bar.py +166 -0
  80. stats_transformer-1.2.0/src/stats_transformer/visualization/charts/heatmap.py +60 -0
  81. stats_transformer-1.2.0/src/stats_transformer/visualization/charts/scatter.py +102 -0
  82. stats_transformer-1.2.0/src/stats_transformer/visualization/charts/time_series.py +175 -0
  83. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/__init__.py +14 -0
  84. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/colors.py +43 -0
  85. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/labels.py +32 -0
  86. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/styles/barchart.mplstyle +50 -0
  87. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/styles/line_matplot.mplstyle +46 -0
  88. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/styles/line_seaborn.mplstyle +46 -0
  89. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/styles/scatter.mplstyle +45 -0
  90. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/styles/scatter_text.mplstyle +45 -0
  91. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/styles/timeseries.mplstyle +46 -0
  92. stats_transformer-1.2.0/src/stats_transformer/visualization/defaults/styles/wordcloud.mplstyle +37 -0
  93. stats_transformer-1.2.0/src/stats_transformer/visualization/eda/__init__.py +0 -0
  94. stats_transformer-1.2.0/src/stats_transformer/visualization/eda/data_viz.py +195 -0
  95. stats_transformer-1.2.0/src/stats_transformer/visualization/eda/eda.py +89 -0
  96. stats_transformer-1.2.0/src/stats_transformer/visualization/formatters/__init__.py +10 -0
  97. stats_transformer-1.2.0/src/stats_transformer/visualization/formatters/significance.py +46 -0
  98. stats_transformer-1.2.0/src/stats_transformer/visualization/formatters/style.py +43 -0
  99. stats_transformer-1.2.0/src/stats_transformer/visualization/models/__init__.py +0 -0
  100. stats_transformer-1.2.0/src/stats_transformer/visualization/models/model_viz.py +81 -0
  101. stats_transformer-1.2.0/src/stats_transformer/visualization/models/regression_viz.py +340 -0
  102. stats_transformer-1.2.0/src/stats_transformer/visualization/tables/__init__.py +5 -0
  103. stats_transformer-1.2.0/src/stats_transformer/visualization/tables/descriptive_stats.py +108 -0
  104. stats_transformer-1.2.0/src/stats_transformer/visualization/tables/table_generator.py +114 -0
  105. stats_transformer-1.2.0/src/stats_transformer/visualization/utils/__init__.py +0 -0
  106. stats_transformer-1.2.0/src/stats_transformer/visualization/utils/viz_utils.py +44 -0
@@ -0,0 +1,253 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ # Generated visualization outputs
3
+ src/stats_transformer/visualization/expansion/
4
+ # Generated dictionary mappings
5
+ references/dictionaries/
6
+ # Generated visualization configs
7
+ references/viz/
8
+ # Local archive of old project materials
9
+ archive/
10
+ # Generated/example review files
11
+ src/examples/agent_reviews/
12
+ # Notebook export outputs
13
+ /data/notebook_exports/
14
+ # DVC pipeline intermediates
15
+ /data/pipeline/
16
+ # Final processed data outputs
17
+ /data/final/
18
+ # Temporary working files
19
+ /data/temp/
20
+ # Immutable raw data (never modified)
21
+ /data/raw/
22
+ # Generated analysis reports and plots
23
+ reports/
24
+ # Archived/deprecated documentation (not tracked, preserved locally)
25
+ docs/archive/
26
+ __pycache__/
27
+ *.py[codz]
28
+ *$py.class
29
+
30
+ # C extensions
31
+ *.so
32
+
33
+ # Distribution / packaging
34
+ .Python
35
+ build/
36
+ develop-eggs/
37
+ dist/
38
+ downloads/
39
+ eggs/
40
+ .eggs/
41
+ lib/
42
+ lib64/
43
+ parts/
44
+ sdist/
45
+ var/
46
+ wheels/
47
+ share/python-wheels/
48
+ *.egg-info/
49
+ .installed.cfg
50
+ *.egg
51
+ MANIFEST
52
+
53
+ # PyInstaller
54
+ # Usually these files are written by a python script from a template
55
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
56
+ *.manifest
57
+ *.spec
58
+
59
+ # Installer logs
60
+ pip-log.txt
61
+ pip-delete-this-directory.txt
62
+
63
+ # Unit test / coverage reports
64
+ htmlcov/
65
+ .tox/
66
+ .nox/
67
+ .coverage
68
+ .coverage.*
69
+ .cache
70
+ nosetests.xml
71
+ coverage.xml
72
+ *.cover
73
+ *.py.cover
74
+ .hypothesis/
75
+ .pytest_cache/
76
+ cover/
77
+
78
+ # Translations
79
+ *.mo
80
+ *.pot
81
+
82
+ # Django stuff:
83
+ *.log
84
+ local_settings.py
85
+ db.sqlite3
86
+ db.sqlite3-journal
87
+
88
+ # Flask stuff:
89
+ instance/
90
+ .webassets-cache
91
+
92
+ # Scrapy stuff:
93
+ .scrapy
94
+
95
+ # Sphinx documentation
96
+ docs/_build/
97
+
98
+ # PyBuilder
99
+ .pybuilder/
100
+ target/
101
+
102
+ # Jupyter Notebook
103
+ .ipynb_checkpoints
104
+
105
+ # IPython
106
+ profile_default/
107
+ ipython_config.py
108
+
109
+ # pyenv
110
+ # For a library or package, you might want to ignore these files since the code is
111
+ # intended to run in multiple environments; otherwise, check them in:
112
+ # .python-version
113
+
114
+ # pipenv
115
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
116
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
117
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
118
+ # install all needed dependencies.
119
+ # Pipfile.lock
120
+
121
+ # UV
122
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
123
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
124
+ # commonly ignored for libraries.
125
+ uv.lock
126
+
127
+ # poetry
128
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
129
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
130
+ # commonly ignored for libraries.
131
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
132
+ # poetry.lock
133
+ # poetry.toml
134
+
135
+ # pdm
136
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
137
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
138
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
139
+ # pdm.lock
140
+ # pdm.toml
141
+ .pdm-python
142
+ .pdm-build/
143
+
144
+ # pixi
145
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
146
+ # pixi.lock
147
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
148
+ # in the .venv directory. It is recommended not to include this directory in version control.
149
+ .pixi
150
+
151
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
152
+ __pypackages__/
153
+
154
+ # Celery stuff
155
+ celerybeat-schedule
156
+ celerybeat.pid
157
+
158
+ # Redis
159
+ *.rdb
160
+ *.aof
161
+ *.pid
162
+
163
+ # RabbitMQ
164
+ mnesia/
165
+ rabbitmq/
166
+ rabbitmq-data/
167
+
168
+ # ActiveMQ
169
+ activemq-data/
170
+
171
+ # SageMath parsed files
172
+ *.sage.py
173
+
174
+ # Environments
175
+ .env
176
+ .envrc
177
+ .venv
178
+ env/
179
+ venv/
180
+ ENV/
181
+ env.bak/
182
+ venv.bak/
183
+
184
+ # Spyder project settings
185
+ .spyderproject
186
+ .spyproject
187
+
188
+ # Rope project settings
189
+ .ropeproject
190
+
191
+ # mkdocs documentation
192
+ /site
193
+
194
+ # mypy
195
+ .mypy_cache/
196
+ .dmypy.json
197
+ dmypy.json
198
+
199
+ # Pyre type checker
200
+ .pyre/
201
+
202
+ # pytype static type analyzer
203
+ .pytype/
204
+
205
+ # Cython debug symbols
206
+ cython_debug/
207
+
208
+ # PyCharm
209
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
210
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
211
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
212
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
213
+ # .idea/
214
+
215
+ # Abstra
216
+ # Abstra is an AI-powered process automation framework.
217
+ # Ignore directories containing user credentials, local state, and settings.
218
+ # Learn more at https://abstra.io/docs
219
+ .abstra/
220
+
221
+ # Kilo
222
+ # Local Kilo configuration directory
223
+ .kilo/
224
+
225
+ # Agent workflow definitions
226
+ # Local Kilo/opencode agent specs; not part of the published package
227
+ .agents/
228
+
229
+ # Visual Studio Code
230
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
231
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
232
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
233
+ # you could uncomment the following to ignore the entire vscode folder
234
+ # .vscode/
235
+ # Temporary file for partial code execution
236
+ tempCodeRunnerFile.py
237
+
238
+ # Ruff stuff:
239
+ .ruff_cache/
240
+
241
+ # PyPI configuration file
242
+ .pypirc
243
+
244
+ # Marimo
245
+ marimo/_static/
246
+ marimo/_lsp/
247
+ __marimo__/
248
+
249
+ # Streamlit
250
+ .streamlit/secrets.toml
251
+
252
+ # Temp files
253
+ src/temp/
@@ -0,0 +1,59 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.2.0] - 2026-06-16
9
+
10
+ ### Added
11
+ - `ReportExporter` for markdown model cards, JSON run manifests, and markdown figure indexes.
12
+ - Reporting exporter tests covering model-card rendering, manifest writing, and figure-index writing.
13
+
14
+ ## [1.1.0] - 2026-05-26
15
+
16
+ ### Added
17
+ - `PanelBuilder` for panel data construction and validation workflows.
18
+ - `PanelDiagnostics` helpers for regression diagnostics on panel model outputs.
19
+ - `SpecRunner` for running reusable regression specifications.
20
+ - `BaseIRF` foundation for impulse-response style time-series models.
21
+ - `TableGenerator` and descriptive-statistics table helpers under `stats_transformer.visualization.tables`.
22
+ - Updated heatmap behavior and bundled matplotlib styles for bar-chart and time-series visualizations.
23
+ - Packaged example dataset registry with `list_examples()`, `describe_example()`, and `load_example()`.
24
+ - Tests covering packaged example discovery, metadata, loading, and unknown-dataset errors.
25
+ - `GrangerCausalityTester` for single-series and panel Granger causality tests under `stats_transformer.models.timeseries`.
26
+ - Tests covering deterministic single-series and panel Granger causality workflows.
27
+ - `TimeSeriesFeatureBuilder` for panel-safe lag, lead, and horizon feature construction.
28
+ - `ForecastEvaluator` for MAE, MSE, RMSE, mean error, MAPE, and observation-count metrics.
29
+ - `StationarityDiagnostics` for ADF and KPSS stationarity checks.
30
+ - Time-series utility tests covering panel feature construction, forecast metrics, and stationarity diagnostics.
31
+
32
+ ### Changed
33
+ - Updated README quickstart guidance to use installed-package imports and document packaged example loading.
34
+
35
+ ## [1.0.1] - 2026-05-26
36
+
37
+ ### Fixed
38
+ - Fixed `Pipeline` constructor-driven model selection by reading `model_type` from stored keyword arguments.
39
+
40
+ ## [1.0.0] - 2026-05-12
41
+
42
+ ### Added
43
+ - **Modular Visualization Framework**: Introduced a three-level architecture for highly reusable chart components.
44
+ - **Standalone Chart Components**: 9 new atomic classes for standard econometric plots (`CoefficientBarChart`, `IRFPlot`, `BinnedScatterPlot`, etc.).
45
+ - **Library-Bundled Aesthetics**: Built-in color palettes, significance stars, and matplotlib styles (`.mplstyle`) available within the package.
46
+ - **Walkthrough Documentation**: New `07_visualization.ipynb` tutorial demonstrating the abstract component API.
47
+ - **Enhanced Test Suite**: Comprehensive unit tests for all new visualization components.
48
+
49
+ ### Changed
50
+ - **Refactored Visualizers**: `DataVisualizer` and `RegressionVisualizer` now delegate to the underlying `charts/` module while maintaining backward compatibility.
51
+ - Updated `.gitignore` rules for more efficient tracking of academic datasets.
52
+
53
+
54
+ - Initial release of stats-transformer.
55
+ - Core `FeatureEngineer` for robust data transformation.
56
+ - Core `RegressionModel` for standard and robust OLS.
57
+ - Core `Pipeline` for YAML-driven execution.
58
+ - Modular visualization tools (`DataVisualizer`, `ModelVisualizer`, `RegressionVisualizer`).
59
+ - Comprehensive documentation and examples.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 corybaird
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: stats-transformer
3
+ Version: 1.2.0
4
+ Summary: A comprehensive Python library for robust macroeconomic data transformation, analysis, and visualization.
5
+ Project-URL: Homepage, https://github.com/corybaird/stats-transformer
6
+ Project-URL: Repository, https://github.com/corybaird/stats-transformer
7
+ Project-URL: Changelog, https://github.com/corybaird/stats-transformer/blob/main/CHANGELOG.md
8
+ Author-email: Cory Baird <open.empirical.macro@gmail.com>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 corybaird
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Classifier: Development Status :: 3 - Alpha
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Operating System :: OS Independent
34
+ Classifier: Programming Language :: Python :: 3
35
+ Requires-Python: >=3.12
36
+ Requires-Dist: jupyter>=1.1.1
37
+ Requires-Dist: linearmodels>=7.0
38
+ Requires-Dist: matplotlib>=3.10.9
39
+ Requires-Dist: pandas>=2.2.3
40
+ Requires-Dist: pyarrow>=19.0.0
41
+ Requires-Dist: pyreadstat>=1.3.4
42
+ Requires-Dist: pyyaml>=6.0.3
43
+ Requires-Dist: scikit-learn>=1.8.0
44
+ Requires-Dist: seaborn>=0.13.2
45
+ Requires-Dist: statsmodels>=0.14.6
46
+ Description-Content-Type: text/markdown
47
+
48
+ # stats-transformer
49
+
50
+ `stats-transformer` is a Python library for macroeconomic data transformation, analysis, and visualization. Built around a configuration-driven architecture, it handles data ingestion, resampling, feature engineering, and econometric modeling for time-series and panel datasets.
51
+
52
+ ## Features
53
+
54
+ - **Feature Engineering:** Advanced data transformations, frequency alignment, and robust merging capabilities for disparate datasets.
55
+ - **Econometric Modeling:** Built-in support for standard OLS, Robust OLS, Panel Regression, IV regression, discrete choice, time-series models, and unsupervised learning models (PCA, KMeans).
56
+ - **Visualization:** Automated generation of Exploratory Data Analysis (EDA) and regression model visual summaries (e.g., coefficient plots, residual plots, time-series tracking). Now includes a modular suite of standalone chart components for custom research plots.
57
+ - **Configuration-Driven Orchestration:** Fully integrated with YAML configuration (`params.yaml`) to enable reproducible, stage-based execution compatible with DVC pipelines.
58
+
59
+ ## Quickstart
60
+
61
+ ### 1. Installation
62
+
63
+ To use it in your project via PyPI:
64
+ ```bash
65
+ uv add stats-transformer
66
+ ```
67
+
68
+ For local development from this repository:
69
+
70
+ ```bash
71
+ uv sync
72
+ ```
73
+
74
+ ### 2. Configuration (`params.yaml`)
75
+
76
+ Define your data sources, pipeline parameters, and model specifications in a `params.yaml` file:
77
+
78
+ ```yaml
79
+ data:
80
+ featurization:
81
+ entity_column: country
82
+ datasets:
83
+ - name: macro_data
84
+ path: data/raw/macro_indicators.csv
85
+ frequency: Q
86
+
87
+ model:
88
+ model_type: panel_ols
89
+ target_variable: gdp_growth
90
+ independent_variables:
91
+ - interest_rate
92
+ - inflation
93
+
94
+ visualization:
95
+ output_dir: reports/visualizations
96
+ ```
97
+
98
+ ### 3. Usage
99
+
100
+ Load a packaged example dataset:
101
+
102
+ ```python
103
+ from stats_transformer.data import list_examples, load_example
104
+
105
+ print(list_examples())
106
+ df = load_example("macrodb_gdp_inflation")
107
+ ```
108
+
109
+ You can execute the pipeline via the command line using the `Pipeline` orchestrator:
110
+
111
+ ```bash
112
+ # Run the full end-to-end pipeline
113
+ uv run python -m stats_transformer.pipeline --config params.yaml
114
+ ```
115
+
116
+ Or you can interact with the API programmatically:
117
+
118
+ ```python
119
+ from stats_transformer import Pipeline
120
+
121
+ # Initialize the pipeline with your configuration
122
+ pipeline = Pipeline(params_path="params.yaml")
123
+
124
+ # Run specific stages sequentially
125
+ merged_data = pipeline.run(stage="resample")
126
+ transformed_data = pipeline.run(stage="features")
127
+ model_results = pipeline.run(stage="regression")
128
+
129
+ # Generate and save visualizations
130
+ pipeline.run(stage="visualization")
131
+ ```
132
+
133
+ ### 4. Testing
134
+
135
+ Verify the installation and library integrity by running the test suite:
136
+
137
+ ```bash
138
+ uv run pytest tests
139
+ ```
140
+
141
+ For more details on test coverage, see the [Testing Suite](docs/validation/testing_suite.md).
142
+
143
+ ## Documentation
144
+
145
+ - **Examples:** For examples of running the models, see [docs/validation/academic_examples.md](docs/validation/academic_examples.md).
146
+ - **Visualization Walkthrough:** For a guide on using the modular chart components, see [notebooks/07_chart_components.ipynb](notebooks/07_chart_components.ipynb).
147
+ - **System Design:** For more details on the system design, see [docs/library/architecture.md](docs/library/architecture.md).
148
+ - **File Structure:** For the standardized research folder structure, see [docs/library/file_structure.md](docs/library/file_structure.md).
149
+ - **Validation & Testing:** For details on the testing suite, see [docs/validation/testing_suite.md](docs/validation/testing_suite.md).
@@ -0,0 +1,102 @@
1
+ # stats-transformer
2
+
3
+ `stats-transformer` is a Python library for macroeconomic data transformation, analysis, and visualization. Built around a configuration-driven architecture, it handles data ingestion, resampling, feature engineering, and econometric modeling for time-series and panel datasets.
4
+
5
+ ## Features
6
+
7
+ - **Feature Engineering:** Advanced data transformations, frequency alignment, and robust merging capabilities for disparate datasets.
8
+ - **Econometric Modeling:** Built-in support for standard OLS, Robust OLS, Panel Regression, IV regression, discrete choice, time-series models, and unsupervised learning models (PCA, KMeans).
9
+ - **Visualization:** Automated generation of Exploratory Data Analysis (EDA) and regression model visual summaries (e.g., coefficient plots, residual plots, time-series tracking). Now includes a modular suite of standalone chart components for custom research plots.
10
+ - **Configuration-Driven Orchestration:** Fully integrated with YAML configuration (`params.yaml`) to enable reproducible, stage-based execution compatible with DVC pipelines.
11
+
12
+ ## Quickstart
13
+
14
+ ### 1. Installation
15
+
16
+ To use it in your project via PyPI:
17
+ ```bash
18
+ uv add stats-transformer
19
+ ```
20
+
21
+ For local development from this repository:
22
+
23
+ ```bash
24
+ uv sync
25
+ ```
26
+
27
+ ### 2. Configuration (`params.yaml`)
28
+
29
+ Define your data sources, pipeline parameters, and model specifications in a `params.yaml` file:
30
+
31
+ ```yaml
32
+ data:
33
+ featurization:
34
+ entity_column: country
35
+ datasets:
36
+ - name: macro_data
37
+ path: data/raw/macro_indicators.csv
38
+ frequency: Q
39
+
40
+ model:
41
+ model_type: panel_ols
42
+ target_variable: gdp_growth
43
+ independent_variables:
44
+ - interest_rate
45
+ - inflation
46
+
47
+ visualization:
48
+ output_dir: reports/visualizations
49
+ ```
50
+
51
+ ### 3. Usage
52
+
53
+ Load a packaged example dataset:
54
+
55
+ ```python
56
+ from stats_transformer.data import list_examples, load_example
57
+
58
+ print(list_examples())
59
+ df = load_example("macrodb_gdp_inflation")
60
+ ```
61
+
62
+ You can execute the pipeline via the command line using the `Pipeline` orchestrator:
63
+
64
+ ```bash
65
+ # Run the full end-to-end pipeline
66
+ uv run python -m stats_transformer.pipeline --config params.yaml
67
+ ```
68
+
69
+ Or you can interact with the API programmatically:
70
+
71
+ ```python
72
+ from stats_transformer import Pipeline
73
+
74
+ # Initialize the pipeline with your configuration
75
+ pipeline = Pipeline(params_path="params.yaml")
76
+
77
+ # Run specific stages sequentially
78
+ merged_data = pipeline.run(stage="resample")
79
+ transformed_data = pipeline.run(stage="features")
80
+ model_results = pipeline.run(stage="regression")
81
+
82
+ # Generate and save visualizations
83
+ pipeline.run(stage="visualization")
84
+ ```
85
+
86
+ ### 4. Testing
87
+
88
+ Verify the installation and library integrity by running the test suite:
89
+
90
+ ```bash
91
+ uv run pytest tests
92
+ ```
93
+
94
+ For more details on test coverage, see the [Testing Suite](docs/validation/testing_suite.md).
95
+
96
+ ## Documentation
97
+
98
+ - **Examples:** For examples of running the models, see [docs/validation/academic_examples.md](docs/validation/academic_examples.md).
99
+ - **Visualization Walkthrough:** For a guide on using the modular chart components, see [notebooks/07_chart_components.ipynb](notebooks/07_chart_components.ipynb).
100
+ - **System Design:** For more details on the system design, see [docs/library/architecture.md](docs/library/architecture.md).
101
+ - **File Structure:** For the standardized research folder structure, see [docs/library/file_structure.md](docs/library/file_structure.md).
102
+ - **Validation & Testing:** For details on the testing suite, see [docs/validation/testing_suite.md](docs/validation/testing_suite.md).
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "stats-transformer"
7
+ version = "1.2.0"
8
+ description = "A comprehensive Python library for robust macroeconomic data transformation, analysis, and visualization."
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ requires-python = ">=3.12"
12
+ authors = [
13
+ { name="Cory Baird", email="open.empirical.macro@gmail.com" }
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ dependencies = [
22
+ "jupyter>=1.1.1",
23
+ "linearmodels>=7.0",
24
+ "matplotlib>=3.10.9",
25
+ "pandas>=2.2.3",
26
+ "pyarrow>=19.0.0",
27
+ "pyreadstat>=1.3.4",
28
+ "pyyaml>=6.0.3",
29
+ "scikit-learn>=1.8.0",
30
+ "seaborn>=0.13.2",
31
+ "statsmodels>=0.14.6",
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/corybaird/stats-transformer"
36
+ Repository = "https://github.com/corybaird/stats-transformer"
37
+ Changelog = "https://github.com/corybaird/stats-transformer/blob/main/CHANGELOG.md"
38
+
39
+ [tool.pytest.ini_options]
40
+ pythonpath = ["src"]
41
+ [dependency-groups]
42
+ dev = [
43
+ "pytest>=9.0.3",
44
+ ]
45
+
46
+ [tool.hatch.build.targets.sdist]
47
+ exclude = [
48
+ "/.github",
49
+ "/.agents",
50
+ "/data",
51
+ "/docs",
52
+ "/notebooks",
53
+ "/references",
54
+ "/tests",
55
+ "/reports",
56
+ "/models",
57
+ ]