dfm-python 0.2.6__tar.gz → 0.2.8__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 (39) hide show
  1. {dfm_python-0.2.6 → dfm_python-0.2.8}/.gitignore +3 -1
  2. {dfm_python-0.2.6 → dfm_python-0.2.8}/PKG-INFO +12 -4
  3. {dfm_python-0.2.6 → dfm_python-0.2.8}/README.md +11 -3
  4. dfm_python-0.2.8/config/blocks/default.yaml +63 -0
  5. dfm_python-0.2.8/full_tutorial_example.ipynb +2014 -0
  6. {dfm_python-0.2.6 → dfm_python-0.2.8}/pyproject.toml +1 -1
  7. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/__init__.py +1 -1
  8. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/core/diagnostics.py +215 -6
  9. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/core/em.py +34 -28
  10. {dfm_python-0.2.6 → dfm_python-0.2.8}/tutorial/basic_tutorial.py +140 -1
  11. {dfm_python-0.2.6 → dfm_python-0.2.8}/uv.lock +699 -10
  12. dfm_python-0.2.6/config/blocks/default.yaml +0 -48
  13. dfm_python-0.2.6/full_tutorial_example.ipynb +0 -1503
  14. {dfm_python-0.2.6 → dfm_python-0.2.8}/.python-version +0 -0
  15. {dfm_python-0.2.6 → dfm_python-0.2.8}/LICENSE +0 -0
  16. {dfm_python-0.2.6 → dfm_python-0.2.8}/MANIFEST.in +0 -0
  17. {dfm_python-0.2.6 → dfm_python-0.2.8}/config/default.yaml +0 -0
  18. {dfm_python-0.2.6 → dfm_python-0.2.8}/config/series/default.yaml +0 -0
  19. {dfm_python-0.2.6 → dfm_python-0.2.8}/data/sample_data.csv +0 -0
  20. {dfm_python-0.2.6 → dfm_python-0.2.8}/data/sample_spec.csv +0 -0
  21. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/api.py +0 -0
  22. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/config.py +0 -0
  23. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/config_sources.py +0 -0
  24. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/core/__init__.py +0 -0
  25. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/core/helpers.py +0 -0
  26. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/core/numeric.py +0 -0
  27. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/data.py +0 -0
  28. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/dfm.py +0 -0
  29. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/kalman.py +0 -0
  30. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/news.py +0 -0
  31. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/dfm_python/utils.py +0 -0
  32. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/test/__init__.py +0 -0
  33. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/test/test_api.py +0 -0
  34. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/test/test_dfm.py +0 -0
  35. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/test/test_factor.py +0 -0
  36. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/test/test_kalman.py +0 -0
  37. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/test/test_numeric.py +0 -0
  38. {dfm_python-0.2.6 → dfm_python-0.2.8}/src/test/test_stability.py +0 -0
  39. {dfm_python-0.2.6 → dfm_python-0.2.8}/tutorial/hydra_tutorial.py +0 -0
@@ -212,4 +212,6 @@ __marimo__/
212
212
  *.sh
213
213
 
214
214
  Nowcasting/
215
- agent/
215
+ agent/
216
+
217
+ mybooks/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dfm-python
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: Dynamic Factor Model (DFM) estimation and nowcasting in Python
5
5
  Project-URL: Homepage, https://github.com/yourusername/dfm-python
6
6
  Project-URL: Documentation, https://github.com/yourusername/dfm-python#readme
@@ -709,12 +709,20 @@ Demonstrates:
709
709
 
710
710
  ## Project Status
711
711
 
712
- **Version**: 0.2.6
712
+ **Version**: 0.2.7
713
713
  **Status**: Stable and production-ready
714
714
  **Python**: 3.10+
715
715
  **PyPI**: https://pypi.org/project/dfm-python/
716
716
 
717
- ### Recent Improvements (v0.2.6)
717
+ ### Recent Improvements (v0.2.7)
718
+
719
+ - ✅ **Fixed C normalization issue**: C normalization now only applies when C norm is in reasonable range (0.1 ~ 10)
720
+ - Prevents Q from becoming too small when C norm is very small
721
+ - Prevents factor values from becoming extreme
722
+ - ✅ **Improved stability**: Conditional C normalization prevents pathological factor paths
723
+ - ✅ **Better diagnostics**: Added variance guard binding checks in tutorial
724
+
725
+ ### Previous Improvements (v0.2.6)
718
726
 
719
727
  - ✅ **Q matrix cap**: Factor innovation variances bounded above by 1.0 to prevent explosion
720
728
  - ✅ **R matrix cap**: Observation error variances bounded above by 10.0 for standardized data
@@ -758,7 +766,7 @@ If you use `dfm-python` in your research, please cite:
758
766
  author = {DFM Python Contributors},
759
767
  year = {2025},
760
768
  url = {https://pypi.org/project/dfm-python/},
761
- version = {0.2.6}
769
+ version = {0.2.7}
762
770
  }
763
771
  ```
764
772
 
@@ -663,12 +663,20 @@ Demonstrates:
663
663
 
664
664
  ## Project Status
665
665
 
666
- **Version**: 0.2.6
666
+ **Version**: 0.2.7
667
667
  **Status**: Stable and production-ready
668
668
  **Python**: 3.10+
669
669
  **PyPI**: https://pypi.org/project/dfm-python/
670
670
 
671
- ### Recent Improvements (v0.2.6)
671
+ ### Recent Improvements (v0.2.7)
672
+
673
+ - ✅ **Fixed C normalization issue**: C normalization now only applies when C norm is in reasonable range (0.1 ~ 10)
674
+ - Prevents Q from becoming too small when C norm is very small
675
+ - Prevents factor values from becoming extreme
676
+ - ✅ **Improved stability**: Conditional C normalization prevents pathological factor paths
677
+ - ✅ **Better diagnostics**: Added variance guard binding checks in tutorial
678
+
679
+ ### Previous Improvements (v0.2.6)
672
680
 
673
681
  - ✅ **Q matrix cap**: Factor innovation variances bounded above by 1.0 to prevent explosion
674
682
  - ✅ **R matrix cap**: Observation error variances bounded above by 10.0 for standardized data
@@ -712,7 +720,7 @@ If you use `dfm-python` in your research, please cite:
712
720
  author = {DFM Python Contributors},
713
721
  year = {2025},
714
722
  url = {https://pypi.org/project/dfm-python/},
715
- version = {0.2.6}
723
+ version = {0.2.7}
716
724
  }
717
725
  ```
718
726
 
@@ -0,0 +1,63 @@
1
+ # ============================================================================
2
+ # DFM Block Structure Configuration
3
+ # ============================================================================
4
+ # Each block corresponds to a set of series defined in config/series/default.yaml
5
+ # and represents one latent factor (or more) capturing that sector's dynamics.
6
+ #
7
+ # Each block has:
8
+ # - factors: number of latent factors in this block
9
+ # **IMPORTANT**: This should be determined based on:
10
+ # * Number of series in the block (more series may need more factors)
11
+ # * Complexity of the sector (simple sectors: 1, complex: 2-3)
12
+ # * Model fit diagnostics (check factor loadings and explained variance)
13
+ # * Typical range: 1-3 factors per block
14
+ # * Start with 1 and increase if model fit is poor
15
+ # - ar_lag: autoregressive lag order for the block-level factor (typically 1)
16
+ # - clock: optional, if block frequency differs from global clock
17
+ # - notes: optional comments
18
+ #
19
+ # **How to determine factors per block:**
20
+ # 1. Start with factors: 1 for each block (simplest model)
21
+ # 2. Check model diagnostics: factor loadings, explained variance per series
22
+ # 3. If many series in a block have low loadings (<0.3), consider increasing factors
23
+ # 4. Use cross-validation or information criteria (AIC/BIC) to compare models
24
+ # 5. Consider economic theory: does the sector have multiple distinct drivers?
25
+ #
26
+ # **Current settings are examples - adjust based on your data and modeling goals!**
27
+ # ============================================================================
28
+
29
+ Block_Global:
30
+ factors: 3 # Adjust based on data complexity and model diagnostics
31
+ ar_lag: 1
32
+ clock: m
33
+ notes: "Global (aggregate) factor driving all blocks"
34
+
35
+ Block_Consumption:
36
+ factors: 1 # Adjust based on data complexity and model diagnostics
37
+ ar_lag: 1
38
+ clock: m
39
+ notes: "Consumption-related indicators (retail sales, CSI, etc.)"
40
+
41
+ Block_Investment:
42
+ factors: 1 # Adjust based on data complexity and model diagnostics
43
+ ar_lag: 1
44
+ clock: m
45
+ notes: "Investment-related indicators (GFCF, BSI Investment, etc.)"
46
+
47
+ Block_Export:
48
+ factors: 1 # Adjust based on data complexity and model diagnostics
49
+ ar_lag: 1
50
+ clock: m
51
+ notes: "Export and external demand (goods & services, terms of trade, etc.)"
52
+
53
+ Block_Labor:
54
+ factors: 1 # Adjust based on data complexity and model diagnostics
55
+ ar_lag: 1
56
+ clock: m
57
+ notes: "Employment, unemployment, participation, labor expectations"
58
+
59
+ Block_Nominal:
60
+ factors: 1 # Adjust based on data complexity and model diagnostics
61
+ ar_lag: 1
62
+ clock: m
63
+ notes: "Nominal price-level or value indicators (PPI, CPI, trade prices, credit, etc.)"