nowcastbox 0.1.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.
- nowcastbox-0.1.0/LICENSE +21 -0
- nowcastbox-0.1.0/PKG-INFO +274 -0
- nowcastbox-0.1.0/README.md +194 -0
- nowcastbox-0.1.0/nowcastbox/__init__.py +268 -0
- nowcastbox-0.1.0/nowcastbox/__main__.py +8 -0
- nowcastbox-0.1.0/nowcastbox/__version__.py +3 -0
- nowcastbox-0.1.0/nowcastbox/_logging.py +87 -0
- nowcastbox-0.1.0/nowcastbox/api.py +557 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/__init__.py +39 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/_base.py +86 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/_utils.py +275 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/ar.py +226 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/bridge.py +155 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/mean.py +71 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/midas.py +648 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/random_walk.py +89 -0
- nowcastbox-0.1.0/nowcastbox/benchmarks/sklearn_adapter.py +275 -0
- nowcastbox-0.1.0/nowcastbox/cli/__init__.py +17 -0
- nowcastbox-0.1.0/nowcastbox/cli/__main__.py +8 -0
- nowcastbox-0.1.0/nowcastbox/cli/main.py +405 -0
- nowcastbox-0.1.0/nowcastbox/core/__init__.py +96 -0
- nowcastbox-0.1.0/nowcastbox/core/base.py +535 -0
- nowcastbox-0.1.0/nowcastbox/core/data.py +1771 -0
- nowcastbox-0.1.0/nowcastbox/core/exceptions.py +121 -0
- nowcastbox-0.1.0/nowcastbox/core/formula.py +284 -0
- nowcastbox-0.1.0/nowcastbox/core/frequency.py +937 -0
- nowcastbox-0.1.0/nowcastbox/core/results.py +871 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/__init__.py +84 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/_http.py +261 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/_parsing.py +356 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/bcb.py +351 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/cache.py +492 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/exceptions.py +70 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/fred.py +277 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/ibge.py +463 -0
- nowcastbox-0.1.0/nowcastbox/data_sources/ipea.py +321 -0
- nowcastbox-0.1.0/nowcastbox/datasets/__init__.py +55 -0
- nowcastbox-0.1.0/nowcastbox/datasets/_io.py +354 -0
- nowcastbox-0.1.0/nowcastbox/datasets/_simulated.py +164 -0
- nowcastbox-0.1.0/nowcastbox/datasets/data/brazil_gdp_releases.csv.gz +0 -0
- nowcastbox-0.1.0/nowcastbox/datasets/data/brazil_nowcast.csv.gz +0 -0
- nowcastbox-0.1.0/nowcastbox/datasets/data/brazil_vintages.csv.gz +0 -0
- nowcastbox-0.1.0/nowcastbox/datasets/data/nyfed.csv.gz +0 -0
- nowcastbox-0.1.0/nowcastbox/datasets/data/us_fred_md.csv.gz +0 -0
- nowcastbox-0.1.0/nowcastbox/datasets/dataset.py +469 -0
- nowcastbox-0.1.0/nowcastbox/datasets/licenses/NYFED-BSD-3-Clause.txt +36 -0
- nowcastbox-0.1.0/nowcastbox/datasets/load.py +715 -0
- nowcastbox-0.1.0/nowcastbox/datasets/metadata/brazil_calendar.yaml +99 -0
- nowcastbox-0.1.0/nowcastbox/datasets/metadata/brazil_nowcast.yaml +1255 -0
- nowcastbox-0.1.0/nowcastbox/datasets/metadata/brazil_vintages.yaml +78 -0
- nowcastbox-0.1.0/nowcastbox/datasets/metadata/nyfed.yaml +452 -0
- nowcastbox-0.1.0/nowcastbox/datasets/metadata/simulated_dfm.yaml +26 -0
- nowcastbox-0.1.0/nowcastbox/datasets/metadata/us_fred_md.yaml +1594 -0
- nowcastbox-0.1.0/nowcastbox/datasets/metadata/us_grs_like.yaml +62 -0
- nowcastbox-0.1.0/nowcastbox/density/__init__.py +47 -0
- nowcastbox-0.1.0/nowcastbox/density/bootstrap.py +718 -0
- nowcastbox-0.1.0/nowcastbox/density/distribution.py +757 -0
- nowcastbox-0.1.0/nowcastbox/density/predictive.py +317 -0
- nowcastbox-0.1.0/nowcastbox/diagnostics/__init__.py +82 -0
- nowcastbox-0.1.0/nowcastbox/diagnostics/_common.py +445 -0
- nowcastbox-0.1.0/nowcastbox/diagnostics/contribution.py +423 -0
- nowcastbox-0.1.0/nowcastbox/diagnostics/convergence.py +298 -0
- nowcastbox-0.1.0/nowcastbox/diagnostics/data_quality.py +324 -0
- nowcastbox-0.1.0/nowcastbox/diagnostics/report.py +653 -0
- nowcastbox-0.1.0/nowcastbox/diagnostics/residuals.py +362 -0
- nowcastbox-0.1.0/nowcastbox/diagnostics/stability.py +672 -0
- nowcastbox-0.1.0/nowcastbox/evaluation/__init__.py +117 -0
- nowcastbox-0.1.0/nowcastbox/evaluation/backtest.py +1445 -0
- nowcastbox-0.1.0/nowcastbox/evaluation/metrics.py +386 -0
- nowcastbox-0.1.0/nowcastbox/evaluation/scoring.py +1076 -0
- nowcastbox-0.1.0/nowcastbox/evaluation/tests.py +900 -0
- nowcastbox-0.1.0/nowcastbox/experiment/__init__.py +18 -0
- nowcastbox-0.1.0/nowcastbox/experiment/experiment.py +813 -0
- nowcastbox-0.1.0/nowcastbox/models/__init__.py +29 -0
- nowcastbox-0.1.0/nowcastbox/models/_em_steps.py +1588 -0
- nowcastbox-0.1.0/nowcastbox/models/_init_conditions.py +464 -0
- nowcastbox-0.1.0/nowcastbox/models/_pca.py +314 -0
- nowcastbox-0.1.0/nowcastbox/models/bridge.py +785 -0
- nowcastbox-0.1.0/nowcastbox/models/em.py +1673 -0
- nowcastbox-0.1.0/nowcastbox/models/long_run.py +257 -0
- nowcastbox-0.1.0/nowcastbox/models/robust.py +941 -0
- nowcastbox-0.1.0/nowcastbox/models/two_step.py +1183 -0
- nowcastbox-0.1.0/nowcastbox/news/__init__.py +181 -0
- nowcastbox-0.1.0/nowcastbox/news/_linear.py +158 -0
- nowcastbox-0.1.0/nowcastbox/news/_model.py +763 -0
- nowcastbox-0.1.0/nowcastbox/news/contributions.py +279 -0
- nowcastbox-0.1.0/nowcastbox/news/decomposition.py +772 -0
- nowcastbox-0.1.0/nowcastbox/news/plotting.py +299 -0
- nowcastbox-0.1.0/nowcastbox/news/revisions.py +169 -0
- nowcastbox-0.1.0/nowcastbox/news/tracker.py +476 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/__init__.py +103 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/data.py +513 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/examples.py +96 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/runner.py +713 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/snapshots.py +1171 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/spec.py +1712 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/templates/brazil_pib.yaml +33 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/templates/connectors.yaml +52 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/templates/csv.yaml +25 -0
- nowcastbox-0.1.0/nowcastbox/pipeline/templates/simulated.yaml +26 -0
- nowcastbox-0.1.0/nowcastbox/preprocessing/__init__.py +115 -0
- nowcastbox-0.1.0/nowcastbox/preprocessing/_utils.py +288 -0
- nowcastbox-0.1.0/nowcastbox/preprocessing/aggregation.py +1085 -0
- nowcastbox-0.1.0/nowcastbox/preprocessing/missing.py +362 -0
- nowcastbox-0.1.0/nowcastbox/preprocessing/outliers.py +329 -0
- nowcastbox-0.1.0/nowcastbox/preprocessing/panel.py +432 -0
- nowcastbox-0.1.0/nowcastbox/preprocessing/transforms.py +1189 -0
- nowcastbox-0.1.0/nowcastbox/py.typed +0 -0
- nowcastbox-0.1.0/nowcastbox/reports/__init__.py +13 -0
- nowcastbox-0.1.0/nowcastbox/reports/html.py +596 -0
- nowcastbox-0.1.0/nowcastbox/reports/templates/nowcast_report.html +115 -0
- nowcastbox-0.1.0/nowcastbox/selection/__init__.py +69 -0
- nowcastbox-0.1.0/nowcastbox/selection/_panel.py +302 -0
- nowcastbox-0.1.0/nowcastbox/selection/_plot.py +145 -0
- nowcastbox-0.1.0/nowcastbox/selection/bai_ng_factors.py +437 -0
- nowcastbox-0.1.0/nowcastbox/selection/bai_ng_shocks.py +429 -0
- nowcastbox-0.1.0/nowcastbox/selection/blocks.py +1155 -0
- nowcastbox-0.1.0/nowcastbox/selection/targeted.py +896 -0
- nowcastbox-0.1.0/nowcastbox/simulate/__init__.py +19 -0
- nowcastbox-0.1.0/nowcastbox/simulate/dfm.py +282 -0
- nowcastbox-0.1.0/nowcastbox/statespace/__init__.py +94 -0
- nowcastbox-0.1.0/nowcastbox/statespace/_band_kernels.py +452 -0
- nowcastbox-0.1.0/nowcastbox/statespace/_kernels.py +452 -0
- nowcastbox-0.1.0/nowcastbox/statespace/collapse.py +227 -0
- nowcastbox-0.1.0/nowcastbox/statespace/kalman.py +487 -0
- nowcastbox-0.1.0/nowcastbox/statespace/representation.py +1032 -0
- nowcastbox-0.1.0/nowcastbox/statespace/simulate.py +221 -0
- nowcastbox-0.1.0/nowcastbox/statespace/smoother.py +254 -0
- nowcastbox-0.1.0/nowcastbox/statespace/structure.py +354 -0
- nowcastbox-0.1.0/nowcastbox/statespace/structured.py +1152 -0
- nowcastbox-0.1.0/nowcastbox/utils.py +18 -0
- nowcastbox-0.1.0/nowcastbox/vintages/__init__.py +29 -0
- nowcastbox-0.1.0/nowcastbox/vintages/_utils.py +323 -0
- nowcastbox-0.1.0/nowcastbox/vintages/calendar.py +981 -0
- nowcastbox-0.1.0/nowcastbox/vintages/pseudo_real_time.py +393 -0
- nowcastbox-0.1.0/nowcastbox/vintages/vintage_store.py +1221 -0
- nowcastbox-0.1.0/nowcastbox/visualization/__init__.py +82 -0
- nowcastbox-0.1.0/nowcastbox/visualization/_common.py +174 -0
- nowcastbox-0.1.0/nowcastbox/visualization/data_flow.py +316 -0
- nowcastbox-0.1.0/nowcastbox/visualization/diagnostics.py +104 -0
- nowcastbox-0.1.0/nowcastbox/visualization/evaluation.py +188 -0
- nowcastbox-0.1.0/nowcastbox/visualization/factors.py +564 -0
- nowcastbox-0.1.0/nowcastbox/visualization/forecast.py +652 -0
- nowcastbox-0.1.0/nowcastbox/visualization/news.py +680 -0
- nowcastbox-0.1.0/nowcastbox/visualization/registry.py +166 -0
- nowcastbox-0.1.0/nowcastbox/visualization/selection.py +216 -0
- nowcastbox-0.1.0/nowcastbox/visualization/themes.py +431 -0
- nowcastbox-0.1.0/nowcastbox.egg-info/PKG-INFO +274 -0
- nowcastbox-0.1.0/nowcastbox.egg-info/SOURCES.txt +157 -0
- nowcastbox-0.1.0/nowcastbox.egg-info/dependency_links.txt +1 -0
- nowcastbox-0.1.0/nowcastbox.egg-info/entry_points.txt +2 -0
- nowcastbox-0.1.0/nowcastbox.egg-info/requires.txt +56 -0
- nowcastbox-0.1.0/nowcastbox.egg-info/top_level.txt +1 -0
- nowcastbox-0.1.0/pyproject.toml +354 -0
- nowcastbox-0.1.0/setup.cfg +4 -0
- nowcastbox-0.1.0/tests/test_api.py +369 -0
- nowcastbox-0.1.0/tests/test_audit_packaging.py +93 -0
- nowcastbox-0.1.0/tests/test_logging.py +47 -0
- nowcastbox-0.1.0/tests/test_package.py +51 -0
nowcastbox-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gustavo Haase and Alexandre Leão Sanches
|
|
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,274 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nowcastbox
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Nowcasting with dynamic factor models in Python: two-step (Giannone-Reichlin-Small) and EM mixed-frequency (Banbura-Modugno) DFMs, Bai-Ng selection, pseudo real-time vintages, news decomposition, real-time evaluation and Brazilian data connectors
|
|
5
|
+
Author-email: Gustavo Haase <gustavo.haase@gmail.com>, Alexandre Leão Sanches <a.leaosanches@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/NowcastBox/nowcastbox
|
|
8
|
+
Project-URL: Documentation, https://nowcastbox.readthedocs.io/
|
|
9
|
+
Project-URL: Repository, https://github.com/NowcastBox/nowcastbox
|
|
10
|
+
Project-URL: Issues, https://github.com/NowcastBox/nowcastbox/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/NowcastBox/nowcastbox/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: nowcasting,dynamic factor model,DFM,mixed frequency,Kalman filter,EM algorithm,state space,macroeconomics,GDP,news decomposition,real-time data,vintages,econometrics,forecasting,Brazil
|
|
13
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
24
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
License-File: nowcastbox/datasets/licenses/NYFED-BSD-3-Clause.txt
|
|
30
|
+
Requires-Dist: numpy>=1.24.0
|
|
31
|
+
Requires-Dist: pandas>=2.0.0
|
|
32
|
+
Requires-Dist: scipy>=1.10.0
|
|
33
|
+
Requires-Dist: numba>=0.57.0
|
|
34
|
+
Requires-Dist: statsmodels>=0.14.0
|
|
35
|
+
Requires-Dist: matplotlib>=3.7.0
|
|
36
|
+
Requires-Dist: plotly>=5.14.0
|
|
37
|
+
Requires-Dist: jinja2>=3.1.0
|
|
38
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
39
|
+
Requires-Dist: requests>=2.28.0
|
|
40
|
+
Requires-Dist: joblib>=1.2.0
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: pytest>=8.0.0; extra == "test"
|
|
43
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "test"
|
|
44
|
+
Requires-Dist: pytest-xdist>=3.5.0; extra == "test"
|
|
45
|
+
Requires-Dist: pytest-timeout>=2.3.0; extra == "test"
|
|
46
|
+
Requires-Dist: pytest-benchmark>=4.0.0; extra == "test"
|
|
47
|
+
Requires-Dist: hypothesis>=6.100.0; extra == "test"
|
|
48
|
+
Requires-Dist: threadpoolctl>=3.1.0; extra == "test"
|
|
49
|
+
Requires-Dist: scikit-learn>=1.3.0; extra == "test"
|
|
50
|
+
Requires-Dist: pyarrow>=12.0.0; extra == "test"
|
|
51
|
+
Provides-Extra: dev
|
|
52
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
53
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
54
|
+
Requires-Dist: pytest-xdist>=3.5.0; extra == "dev"
|
|
55
|
+
Requires-Dist: pytest-timeout>=2.3.0; extra == "dev"
|
|
56
|
+
Requires-Dist: pytest-benchmark>=4.0.0; extra == "dev"
|
|
57
|
+
Requires-Dist: hypothesis>=6.100.0; extra == "dev"
|
|
58
|
+
Requires-Dist: threadpoolctl>=3.1.0; extra == "dev"
|
|
59
|
+
Requires-Dist: scikit-learn>=1.3.0; extra == "dev"
|
|
60
|
+
Requires-Dist: pyarrow>=12.0.0; extra == "dev"
|
|
61
|
+
Requires-Dist: ruff>=0.15.0; extra == "dev"
|
|
62
|
+
Requires-Dist: pyright==1.1.408; extra == "dev"
|
|
63
|
+
Requires-Dist: pandas-stubs==3.0.0.260204; python_version >= "3.11" and extra == "dev"
|
|
64
|
+
Requires-Dist: interrogate>=1.7.0; extra == "dev"
|
|
65
|
+
Requires-Dist: bandit>=1.7.0; extra == "dev"
|
|
66
|
+
Requires-Dist: radon>=6.0.0; extra == "dev"
|
|
67
|
+
Requires-Dist: pre-commit>=3.5.0; extra == "dev"
|
|
68
|
+
Requires-Dist: nbmake>=1.5.0; extra == "dev"
|
|
69
|
+
Provides-Extra: docs
|
|
70
|
+
Requires-Dist: mkdocs>=1.6.0; extra == "docs"
|
|
71
|
+
Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
|
|
72
|
+
Requires-Dist: mkdocstrings>=0.25.0; extra == "docs"
|
|
73
|
+
Requires-Dist: mkdocstrings-python>=1.10.0; extra == "docs"
|
|
74
|
+
Requires-Dist: mkdocs-jupyter>=0.24.0; extra == "docs"
|
|
75
|
+
Provides-Extra: data
|
|
76
|
+
Requires-Dist: pyarrow>=12.0.0; extra == "data"
|
|
77
|
+
Provides-Extra: r
|
|
78
|
+
Requires-Dist: rpy2>=3.5.0; extra == "r"
|
|
79
|
+
Dynamic: license-file
|
|
80
|
+
|
|
81
|
+
<div align="center">
|
|
82
|
+
<img src="https://raw.githubusercontent.com/NowcastBox/nowcastbox/main/docs/assets/images/logo.png" alt="NowcastBox logo" width="360">
|
|
83
|
+
|
|
84
|
+
<p><strong>Nowcasting with dynamic factor models in Python.</strong></p>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
[](https://github.com/NowcastBox/nowcastbox/actions/workflows/tests.yml)
|
|
88
|
+
[](https://codecov.io/gh/NowcastBox/nowcastbox)
|
|
89
|
+
[](https://pypi.org/project/nowcastbox/)
|
|
90
|
+
[](https://www.python.org/)
|
|
91
|
+
[](https://github.com/NowcastBox/nowcastbox/blob/main/LICENSE)
|
|
92
|
+
[](https://nowcastbox.readthedocs.io/)
|
|
93
|
+
[](https://github.com/astral-sh/ruff)
|
|
94
|
+
|
|
95
|
+
NowcastBox estimates the present, the recent past and the near future of low-frequency
|
|
96
|
+
macroeconomic variables (GDP) from large mixed-frequency panels with ragged edges. It
|
|
97
|
+
covers the whole workflow in one library:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
data -> transformations -> vintages -> factor selection -> estimation -> nowcast
|
|
101
|
+
-> news decomposition -> density -> real-time evaluation -> diagnostics -> report
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
> **Status: 0.1.0, first public release.** The API is tested on every commit
|
|
105
|
+
> (about 3,300 tests, 99 % branch coverage) but names may still change before 1.0.
|
|
106
|
+
|
|
107
|
+
## Features
|
|
108
|
+
|
|
109
|
+
| Area | What you get |
|
|
110
|
+
|---|---|
|
|
111
|
+
| **Models** | Two-step DFM (Giannone, Reichlin & Small, 2008; Doz, Giannone & Reichlin, 2011), aggregating factors or variables; mixed-frequency EM DFM with blocks and AR(1)/iid idiosyncratic components (Bańbura & Modugno, 2014); bridge equations |
|
|
112
|
+
| **Data** | `MixedFrequencyData` (daily, weekly, monthly, quarterly and annual series on one grid), named and invertible transformations (codes 0–7 of the R package plus `"dlog"`, `"yoy"`...), outliers, gap filling, flow/stock/average/Mariano-Murasawa aggregation, `prepare_panel` |
|
|
113
|
+
| **Selection** | Bai & Ng (2002) factors, Bai & Ng (2007) shocks, targeted predictors (Bai & Ng, 2008), block and variable selection in pseudo real time |
|
|
114
|
+
| **Real time** | Release calendars, pseudo real-time vintages, real vintages with revisions (`VintageStore`, Brazilian GDP vintages, ALFRED) |
|
|
115
|
+
| **Explainability** | News decomposition by series, block and category, revisions vs. releases, nowcast tracker, contributions to the level |
|
|
116
|
+
| **Evaluation** | Pseudo/real-time backtests by horizon, AR, random walk, mean, bridge, U-MIDAS, MIDAS and any scikit-learn regressor as benchmarks, Diebold-Mariano (HLN), Giacomini-White, Model Confidence Set, CRPS, log score, PIT and coverage tests |
|
|
117
|
+
| **Production** | YAML pipeline, `nowcastbox` command line, versioned snapshots, HTML reports, `NowcastExperiment` |
|
|
118
|
+
| **Data access** | BCB/SGS, IBGE/SIDRA, IPEADATA and FRED/ALFRED connectors with an on-disk cache; seven built-in datasets |
|
|
119
|
+
|
|
120
|
+
## Innovations
|
|
121
|
+
|
|
122
|
+
What NowcastBox adds to the R package `nowcasting` and to `statsmodels`' `DynamicFactorMQ`:
|
|
123
|
+
|
|
124
|
+
| # | Innovation | Status |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| I1 | **Arbitrary frequencies**: weekly/daily base grids with calendar-aware aggregation weights (4–5 weeks per month, 12–14 per quarter) | Done for the EM model; two-step/bridge/benchmarks need fixed ratios (M/Q/A) |
|
|
127
|
+
| I2 | **Scalable EM**: univariate Kalman filtering, collapsing, an exact structured smoother; ~12× faster per EM iteration than `DynamicFactorMQ` at N = 200 | Done |
|
|
128
|
+
| I3 | **Robustness**: Student-t idiosyncratic errors, outlier detection inside the EM, pandemic mask/dummies | Done |
|
|
129
|
+
| I4 | **Time-varying long-run mean** of GDP growth (Antolin-Diaz, Drechsel & Petrella, 2017) | Done |
|
|
130
|
+
| I5 | **Density nowcasts** with filtering and parameter (bootstrap) uncertainty, scored by CRPS/PIT | Done |
|
|
131
|
+
| I6 | **Explainability**: news, tracker, level contributions | Done |
|
|
132
|
+
| I7 | **Variable selection**: targeted predictors, block/variable selection validated in pseudo real time | Done |
|
|
133
|
+
| I8 | **Real vintages**: `VintageStore`, IBGE GDP vintages, ALFRED | Partial (IBC-Br vintages pending) |
|
|
134
|
+
| I9 | **DFM diagnostics**: loading stability (Breitung-Eickmeier), convergence, residuals, data quality | Done |
|
|
135
|
+
| I10 | **Production pipeline**: YAML spec, CLI, snapshots, HTML reports | Done |
|
|
136
|
+
| I11 | **Interoperability**: scikit-learn benchmarks, Parquet export | Done |
|
|
137
|
+
|
|
138
|
+
## Installation
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pip install nowcastbox
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Development version:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
git clone https://github.com/NowcastBox/nowcastbox.git
|
|
148
|
+
cd nowcastbox
|
|
149
|
+
pip install -e ".[dev]" # + tests, linters, notebooks tooling
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Python ≥ 3.10. Core dependencies: numpy, pandas ≥ 2, scipy, numba, statsmodels,
|
|
153
|
+
matplotlib, plotly, jinja2, pyyaml, requests, joblib. Extras: `[data]` (Parquet for vintage
|
|
154
|
+
stores), `[docs]`, `[test]`. With many CPU cores, small dense matrix work is often faster
|
|
155
|
+
with one BLAS thread (`OMP_NUM_THREADS=1`), see the
|
|
156
|
+
[performance guide](https://nowcastbox.readthedocs.io/en/latest/user-guide/performance/).
|
|
157
|
+
|
|
158
|
+
## Quickstart
|
|
159
|
+
|
|
160
|
+
Nowcast Brazilian GDP growth from a dozen monthly indicators, as of 15 November 2024:
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
import nowcastbox as nb
|
|
164
|
+
|
|
165
|
+
COLUMNS = ["pib", "ibc_br", "pim_geral", "pmc_varejo", "pms_volume",
|
|
166
|
+
"energia_consumo_total", "ipca", "selic", "focus_pib"]
|
|
167
|
+
ds = nb.load_brazil_nowcast(columns=COLUMNS, start="2012-01", end="2024-12")
|
|
168
|
+
panel = nb.prepare_panel(ds.data, ds.transform, keep="pib") # stationary, cleaned
|
|
169
|
+
vintage = nb.pseudo_real_time(panel, delay=ds.delay, vintage="2024-11-15")
|
|
170
|
+
|
|
171
|
+
res = nb.MixedFreqDFM(n_factors=1).fit(vintage, target="pib") # Bańbura-Modugno EM
|
|
172
|
+
print(res.summary())
|
|
173
|
+
res.nowcast.tail(3) # observed, in_sample, out_of_sample, std, 68/90 % bands
|
|
174
|
+
|
|
175
|
+
old = nb.pseudo_real_time(panel, delay=ds.delay, vintage="2024-10-15")
|
|
176
|
+
news = res.news(old, vintage, target_period="2024Q4") # what moved the nowcast?
|
|
177
|
+
news.to_frame(by="category")
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
One call does preprocessing, the Bai-Ng choice of the number of factors, estimation and
|
|
181
|
+
a density nowcast:
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
quick = nb.nowcast(vintage, target="pib", method="em", density=True)
|
|
185
|
+
quick.nowcast.tail(2)[["out_of_sample", "lower_90", "median", "upper_90"]]
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
In production, describe the nowcast in YAML and run it from the command line; every run
|
|
189
|
+
writes a versioned snapshot and news against the previous one:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
nowcastbox init nowcast.yaml -t simulated # example spec (also: brazil_pib, csv, connectors)
|
|
193
|
+
nowcastbox run nowcast.yaml # nowcast, news, density, report, snapshot
|
|
194
|
+
nowcastbox snapshots history ./snapshots # nowcast path across runs
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Datasets
|
|
198
|
+
|
|
199
|
+
| Loader | Content |
|
|
200
|
+
|---|---|
|
|
201
|
+
| `load_brazil_nowcast()` | 99 Brazilian series 2003–2026 (BCB, IBGE, IPEA): GDP, IBC-Br, PIM, PMC, PMS, labour, credit, prices, external sector, Focus; transformations, publication delays, blocks, categories |
|
|
202
|
+
| `load_brazil_calendar()` | Real release calendar of Brazilian GDP 2010Q1–2026Q2 |
|
|
203
|
+
| `load_brazil_vintages()` | 65 real-time vintages of Brazilian quarterly GDP (IBGE) |
|
|
204
|
+
| `load_nyfed()` | NY Fed Staff Nowcast replication panel (US) with blocks |
|
|
205
|
+
| `load_us_fred_md()` | FRED-MD monthly database (McCracken & Ng, 2016) + FRED-QD real GDP |
|
|
206
|
+
| `load_us_grs_like()` | GRS (2008)-like US panel built from FRED-MD |
|
|
207
|
+
| `load_simulated_dfm()` | Simulated mixed-frequency DFM with known parameters (also `nb.simulate.dfm`, `nb.simulate.weekly_dfm`) |
|
|
208
|
+
|
|
209
|
+
## Documentation and examples
|
|
210
|
+
|
|
211
|
+
- **Documentation** (MkDocs Material): getting started, a user guide with runnable
|
|
212
|
+
examples on every page, theory pages (DFM, Kalman, EM, Mariano-Murasawa, Bai-Ng, news,
|
|
213
|
+
density scoring, forecast evaluation), comparisons with R `nowcasting` and
|
|
214
|
+
`DynamicFactorMQ`, validation reports and the API reference — `mkdocs serve`.
|
|
215
|
+
- **15 example notebooks** in [`examples/notebooks`](https://github.com/NowcastBox/nowcastbox/tree/main/examples/notebooks) (saved with
|
|
216
|
+
outputs): quickstart, data preparation, a GRS (2008) approximation, Bai-Ng, the NY Fed
|
|
217
|
+
EM with blocks, Brazilian vintages, news, a 2012–2025 pseudo real-time evaluation,
|
|
218
|
+
live data, COVID robustness, the production pipeline, reports, density nowcasts,
|
|
219
|
+
weekly data and the comparison with R/statsmodels.
|
|
220
|
+
|
|
221
|
+
## Validation
|
|
222
|
+
|
|
223
|
+
The classical methods are checked against reference implementations run as black boxes
|
|
224
|
+
(`tests/reference_validation/`, [`docs/validation`](https://nowcastbox.readthedocs.io/en/latest/validation/)):
|
|
225
|
+
|
|
226
|
+
| Component | Reference | Result |
|
|
227
|
+
|---|---|---|
|
|
228
|
+
| Transformations 0–7, Mariano-Murasawa filter, `month2qtr`/`qtr2month` | R `nowcasting` 1.1.2 | identical to ≤ 1e-10 |
|
|
229
|
+
| Bai-Ng (2002) criteria | R `ICfactors` | same r* in 18/18 cases, criteria to 6e-15 |
|
|
230
|
+
| Two-step DFM with R's parameters | R `nowcast("2s"/"2s_agg")` | factors, bridge and nowcasts to ~1e-12 |
|
|
231
|
+
| EM smoother with R's final parameters | R `nowcast("EM")` | factors and smoothed data to 1e-13 |
|
|
232
|
+
| Pseudo real-time vintages | R `PRTDB` | identical in 407 vintages (incl. negative delays) |
|
|
233
|
+
| Kalman filter, likelihood, smoothed factors | statsmodels `DynamicFactorMQ` | log-likelihood to 1e-12, factors to < 1e-6 |
|
|
234
|
+
|
|
235
|
+
Documented divergences (different defaults, starting values or stopping rules, and a few
|
|
236
|
+
problems on the R side) are quantified in the validation pages. On the NY Fed EM,
|
|
237
|
+
NowcastBox runs about 30× faster than R; an EM iteration at N = 200 is about 12× faster
|
|
238
|
+
than `DynamicFactorMQ`.
|
|
239
|
+
|
|
240
|
+
## Related work
|
|
241
|
+
|
|
242
|
+
NowcastBox is an independent, MIT-licensed implementation written from the academic
|
|
243
|
+
literature. It is *inspired by* the R package
|
|
244
|
+
[`nowcasting`](https://github.com/nmecsys/nowcasting) (de Valk, de Mattos & Ferreira,
|
|
245
|
+
2019, *The R Journal*), and relates to `statsmodels.tsa.DynamicFactorMQ` and the FRBNY
|
|
246
|
+
Staff Nowcast code; these are used only as external benchmarks of results (the GPL code
|
|
247
|
+
of the R package was never read).
|
|
248
|
+
|
|
249
|
+
## Citation
|
|
250
|
+
|
|
251
|
+
If you use NowcastBox, please cite it (see [`CITATION.cff`](https://github.com/NowcastBox/nowcastbox/blob/main/CITATION.cff)):
|
|
252
|
+
|
|
253
|
+
```bibtex
|
|
254
|
+
@software{nowcastbox,
|
|
255
|
+
author = {Haase, Gustavo and Sanches, Alexandre Le{\~a}o},
|
|
256
|
+
title = {{NowcastBox}: Nowcasting with Dynamic Factor Models in Python},
|
|
257
|
+
year = {2026},
|
|
258
|
+
version = {0.1.0},
|
|
259
|
+
license = {MIT},
|
|
260
|
+
url = {https://github.com/NowcastBox/nowcastbox}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Authors
|
|
265
|
+
|
|
266
|
+
- **Gustavo Haase** (gustavo.haase@gmail.com)
|
|
267
|
+
- **Alexandre Leão Sanches** (a.leaosanches@gmail.com)
|
|
268
|
+
|
|
269
|
+
Programa de Pós-Graduação em Economia — Universidade Católica de Brasília (UCB).
|
|
270
|
+
|
|
271
|
+
## License
|
|
272
|
+
|
|
273
|
+
[MIT](https://github.com/NowcastBox/nowcastbox/blob/main/LICENSE). Bundled datasets keep the licenses of their sources (listed in each
|
|
274
|
+
dataset's metadata and documentation page).
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/NowcastBox/nowcastbox/main/docs/assets/images/logo.png" alt="NowcastBox logo" width="360">
|
|
3
|
+
|
|
4
|
+
<p><strong>Nowcasting with dynamic factor models in Python.</strong></p>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
[](https://github.com/NowcastBox/nowcastbox/actions/workflows/tests.yml)
|
|
8
|
+
[](https://codecov.io/gh/NowcastBox/nowcastbox)
|
|
9
|
+
[](https://pypi.org/project/nowcastbox/)
|
|
10
|
+
[](https://www.python.org/)
|
|
11
|
+
[](https://github.com/NowcastBox/nowcastbox/blob/main/LICENSE)
|
|
12
|
+
[](https://nowcastbox.readthedocs.io/)
|
|
13
|
+
[](https://github.com/astral-sh/ruff)
|
|
14
|
+
|
|
15
|
+
NowcastBox estimates the present, the recent past and the near future of low-frequency
|
|
16
|
+
macroeconomic variables (GDP) from large mixed-frequency panels with ragged edges. It
|
|
17
|
+
covers the whole workflow in one library:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
data -> transformations -> vintages -> factor selection -> estimation -> nowcast
|
|
21
|
+
-> news decomposition -> density -> real-time evaluation -> diagnostics -> report
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
> **Status: 0.1.0, first public release.** The API is tested on every commit
|
|
25
|
+
> (about 3,300 tests, 99 % branch coverage) but names may still change before 1.0.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
| Area | What you get |
|
|
30
|
+
|---|---|
|
|
31
|
+
| **Models** | Two-step DFM (Giannone, Reichlin & Small, 2008; Doz, Giannone & Reichlin, 2011), aggregating factors or variables; mixed-frequency EM DFM with blocks and AR(1)/iid idiosyncratic components (Bańbura & Modugno, 2014); bridge equations |
|
|
32
|
+
| **Data** | `MixedFrequencyData` (daily, weekly, monthly, quarterly and annual series on one grid), named and invertible transformations (codes 0–7 of the R package plus `"dlog"`, `"yoy"`...), outliers, gap filling, flow/stock/average/Mariano-Murasawa aggregation, `prepare_panel` |
|
|
33
|
+
| **Selection** | Bai & Ng (2002) factors, Bai & Ng (2007) shocks, targeted predictors (Bai & Ng, 2008), block and variable selection in pseudo real time |
|
|
34
|
+
| **Real time** | Release calendars, pseudo real-time vintages, real vintages with revisions (`VintageStore`, Brazilian GDP vintages, ALFRED) |
|
|
35
|
+
| **Explainability** | News decomposition by series, block and category, revisions vs. releases, nowcast tracker, contributions to the level |
|
|
36
|
+
| **Evaluation** | Pseudo/real-time backtests by horizon, AR, random walk, mean, bridge, U-MIDAS, MIDAS and any scikit-learn regressor as benchmarks, Diebold-Mariano (HLN), Giacomini-White, Model Confidence Set, CRPS, log score, PIT and coverage tests |
|
|
37
|
+
| **Production** | YAML pipeline, `nowcastbox` command line, versioned snapshots, HTML reports, `NowcastExperiment` |
|
|
38
|
+
| **Data access** | BCB/SGS, IBGE/SIDRA, IPEADATA and FRED/ALFRED connectors with an on-disk cache; seven built-in datasets |
|
|
39
|
+
|
|
40
|
+
## Innovations
|
|
41
|
+
|
|
42
|
+
What NowcastBox adds to the R package `nowcasting` and to `statsmodels`' `DynamicFactorMQ`:
|
|
43
|
+
|
|
44
|
+
| # | Innovation | Status |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| I1 | **Arbitrary frequencies**: weekly/daily base grids with calendar-aware aggregation weights (4–5 weeks per month, 12–14 per quarter) | Done for the EM model; two-step/bridge/benchmarks need fixed ratios (M/Q/A) |
|
|
47
|
+
| I2 | **Scalable EM**: univariate Kalman filtering, collapsing, an exact structured smoother; ~12× faster per EM iteration than `DynamicFactorMQ` at N = 200 | Done |
|
|
48
|
+
| I3 | **Robustness**: Student-t idiosyncratic errors, outlier detection inside the EM, pandemic mask/dummies | Done |
|
|
49
|
+
| I4 | **Time-varying long-run mean** of GDP growth (Antolin-Diaz, Drechsel & Petrella, 2017) | Done |
|
|
50
|
+
| I5 | **Density nowcasts** with filtering and parameter (bootstrap) uncertainty, scored by CRPS/PIT | Done |
|
|
51
|
+
| I6 | **Explainability**: news, tracker, level contributions | Done |
|
|
52
|
+
| I7 | **Variable selection**: targeted predictors, block/variable selection validated in pseudo real time | Done |
|
|
53
|
+
| I8 | **Real vintages**: `VintageStore`, IBGE GDP vintages, ALFRED | Partial (IBC-Br vintages pending) |
|
|
54
|
+
| I9 | **DFM diagnostics**: loading stability (Breitung-Eickmeier), convergence, residuals, data quality | Done |
|
|
55
|
+
| I10 | **Production pipeline**: YAML spec, CLI, snapshots, HTML reports | Done |
|
|
56
|
+
| I11 | **Interoperability**: scikit-learn benchmarks, Parquet export | Done |
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install nowcastbox
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Development version:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/NowcastBox/nowcastbox.git
|
|
68
|
+
cd nowcastbox
|
|
69
|
+
pip install -e ".[dev]" # + tests, linters, notebooks tooling
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Python ≥ 3.10. Core dependencies: numpy, pandas ≥ 2, scipy, numba, statsmodels,
|
|
73
|
+
matplotlib, plotly, jinja2, pyyaml, requests, joblib. Extras: `[data]` (Parquet for vintage
|
|
74
|
+
stores), `[docs]`, `[test]`. With many CPU cores, small dense matrix work is often faster
|
|
75
|
+
with one BLAS thread (`OMP_NUM_THREADS=1`), see the
|
|
76
|
+
[performance guide](https://nowcastbox.readthedocs.io/en/latest/user-guide/performance/).
|
|
77
|
+
|
|
78
|
+
## Quickstart
|
|
79
|
+
|
|
80
|
+
Nowcast Brazilian GDP growth from a dozen monthly indicators, as of 15 November 2024:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import nowcastbox as nb
|
|
84
|
+
|
|
85
|
+
COLUMNS = ["pib", "ibc_br", "pim_geral", "pmc_varejo", "pms_volume",
|
|
86
|
+
"energia_consumo_total", "ipca", "selic", "focus_pib"]
|
|
87
|
+
ds = nb.load_brazil_nowcast(columns=COLUMNS, start="2012-01", end="2024-12")
|
|
88
|
+
panel = nb.prepare_panel(ds.data, ds.transform, keep="pib") # stationary, cleaned
|
|
89
|
+
vintage = nb.pseudo_real_time(panel, delay=ds.delay, vintage="2024-11-15")
|
|
90
|
+
|
|
91
|
+
res = nb.MixedFreqDFM(n_factors=1).fit(vintage, target="pib") # Bańbura-Modugno EM
|
|
92
|
+
print(res.summary())
|
|
93
|
+
res.nowcast.tail(3) # observed, in_sample, out_of_sample, std, 68/90 % bands
|
|
94
|
+
|
|
95
|
+
old = nb.pseudo_real_time(panel, delay=ds.delay, vintage="2024-10-15")
|
|
96
|
+
news = res.news(old, vintage, target_period="2024Q4") # what moved the nowcast?
|
|
97
|
+
news.to_frame(by="category")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
One call does preprocessing, the Bai-Ng choice of the number of factors, estimation and
|
|
101
|
+
a density nowcast:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
quick = nb.nowcast(vintage, target="pib", method="em", density=True)
|
|
105
|
+
quick.nowcast.tail(2)[["out_of_sample", "lower_90", "median", "upper_90"]]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
In production, describe the nowcast in YAML and run it from the command line; every run
|
|
109
|
+
writes a versioned snapshot and news against the previous one:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
nowcastbox init nowcast.yaml -t simulated # example spec (also: brazil_pib, csv, connectors)
|
|
113
|
+
nowcastbox run nowcast.yaml # nowcast, news, density, report, snapshot
|
|
114
|
+
nowcastbox snapshots history ./snapshots # nowcast path across runs
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Datasets
|
|
118
|
+
|
|
119
|
+
| Loader | Content |
|
|
120
|
+
|---|---|
|
|
121
|
+
| `load_brazil_nowcast()` | 99 Brazilian series 2003–2026 (BCB, IBGE, IPEA): GDP, IBC-Br, PIM, PMC, PMS, labour, credit, prices, external sector, Focus; transformations, publication delays, blocks, categories |
|
|
122
|
+
| `load_brazil_calendar()` | Real release calendar of Brazilian GDP 2010Q1–2026Q2 |
|
|
123
|
+
| `load_brazil_vintages()` | 65 real-time vintages of Brazilian quarterly GDP (IBGE) |
|
|
124
|
+
| `load_nyfed()` | NY Fed Staff Nowcast replication panel (US) with blocks |
|
|
125
|
+
| `load_us_fred_md()` | FRED-MD monthly database (McCracken & Ng, 2016) + FRED-QD real GDP |
|
|
126
|
+
| `load_us_grs_like()` | GRS (2008)-like US panel built from FRED-MD |
|
|
127
|
+
| `load_simulated_dfm()` | Simulated mixed-frequency DFM with known parameters (also `nb.simulate.dfm`, `nb.simulate.weekly_dfm`) |
|
|
128
|
+
|
|
129
|
+
## Documentation and examples
|
|
130
|
+
|
|
131
|
+
- **Documentation** (MkDocs Material): getting started, a user guide with runnable
|
|
132
|
+
examples on every page, theory pages (DFM, Kalman, EM, Mariano-Murasawa, Bai-Ng, news,
|
|
133
|
+
density scoring, forecast evaluation), comparisons with R `nowcasting` and
|
|
134
|
+
`DynamicFactorMQ`, validation reports and the API reference — `mkdocs serve`.
|
|
135
|
+
- **15 example notebooks** in [`examples/notebooks`](https://github.com/NowcastBox/nowcastbox/tree/main/examples/notebooks) (saved with
|
|
136
|
+
outputs): quickstart, data preparation, a GRS (2008) approximation, Bai-Ng, the NY Fed
|
|
137
|
+
EM with blocks, Brazilian vintages, news, a 2012–2025 pseudo real-time evaluation,
|
|
138
|
+
live data, COVID robustness, the production pipeline, reports, density nowcasts,
|
|
139
|
+
weekly data and the comparison with R/statsmodels.
|
|
140
|
+
|
|
141
|
+
## Validation
|
|
142
|
+
|
|
143
|
+
The classical methods are checked against reference implementations run as black boxes
|
|
144
|
+
(`tests/reference_validation/`, [`docs/validation`](https://nowcastbox.readthedocs.io/en/latest/validation/)):
|
|
145
|
+
|
|
146
|
+
| Component | Reference | Result |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| Transformations 0–7, Mariano-Murasawa filter, `month2qtr`/`qtr2month` | R `nowcasting` 1.1.2 | identical to ≤ 1e-10 |
|
|
149
|
+
| Bai-Ng (2002) criteria | R `ICfactors` | same r* in 18/18 cases, criteria to 6e-15 |
|
|
150
|
+
| Two-step DFM with R's parameters | R `nowcast("2s"/"2s_agg")` | factors, bridge and nowcasts to ~1e-12 |
|
|
151
|
+
| EM smoother with R's final parameters | R `nowcast("EM")` | factors and smoothed data to 1e-13 |
|
|
152
|
+
| Pseudo real-time vintages | R `PRTDB` | identical in 407 vintages (incl. negative delays) |
|
|
153
|
+
| Kalman filter, likelihood, smoothed factors | statsmodels `DynamicFactorMQ` | log-likelihood to 1e-12, factors to < 1e-6 |
|
|
154
|
+
|
|
155
|
+
Documented divergences (different defaults, starting values or stopping rules, and a few
|
|
156
|
+
problems on the R side) are quantified in the validation pages. On the NY Fed EM,
|
|
157
|
+
NowcastBox runs about 30× faster than R; an EM iteration at N = 200 is about 12× faster
|
|
158
|
+
than `DynamicFactorMQ`.
|
|
159
|
+
|
|
160
|
+
## Related work
|
|
161
|
+
|
|
162
|
+
NowcastBox is an independent, MIT-licensed implementation written from the academic
|
|
163
|
+
literature. It is *inspired by* the R package
|
|
164
|
+
[`nowcasting`](https://github.com/nmecsys/nowcasting) (de Valk, de Mattos & Ferreira,
|
|
165
|
+
2019, *The R Journal*), and relates to `statsmodels.tsa.DynamicFactorMQ` and the FRBNY
|
|
166
|
+
Staff Nowcast code; these are used only as external benchmarks of results (the GPL code
|
|
167
|
+
of the R package was never read).
|
|
168
|
+
|
|
169
|
+
## Citation
|
|
170
|
+
|
|
171
|
+
If you use NowcastBox, please cite it (see [`CITATION.cff`](https://github.com/NowcastBox/nowcastbox/blob/main/CITATION.cff)):
|
|
172
|
+
|
|
173
|
+
```bibtex
|
|
174
|
+
@software{nowcastbox,
|
|
175
|
+
author = {Haase, Gustavo and Sanches, Alexandre Le{\~a}o},
|
|
176
|
+
title = {{NowcastBox}: Nowcasting with Dynamic Factor Models in Python},
|
|
177
|
+
year = {2026},
|
|
178
|
+
version = {0.1.0},
|
|
179
|
+
license = {MIT},
|
|
180
|
+
url = {https://github.com/NowcastBox/nowcastbox}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Authors
|
|
185
|
+
|
|
186
|
+
- **Gustavo Haase** (gustavo.haase@gmail.com)
|
|
187
|
+
- **Alexandre Leão Sanches** (a.leaosanches@gmail.com)
|
|
188
|
+
|
|
189
|
+
Programa de Pós-Graduação em Economia — Universidade Católica de Brasília (UCB).
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
[MIT](https://github.com/NowcastBox/nowcastbox/blob/main/LICENSE). Bundled datasets keep the licenses of their sources (listed in each
|
|
194
|
+
dataset's metadata and documentation page).
|