nowcasting-dfm 0.1.3__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.
- nowcasting_dfm-0.1.3/.gitignore +29 -0
- nowcasting_dfm-0.1.3/LICENSE +31 -0
- nowcasting_dfm-0.1.3/PKG-INFO +126 -0
- nowcasting_dfm-0.1.3/README.md +89 -0
- nowcasting_dfm-0.1.3/dfm_sp/__init__.py +62 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/__init__.py +1 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/dfm.py +1232 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/load_data.py +228 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/load_data_pandas.py +44 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/load_spec.py +149 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/remNaNs_spline.py +161 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/spec_converter.py +86 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/summarize.py +146 -0
- nowcasting_dfm-0.1.3/dfm_sp/core/update_Nowcast.py +479 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_cache.py +147 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_classes.py +152 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_daily.py +47 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_download.py +98 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_heatmap.py +44 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_news.py +92 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_plot_generator.py +113 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_plots.py +373 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_plots2.py +195 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_plots3.py +89 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_plots_blocks.py +104 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_run.py +82 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_transformations.py +83 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_update_nowcast_.py +83 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_utils.py +74 -0
- nowcasting_dfm-0.1.3/dfm_sp/sp_vintage_generator.py +142 -0
- nowcasting_dfm-0.1.3/dfm_sp/tests/__init__.py +0 -0
- nowcasting_dfm-0.1.3/dfm_sp/tests/test_dfm_core.py +85 -0
- nowcasting_dfm-0.1.3/dfm_sp/tests/test_kalman_filter.py +56 -0
- nowcasting_dfm-0.1.3/dfm_sp/tests/test_macro_transformations.py +103 -0
- nowcasting_dfm-0.1.3/dfm_sp/tests/test_main.py +0 -0
- nowcasting_dfm-0.1.3/dfm_sp/tests/test_options.py +41 -0
- nowcasting_dfm-0.1.3/dfm_sp/tests/test_transformations.py +125 -0
- nowcasting_dfm-0.1.3/pyproject.toml +90 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Caches
|
|
2
|
+
__pycache__/
|
|
3
|
+
.pickles/
|
|
4
|
+
*.pickle
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
.tox/
|
|
7
|
+
.venv/
|
|
8
|
+
.venv2/
|
|
9
|
+
|
|
10
|
+
# Build artifacts
|
|
11
|
+
dist/
|
|
12
|
+
dist2/
|
|
13
|
+
build/
|
|
14
|
+
*.egg-info/
|
|
15
|
+
|
|
16
|
+
# Env
|
|
17
|
+
.env
|
|
18
|
+
.DS_Store
|
|
19
|
+
dfm_sp/.DS_Store
|
|
20
|
+
|
|
21
|
+
# Large datasets
|
|
22
|
+
data/
|
|
23
|
+
*.xlsx
|
|
24
|
+
*.xls
|
|
25
|
+
*.csv
|
|
26
|
+
*.html
|
|
27
|
+
|
|
28
|
+
TransformedData.xlsx
|
|
29
|
+
*.pickle
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018, Federal Reserve Bank of New York (original MATLAB implementation by Eric Qian and Brandyn Bok)
|
|
4
|
+
Copyright (c) 2019, Galib Khan (independent Python translation, not affiliated with FRBNY, https://github.com/MajesticKhan/Nowcasting-Python)
|
|
5
|
+
Copyright (c) 2026, Sermet Pekin (extensions and modernisation)
|
|
6
|
+
All rights reserved.
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without
|
|
9
|
+
modification, are permitted provided that the following conditions are met:
|
|
10
|
+
|
|
11
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
12
|
+
list of conditions and the following disclaimer.
|
|
13
|
+
|
|
14
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
15
|
+
this list of conditions and the following disclaimer in the documentation
|
|
16
|
+
and/or other materials provided with the distribution.
|
|
17
|
+
|
|
18
|
+
* Neither the name of the copyright holder nor the names of its
|
|
19
|
+
contributors may be used to endorse or promote products derived from
|
|
20
|
+
this software without specific prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
23
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
24
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
25
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
26
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
27
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
28
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
29
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
30
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nowcasting-dfm
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Macroeconomic nowcasting via Dynamic Factor Models (DFM), extending the FRBNY framework (Qian & Bok) with a modern Python API: real-time vintage management, Kalman-based news decomposition, optional Numba acceleration, caching, and interactive Plotly visualizations.
|
|
5
|
+
Project-URL: Homepage, https://github.com/SermetPekin/nowcasting-dfm
|
|
6
|
+
Project-URL: Issues, https://github.com/SermetPekin/nowcasting-dfm/issues
|
|
7
|
+
Author-email: Sermet Pekin <sermet.pekin@gmail.com>
|
|
8
|
+
License: BSD-3-Clause
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: dynamic-factor-model,econometrics,em-algorithm,forecast,kalman-filter,macroeconomics,nowcasting
|
|
11
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: matplotlib>=3.10.9
|
|
25
|
+
Requires-Dist: numba>=0.66.0
|
|
26
|
+
Requires-Dist: numpy<2.3
|
|
27
|
+
Requires-Dist: openpyxl>=3.1.5
|
|
28
|
+
Requires-Dist: pandas>=2.0.0
|
|
29
|
+
Requires-Dist: plotly>=5.18.0
|
|
30
|
+
Requires-Dist: scipy>=1.11.0
|
|
31
|
+
Requires-Dist: statsmodels>=0.14.0
|
|
32
|
+
Requires-Dist: xlrd>=2.0.2
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: ipykernel>=7.3.0; extra == 'all'
|
|
35
|
+
Requires-Dist: nbformat>=5.10.4; extra == 'all'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# nowcasting-dfm
|
|
39
|
+
|
|
40
|
+
A Python implementation of the Dynamic Factor Model (DFM) for macroeconomic nowcasting, extending the FRBNY framework (Qian & Bok) with a modern API: real-time vintage management, Kalman-based news decomposition, optional Numba acceleration, caching, and interactive Plotly visualizations.
|
|
41
|
+
|
|
42
|
+
Based on "[Macroeconomic Nowcasting and Forecasting with Big Data](https://www.newyorkfed.org/research/staff_reports/sr830.html)" (Bok et al., *Staff Reports 830*, NY Fed).
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install nowcasting-dfm
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For Jupyter notebook support:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install nowcasting-dfm[all]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from dfm_sp import Options, run_with_options, run, download_sample_data
|
|
60
|
+
|
|
61
|
+
# Download sample US vintage data (only needed once)
|
|
62
|
+
download_sample_data()
|
|
63
|
+
|
|
64
|
+
# Configure and run the model
|
|
65
|
+
options = Options(
|
|
66
|
+
vintage="2016-12-16",
|
|
67
|
+
country="US",
|
|
68
|
+
spec_file_name="Spec_US_example.xls",
|
|
69
|
+
max_iter=5000,
|
|
70
|
+
use_cache=True,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
Spec, X, Time, Z = run_with_options(options)
|
|
74
|
+
result = run(X, Spec, options)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Nowcast update — decompose the impact of new data releases
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from dfm_sp import Options, sp_update_nowcast
|
|
81
|
+
|
|
82
|
+
options = Options(vintage="2016-12-16", country="US", spec_file_name="Spec_US_example.xls")
|
|
83
|
+
|
|
84
|
+
result = sp_update_nowcast(
|
|
85
|
+
options,
|
|
86
|
+
new_date="2016-12-23",
|
|
87
|
+
series="GDPC1",
|
|
88
|
+
period="2016q4",
|
|
89
|
+
)
|
|
90
|
+
result["fig"].show() # interactive Plotly waterfall chart
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Architecture & Optimizations
|
|
94
|
+
|
|
95
|
+
* **Modular Architecture (`sp_*` modules):** Transitioned the procedural scripts into a structured object-oriented library (`dfm_sp`). Introduced formal configuration dataclasses (`sp_classes.py`) and modular plotting logic (`sp_plots.py`) to streamline experimental workflows.
|
|
96
|
+
* **Centralized Transformations (`sp_transformations.py`):** Abstracted legacy nested-lambda blocks into a dedicated `MacroTransformations` registry. Implements 4 new stationary bounds (`dln`, `dl1`, `d2l`, `zsc`) allowing complex structural vector geometries without inline array indexing side-effects.
|
|
97
|
+
* **Execution Caching:** Integrated a `use_cache` parameter into the `Options` class. High-dimensional Expectation-Maximization (EM) operations are serialized, allowing rapid iteration on visualization and reporting without repeatedly waiting on matrix re-calculations.
|
|
98
|
+
* **Numba JIT Acceleration:** The core Expectation-Maximization algorithm and Kalman Filter transition loop have been rewritten for ahead-of-time C compilation via `@numba.jit`. This drastically cuts execution time for extensive parameter searches (`max_iter` 5000+).
|
|
99
|
+
* **Automated Econometric Validation:** Integrated Augmented Dickey-Fuller (ADF) testing via `statsmodels` to evaluate series stationarity post-transformation, directly guarding against feeding non-stationary data into the DFM.
|
|
100
|
+
* **Testing Suite:** A comprehensive `pytest` suite enforces the mathematical integrity of the Numba translation against the pure Python implementation, particularly concerning NaN propagation ("ragged edges") inherent in raw macroeconomic releases.
|
|
101
|
+
* **Dependency Management:** Migrated to Python 3.14+ utilizing `uv` and `pyproject.toml` for hermetic environment resolution.
|
|
102
|
+
* **HTML Reporting:** Automatically generates standalone Plotly HTML reports containing Factor Contributions, Likelihood optimizations, and Model loadings.
|
|
103
|
+
* **"News" Attribution Waterfalls:** Provides native bindings (`sp_news.py`) to dissect the mathematical drivers behind week-over-week DFM forecast changes. Generates Plotly Waterfall charts bridging `Actual vs Expected` impacts weighted by the Kalman gain.
|
|
104
|
+
* **Pseudo-Real-Time Synthesizer:** Includes `sp_vintage_generator.py` for automatically simulating historical "ragged-edge" data matrices from a single modern dataset. Maps execution algorithms (e.g. `1st Friday of the Month`, `15th of the Month`) to dynamically blind data that had not yet been published, allowing mathematically un-cheated backtesting independent of the FRED ALFRED API.
|
|
105
|
+
|
|
106
|
+
## Repository Structure
|
|
107
|
+
|
|
108
|
+
* `data/` : Example US macro series retrieved from [FRED](https://fred.stlouisfed.org/).
|
|
109
|
+
* `dfm_sp/` : Core package module encompassing the execution engines and analytics.
|
|
110
|
+
* `Functions/` : Kalman Filtering, Spline imputation, and EM-Step mathematics.
|
|
111
|
+
* `tests/` : Component tests simulating missing economic data and ragged tails.
|
|
112
|
+
* `main.py` : Execution script illustrating the estimation of a standard panel and generating visualization artifacts.
|
|
113
|
+
* `example_Nowcast.py` : Demonstration of out-of-sample prediction mechanics (e.g., real GDP growth).
|
|
114
|
+
* `Spec_US_example.xls` : Model specification configurations, dictating series transformations and blocking parameters for mixed-frequency analysis.
|
|
115
|
+
|
|
116
|
+
## Attribution & Notice
|
|
117
|
+
|
|
118
|
+
This package is not affiliated with the Federal Reserve Bank of New York.
|
|
119
|
+
|
|
120
|
+
The lineage of this work is:
|
|
121
|
+
|
|
122
|
+
1. **Eric Qian & Brandyn Bok (FRBNY)** — original MATLAB implementation of the DFM nowcasting framework ([FRBNY-TimeSeriesAnalysis/Nowcasting](https://github.com/FRBNY-TimeSeriesAnalysis/Nowcasting))
|
|
123
|
+
2. **Galib Khan (MajesticKhan)** — independent Python translation ([MajesticKhan/Nowcasting-Python](https://github.com/MajesticKhan/Nowcasting-Python))
|
|
124
|
+
3. **Sermet Pekin** — this package: modernised API, caching, plotting layer, news decomposition, vintage synthesizer, and testing suite
|
|
125
|
+
|
|
126
|
+
Academic credit for the methodology: Bok, Caratelli, Giannone, Sbordone & Tambalotti, "[Macroeconomic Nowcasting and Forecasting with Big Data](https://www.newyorkfed.org/research/staff_reports/sr830.html)", *Staff Reports 830*, Federal Reserve Bank of New York.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# nowcasting-dfm
|
|
2
|
+
|
|
3
|
+
A Python implementation of the Dynamic Factor Model (DFM) for macroeconomic nowcasting, extending the FRBNY framework (Qian & Bok) with a modern API: real-time vintage management, Kalman-based news decomposition, optional Numba acceleration, caching, and interactive Plotly visualizations.
|
|
4
|
+
|
|
5
|
+
Based on "[Macroeconomic Nowcasting and Forecasting with Big Data](https://www.newyorkfed.org/research/staff_reports/sr830.html)" (Bok et al., *Staff Reports 830*, NY Fed).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install nowcasting-dfm
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For Jupyter notebook support:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install nowcasting-dfm[all]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from dfm_sp import Options, run_with_options, run, download_sample_data
|
|
23
|
+
|
|
24
|
+
# Download sample US vintage data (only needed once)
|
|
25
|
+
download_sample_data()
|
|
26
|
+
|
|
27
|
+
# Configure and run the model
|
|
28
|
+
options = Options(
|
|
29
|
+
vintage="2016-12-16",
|
|
30
|
+
country="US",
|
|
31
|
+
spec_file_name="Spec_US_example.xls",
|
|
32
|
+
max_iter=5000,
|
|
33
|
+
use_cache=True,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
Spec, X, Time, Z = run_with_options(options)
|
|
37
|
+
result = run(X, Spec, options)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Nowcast update — decompose the impact of new data releases
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from dfm_sp import Options, sp_update_nowcast
|
|
44
|
+
|
|
45
|
+
options = Options(vintage="2016-12-16", country="US", spec_file_name="Spec_US_example.xls")
|
|
46
|
+
|
|
47
|
+
result = sp_update_nowcast(
|
|
48
|
+
options,
|
|
49
|
+
new_date="2016-12-23",
|
|
50
|
+
series="GDPC1",
|
|
51
|
+
period="2016q4",
|
|
52
|
+
)
|
|
53
|
+
result["fig"].show() # interactive Plotly waterfall chart
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Architecture & Optimizations
|
|
57
|
+
|
|
58
|
+
* **Modular Architecture (`sp_*` modules):** Transitioned the procedural scripts into a structured object-oriented library (`dfm_sp`). Introduced formal configuration dataclasses (`sp_classes.py`) and modular plotting logic (`sp_plots.py`) to streamline experimental workflows.
|
|
59
|
+
* **Centralized Transformations (`sp_transformations.py`):** Abstracted legacy nested-lambda blocks into a dedicated `MacroTransformations` registry. Implements 4 new stationary bounds (`dln`, `dl1`, `d2l`, `zsc`) allowing complex structural vector geometries without inline array indexing side-effects.
|
|
60
|
+
* **Execution Caching:** Integrated a `use_cache` parameter into the `Options` class. High-dimensional Expectation-Maximization (EM) operations are serialized, allowing rapid iteration on visualization and reporting without repeatedly waiting on matrix re-calculations.
|
|
61
|
+
* **Numba JIT Acceleration:** The core Expectation-Maximization algorithm and Kalman Filter transition loop have been rewritten for ahead-of-time C compilation via `@numba.jit`. This drastically cuts execution time for extensive parameter searches (`max_iter` 5000+).
|
|
62
|
+
* **Automated Econometric Validation:** Integrated Augmented Dickey-Fuller (ADF) testing via `statsmodels` to evaluate series stationarity post-transformation, directly guarding against feeding non-stationary data into the DFM.
|
|
63
|
+
* **Testing Suite:** A comprehensive `pytest` suite enforces the mathematical integrity of the Numba translation against the pure Python implementation, particularly concerning NaN propagation ("ragged edges") inherent in raw macroeconomic releases.
|
|
64
|
+
* **Dependency Management:** Migrated to Python 3.14+ utilizing `uv` and `pyproject.toml` for hermetic environment resolution.
|
|
65
|
+
* **HTML Reporting:** Automatically generates standalone Plotly HTML reports containing Factor Contributions, Likelihood optimizations, and Model loadings.
|
|
66
|
+
* **"News" Attribution Waterfalls:** Provides native bindings (`sp_news.py`) to dissect the mathematical drivers behind week-over-week DFM forecast changes. Generates Plotly Waterfall charts bridging `Actual vs Expected` impacts weighted by the Kalman gain.
|
|
67
|
+
* **Pseudo-Real-Time Synthesizer:** Includes `sp_vintage_generator.py` for automatically simulating historical "ragged-edge" data matrices from a single modern dataset. Maps execution algorithms (e.g. `1st Friday of the Month`, `15th of the Month`) to dynamically blind data that had not yet been published, allowing mathematically un-cheated backtesting independent of the FRED ALFRED API.
|
|
68
|
+
|
|
69
|
+
## Repository Structure
|
|
70
|
+
|
|
71
|
+
* `data/` : Example US macro series retrieved from [FRED](https://fred.stlouisfed.org/).
|
|
72
|
+
* `dfm_sp/` : Core package module encompassing the execution engines and analytics.
|
|
73
|
+
* `Functions/` : Kalman Filtering, Spline imputation, and EM-Step mathematics.
|
|
74
|
+
* `tests/` : Component tests simulating missing economic data and ragged tails.
|
|
75
|
+
* `main.py` : Execution script illustrating the estimation of a standard panel and generating visualization artifacts.
|
|
76
|
+
* `example_Nowcast.py` : Demonstration of out-of-sample prediction mechanics (e.g., real GDP growth).
|
|
77
|
+
* `Spec_US_example.xls` : Model specification configurations, dictating series transformations and blocking parameters for mixed-frequency analysis.
|
|
78
|
+
|
|
79
|
+
## Attribution & Notice
|
|
80
|
+
|
|
81
|
+
This package is not affiliated with the Federal Reserve Bank of New York.
|
|
82
|
+
|
|
83
|
+
The lineage of this work is:
|
|
84
|
+
|
|
85
|
+
1. **Eric Qian & Brandyn Bok (FRBNY)** — original MATLAB implementation of the DFM nowcasting framework ([FRBNY-TimeSeriesAnalysis/Nowcasting](https://github.com/FRBNY-TimeSeriesAnalysis/Nowcasting))
|
|
86
|
+
2. **Galib Khan (MajesticKhan)** — independent Python translation ([MajesticKhan/Nowcasting-Python](https://github.com/MajesticKhan/Nowcasting-Python))
|
|
87
|
+
3. **Sermet Pekin** — this package: modernised API, caching, plotting layer, news decomposition, vintage synthesizer, and testing suite
|
|
88
|
+
|
|
89
|
+
Academic credit for the methodology: Bok, Caratelli, Giannone, Sbordone & Tambalotti, "[Macroeconomic Nowcasting and Forecasting with Big Data](https://www.newyorkfed.org/research/staff_reports/sr830.html)", *Staff Reports 830*, Federal Reserve Bank of New York.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
|
|
3
|
+
# Suppress annoying standard warnings during import
|
|
4
|
+
warnings.filterwarnings("ignore", category=FutureWarning)
|
|
5
|
+
|
|
6
|
+
from dfm_sp.core.dfm import dfm
|
|
7
|
+
from dfm_sp.core.summarize import summarize
|
|
8
|
+
from dfm_sp.sp_utils import get_latest, Timer
|
|
9
|
+
from dfm_sp.sp_update_nowcast_ import sp_update_nowcast
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from dfm_sp.sp_daily import daily_report
|
|
14
|
+
|
|
15
|
+
# Exposed Public API (Easier names)
|
|
16
|
+
from dfm_sp.sp_classes import Options, ResultObject
|
|
17
|
+
from dfm_sp.core.load_spec import SpecConfig, load_spec
|
|
18
|
+
from dfm_sp.core.load_data import load_data
|
|
19
|
+
from dfm_sp.core.dfm import dfm
|
|
20
|
+
from dfm_sp.core.summarize import summarize
|
|
21
|
+
from dfm_sp.sp_run import run_with_options, run
|
|
22
|
+
from dfm_sp.sp_plots import (
|
|
23
|
+
plot_transformed_data,
|
|
24
|
+
plot_loglik,
|
|
25
|
+
plot_common,
|
|
26
|
+
plot_loglik_together,
|
|
27
|
+
plot_projection_x_over_y,
|
|
28
|
+
)
|
|
29
|
+
from dfm_sp.sp_plots_blocks import plot_block_contributions
|
|
30
|
+
from dfm_sp.sp_news import plot_news_waterfall
|
|
31
|
+
|
|
32
|
+
# Expose Vintage Synthesizer heavily simplified
|
|
33
|
+
from dfm_sp.sp_vintage_generator import VintageMaker, FixedDayRule, WeekdayRule
|
|
34
|
+
|
|
35
|
+
# Data download helper
|
|
36
|
+
from dfm_sp.sp_download import download_sample_data
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
# Core DFM Loop
|
|
40
|
+
"Options",
|
|
41
|
+
"SpecConfig",
|
|
42
|
+
"ResultObject",
|
|
43
|
+
"run_with_options",
|
|
44
|
+
"run",
|
|
45
|
+
# Plotting/Visualizations
|
|
46
|
+
"plot_transformed_data",
|
|
47
|
+
"plot_loglik",
|
|
48
|
+
"plot_common",
|
|
49
|
+
"plot_loglik_together",
|
|
50
|
+
"plot_projection_x_over_y",
|
|
51
|
+
"plot_block_contributions",
|
|
52
|
+
"plot_news_waterfall",
|
|
53
|
+
# Pre-Processing
|
|
54
|
+
"VintageMaker",
|
|
55
|
+
"FixedDayRule",
|
|
56
|
+
"WeekdayRule",
|
|
57
|
+
# Classic Endpoints
|
|
58
|
+
"load_spec",
|
|
59
|
+
"load_data",
|
|
60
|
+
"dfm",
|
|
61
|
+
"summarize",
|
|
62
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|