panelbox 0.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 (111) hide show
  1. panelbox-0.2.0/.gitignore +70 -0
  2. panelbox-0.2.0/CHANGELOG.md +237 -0
  3. panelbox-0.2.0/CODE_OF_CONDUCT.md +47 -0
  4. panelbox-0.2.0/CONTRIBUTING.md +271 -0
  5. panelbox-0.2.0/LICENSE +21 -0
  6. panelbox-0.2.0/MANIFEST.in +51 -0
  7. panelbox-0.2.0/PKG-INFO +337 -0
  8. panelbox-0.2.0/QUICKSTART.md +401 -0
  9. panelbox-0.2.0/README.md +286 -0
  10. panelbox-0.2.0/docs/gmm/interpretation_guide.md +601 -0
  11. panelbox-0.2.0/docs/gmm/tutorial.md +649 -0
  12. panelbox-0.2.0/examples/basic_usage.py +205 -0
  13. panelbox-0.2.0/examples/gmm/basic_difference_gmm.py +160 -0
  14. panelbox-0.2.0/examples/gmm/basic_system_gmm.py +238 -0
  15. panelbox-0.2.0/examples/gmm/firm_growth.py +544 -0
  16. panelbox-0.2.0/examples/gmm/ols_fe_gmm_comparison.py +409 -0
  17. panelbox-0.2.0/examples/gmm/production_function.py +655 -0
  18. panelbox-0.2.0/examples/gmm/unbalanced_panel_guide.py +516 -0
  19. panelbox-0.2.0/examples/minimal_report_example.py +133 -0
  20. panelbox-0.2.0/examples/report_generation_example.py +377 -0
  21. panelbox-0.2.0/examples/simple_report_example.py +277 -0
  22. panelbox-0.2.0/examples/validation_example.py +187 -0
  23. panelbox-0.2.0/panelbox/__init__.py +67 -0
  24. panelbox-0.2.0/panelbox/__version__.py +14 -0
  25. panelbox-0.2.0/panelbox/cli/__init__.py +0 -0
  26. panelbox-0.2.0/panelbox/cli/{commands}/__init__.py +0 -0
  27. panelbox-0.2.0/panelbox/core/__init__.py +0 -0
  28. panelbox-0.2.0/panelbox/core/base_model.py +164 -0
  29. panelbox-0.2.0/panelbox/core/formula_parser.py +318 -0
  30. panelbox-0.2.0/panelbox/core/panel_data.py +387 -0
  31. panelbox-0.2.0/panelbox/core/results.py +366 -0
  32. panelbox-0.2.0/panelbox/datasets/__init__.py +0 -0
  33. panelbox-0.2.0/panelbox/datasets/{data}/__init__.py +0 -0
  34. panelbox-0.2.0/panelbox/gmm/__init__.py +65 -0
  35. panelbox-0.2.0/panelbox/gmm/difference_gmm.py +645 -0
  36. panelbox-0.2.0/panelbox/gmm/estimator.py +562 -0
  37. panelbox-0.2.0/panelbox/gmm/instruments.py +580 -0
  38. panelbox-0.2.0/panelbox/gmm/results.py +550 -0
  39. panelbox-0.2.0/panelbox/gmm/system_gmm.py +621 -0
  40. panelbox-0.2.0/panelbox/gmm/tests.py +535 -0
  41. panelbox-0.2.0/panelbox/models/__init__.py +11 -0
  42. panelbox-0.2.0/panelbox/models/dynamic/__init__.py +0 -0
  43. panelbox-0.2.0/panelbox/models/iv/__init__.py +0 -0
  44. panelbox-0.2.0/panelbox/models/static/__init__.py +13 -0
  45. panelbox-0.2.0/panelbox/models/static/fixed_effects.py +516 -0
  46. panelbox-0.2.0/panelbox/models/static/pooled_ols.py +298 -0
  47. panelbox-0.2.0/panelbox/models/static/random_effects.py +512 -0
  48. panelbox-0.2.0/panelbox/report/__init__.py +61 -0
  49. panelbox-0.2.0/panelbox/report/asset_manager.py +410 -0
  50. panelbox-0.2.0/panelbox/report/css_manager.py +472 -0
  51. panelbox-0.2.0/panelbox/report/exporters/__init__.py +15 -0
  52. panelbox-0.2.0/panelbox/report/exporters/html_exporter.py +440 -0
  53. panelbox-0.2.0/panelbox/report/exporters/latex_exporter.py +510 -0
  54. panelbox-0.2.0/panelbox/report/exporters/markdown_exporter.py +446 -0
  55. panelbox-0.2.0/panelbox/report/renderers/__init__.py +11 -0
  56. panelbox-0.2.0/panelbox/report/renderers/static/__init__.py +0 -0
  57. panelbox-0.2.0/panelbox/report/renderers/static_validation_renderer.py +341 -0
  58. panelbox-0.2.0/panelbox/report/report_manager.py +502 -0
  59. panelbox-0.2.0/panelbox/report/template_manager.py +337 -0
  60. panelbox-0.2.0/panelbox/report/transformers/__init__.py +0 -0
  61. panelbox-0.2.0/panelbox/report/transformers/static/__init__.py +0 -0
  62. panelbox-0.2.0/panelbox/report/validation_transformer.py +449 -0
  63. panelbox-0.2.0/panelbox/standard_errors/__init__.py +0 -0
  64. panelbox-0.2.0/panelbox/templates/__init__.py +0 -0
  65. panelbox-0.2.0/panelbox/templates/assets/css/base_styles.css +382 -0
  66. panelbox-0.2.0/panelbox/templates/assets/css/report_components.css +747 -0
  67. panelbox-0.2.0/panelbox/templates/assets/js/tab-navigation.js +161 -0
  68. panelbox-0.2.0/panelbox/templates/assets/js/utils.js +276 -0
  69. panelbox-0.2.0/panelbox/templates/common/footer.html +24 -0
  70. panelbox-0.2.0/panelbox/templates/common/header.html +44 -0
  71. panelbox-0.2.0/panelbox/templates/common/meta.html +5 -0
  72. panelbox-0.2.0/panelbox/templates/validation/interactive/index.html +272 -0
  73. panelbox-0.2.0/panelbox/templates/validation/interactive/partials/charts.html +58 -0
  74. panelbox-0.2.0/panelbox/templates/validation/interactive/partials/methodology.html +201 -0
  75. panelbox-0.2.0/panelbox/templates/validation/interactive/partials/overview.html +146 -0
  76. panelbox-0.2.0/panelbox/templates/validation/interactive/partials/recommendations.html +101 -0
  77. panelbox-0.2.0/panelbox/templates/validation/interactive/partials/test_results.html +231 -0
  78. panelbox-0.2.0/panelbox/utils/__init__.py +0 -0
  79. panelbox-0.2.0/panelbox/utils/formatting.py +172 -0
  80. panelbox-0.2.0/panelbox/utils/matrix_ops.py +233 -0
  81. panelbox-0.2.0/panelbox/utils/statistical.py +173 -0
  82. panelbox-0.2.0/panelbox/validation/__init__.py +58 -0
  83. panelbox-0.2.0/panelbox/validation/base.py +175 -0
  84. panelbox-0.2.0/panelbox/validation/cointegration/__init__.py +0 -0
  85. panelbox-0.2.0/panelbox/validation/cross_sectional_dependence/__init__.py +13 -0
  86. panelbox-0.2.0/panelbox/validation/cross_sectional_dependence/breusch_pagan_lm.py +222 -0
  87. panelbox-0.2.0/panelbox/validation/cross_sectional_dependence/frees.py +297 -0
  88. panelbox-0.2.0/panelbox/validation/cross_sectional_dependence/pesaran_cd.py +188 -0
  89. panelbox-0.2.0/panelbox/validation/heteroskedasticity/__init__.py +13 -0
  90. panelbox-0.2.0/panelbox/validation/heteroskedasticity/breusch_pagan.py +222 -0
  91. panelbox-0.2.0/panelbox/validation/heteroskedasticity/modified_wald.py +172 -0
  92. panelbox-0.2.0/panelbox/validation/heteroskedasticity/white.py +208 -0
  93. panelbox-0.2.0/panelbox/validation/instruments/__init__.py +0 -0
  94. panelbox-0.2.0/panelbox/validation/robustness/__init__.py +0 -0
  95. panelbox-0.2.0/panelbox/validation/serial_correlation/__init__.py +13 -0
  96. panelbox-0.2.0/panelbox/validation/serial_correlation/baltagi_wu.py +220 -0
  97. panelbox-0.2.0/panelbox/validation/serial_correlation/breusch_godfrey.py +260 -0
  98. panelbox-0.2.0/panelbox/validation/serial_correlation/wooldridge_ar.py +200 -0
  99. panelbox-0.2.0/panelbox/validation/specification/__init__.py +16 -0
  100. panelbox-0.2.0/panelbox/validation/specification/chow.py +273 -0
  101. panelbox-0.2.0/panelbox/validation/specification/hausman.py +264 -0
  102. panelbox-0.2.0/panelbox/validation/specification/mundlak.py +331 -0
  103. panelbox-0.2.0/panelbox/validation/specification/reset.py +273 -0
  104. panelbox-0.2.0/panelbox/validation/unit_root/__init__.py +0 -0
  105. panelbox-0.2.0/panelbox/validation/validation_report.py +257 -0
  106. panelbox-0.2.0/panelbox/validation/validation_suite.py +401 -0
  107. panelbox-0.2.0/panelbox.egg-info/SOURCES.txt +108 -0
  108. panelbox-0.2.0/pyproject.toml +107 -0
  109. panelbox-0.2.0/setup.cfg +4 -0
  110. panelbox-0.2.0/validation/data/abdata.csv +1032 -0
  111. panelbox-0.2.0/validation/data/abdata.dta +0 -0
@@ -0,0 +1,70 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # Unit test / coverage reports
31
+ htmlcov/
32
+ .tox/
33
+ .nox/
34
+ .coverage
35
+ .coverage.*
36
+ .cache
37
+ nosetests.xml
38
+ coverage.xml
39
+ *.cover
40
+ *.py,cover
41
+ .hypothesis/
42
+ .pytest_cache/
43
+
44
+ # Environments
45
+ .env
46
+ .venv
47
+ env/
48
+ venv/
49
+ ENV/
50
+ env.bak/
51
+ venv.bak/
52
+
53
+ # IDEs
54
+ .vscode/
55
+ .idea/
56
+ *.swp
57
+ *.swo
58
+ *~
59
+
60
+ # OS
61
+ .DS_Store
62
+ Thumbs.db
63
+
64
+ # mkdocs documentation
65
+ /site
66
+
67
+ # mypy
68
+ .mypy_cache/
69
+ .dmypy.json
70
+ dmypy.json
@@ -0,0 +1,237 @@
1
+ # Changelog
2
+
3
+ All notable changes to PanelBox 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
+ ## [Unreleased]
9
+
10
+ ### Planned
11
+ - Additional GMM estimators (LIML, CUE)
12
+ - Advanced diagnostics (weak instrument tests, C-statistic)
13
+ - Panel VAR models
14
+ - Cointegration tests
15
+ - Visualization tools
16
+
17
+ ## [0.2.0] - 2026-01-21
18
+
19
+ ### Added - Dynamic Panel GMM
20
+
21
+ **Core Features:**
22
+ - **Difference GMM** implementation (Arellano-Bond 1991)
23
+ - One-step, two-step, and iterative GMM
24
+ - Automatic instrument generation (GMM-style and IV-style)
25
+ - Collapse option to avoid instrument proliferation
26
+ - Windmeijer (2005) finite-sample standard error correction
27
+
28
+ - **System GMM** implementation (Blundell-Bond 1998)
29
+ - Combines differenced and level equations
30
+ - Level instruments for highly persistent series
31
+ - More efficient than Difference GMM for weak instruments
32
+ - Difference-in-Hansen test for level instrument validity
33
+
34
+ **Specification Tests:**
35
+ - Hansen J-test for overidentification
36
+ - Sargan test (homoskedastic version)
37
+ - Arellano-Bond AR(1) and AR(2) tests
38
+ - Instrument ratio monitoring (instruments / groups)
39
+
40
+ **Unbalanced Panel Support:**
41
+ - Smart instrument selection based on data availability
42
+ - Automatic filtering of lags with <10% coverage
43
+ - Pre-estimation warnings for problematic specifications
44
+ - Post-estimation warnings for low observation retention
45
+ - Panel balance diagnostics
46
+
47
+ **Results Class:**
48
+ - Comprehensive `GMMResults` class
49
+ - Publication-ready summary tables
50
+ - Coefficient tables with significance stars
51
+ - Specification test interpretation
52
+ - Diagnostic assessment tools
53
+
54
+ ### Added - Documentation
55
+
56
+ **GMM Documentation:**
57
+ - `panelbox/gmm/README.md` - Complete GMM reference (540 lines)
58
+ - `docs/gmm/tutorial.md` - Comprehensive tutorial (650 lines)
59
+ - `docs/gmm/interpretation_guide.md` - Results interpretation (420 lines)
60
+
61
+ **Example Scripts:**
62
+ - `examples/gmm/ols_fe_gmm_comparison.py` - Bias comparison (410 lines)
63
+ - `examples/gmm/firm_growth.py` - Intermediate example (500 lines)
64
+ - `examples/gmm/production_function.py` - Simultaneity bias (602 lines)
65
+ - `examples/gmm/unbalanced_panel_guide.py` - Practical guide (532 lines)
66
+
67
+ **Enhanced Docstrings:**
68
+ - Added 4 practical examples to `DifferenceGMM` class
69
+ - Added 3 comparison examples to `SystemGMM` class
70
+ - Added 5 usage patterns to `GMMResults` class
71
+
72
+ ### Added - Infrastructure
73
+
74
+ **Package Configuration:**
75
+ - Updated `pyproject.toml` for v0.2.0
76
+ - Created `MANIFEST.in` for distribution
77
+ - Updated `__init__.py` with GMM exports
78
+ - Version management in `__version__.py`
79
+
80
+ **Quality Assurance:**
81
+ - `.flake8` configuration for linting
82
+ - `.pre-commit-config.yaml` for automated checks
83
+ - `scripts/qa.sh` for quality checks
84
+ - `QA_GUIDE.md` documentation
85
+
86
+ ### Improved - Robustness
87
+
88
+ **Validation (Subfase 4.2):**
89
+ - Validation against Arellano-Bond (1991) employment data
90
+ - 72.8% observation retention (vs 0% before improvements)
91
+ - Coefficient within credible range [0.733, 1.045]
92
+ - All specification tests pass (AR(2) p=0.724)
93
+
94
+ **Warning System:**
95
+ - Pre-estimation warnings for:
96
+ - Unbalanced panels with many time dummies
97
+ - Not using collapse option
98
+ - Post-estimation warnings for:
99
+ - Low observation retention (<30%)
100
+ - Actionable recommendations in all warnings
101
+
102
+ **Instrument Selection:**
103
+ - `_analyze_lag_availability()` method
104
+ - Automatic filtering of weak instruments
105
+ - Coverage-based lag selection (≥10% threshold)
106
+ - Prevents instrument proliferation
107
+
108
+ ### Changed
109
+
110
+ - Updated package status from "Alpha" to "Beta"
111
+ - Improved package description for PyPI
112
+ - Updated Python version classifiers (3.9-3.12)
113
+ - Enhanced main `__init__.py` with GMM imports
114
+
115
+ ### Fixed
116
+
117
+ - Arellano-Bond validation now works with unbalanced panels
118
+ - Time dummies no longer cause 0% observation retention
119
+ - System GMM more robust with error handling
120
+ - Better handling of missing observations in instruments
121
+
122
+ ### Performance
123
+
124
+ - Smart instrument selection reduces computation time
125
+ - Efficient NumPy operations throughout
126
+ - Optimized instrument matrix construction
127
+ - Reduced memory footprint with collapse option
128
+
129
+ ## [0.1.0] - 2025-12
130
+
131
+ ### Added - Core Framework
132
+
133
+ **Core Classes:**
134
+ - `PanelData` - Panel data container with validation
135
+ - `FormulaParser` - R-style formula parsing (patsy integration)
136
+ - `PanelResults` - Base results class
137
+
138
+ **Static Models:**
139
+ - `PooledOLS` - Pooled OLS estimation
140
+ - `FixedEffects` - Within (FE) estimation
141
+ - `RandomEffects` - GLS (RE) estimation
142
+
143
+ **Specification Tests:**
144
+ - `HausmanTest` - Test for fixed vs random effects
145
+ - `HausmanTestResult` - Results container
146
+
147
+ **Standard Errors:**
148
+ - Homoskedastic (default)
149
+ - Heteroskedasticity-robust
150
+ - Clustered (one-way and two-way)
151
+
152
+ **Infrastructure:**
153
+ - Project structure setup
154
+ - Testing framework (pytest)
155
+ - Basic documentation
156
+ - MIT License
157
+
158
+ ### Added - Validation Framework
159
+
160
+ **Statistical Tests:**
161
+ - Autocorrelation tests
162
+ - Heteroskedasticity tests
163
+ - Cross-sectional dependence tests
164
+ - Unit root tests (panel)
165
+
166
+ **Reporting:**
167
+ - HTML reports with Plotly
168
+ - Static reports with Matplotlib
169
+ - LaTeX table export
170
+ - Publication-ready formatting
171
+
172
+ ---
173
+
174
+ ## Release Notes
175
+
176
+ ### v0.2.0 - GMM Implementation Complete
177
+
178
+ This release marks a major milestone with complete implementation of dynamic panel GMM estimation, bringing Stata's `xtabond2` capabilities to Python with improved robustness and user experience.
179
+
180
+ **Key Highlights:**
181
+ - 🎉 Difference GMM and System GMM fully implemented
182
+ - 🎯 72.8% improvement in unbalanced panel handling
183
+ - 📚 3,800+ lines of documentation and examples
184
+ - ⚠️ Smart warning system for problematic specifications
185
+ - ✅ Validated against Arellano-Bond (1991)
186
+
187
+ **Migration from v0.1.0:**
188
+ No breaking changes. All v0.1.0 code continues to work. New GMM features are additive:
189
+
190
+ ```python
191
+ # v0.1.0 code still works
192
+ from panelbox import FixedEffects, RandomEffects
193
+
194
+ # v0.2.0 adds GMM
195
+ from panelbox import DifferenceGMM, SystemGMM # NEW!
196
+ ```
197
+
198
+ **Known Limitations:**
199
+ - System GMM may fail with very sparse synthetic data (add appropriate try/except)
200
+ - Type hints are partial (gradual typing in progress)
201
+ - Some specification tests may be under-powered with T < 5
202
+
203
+ **Upcoming in v0.3.0:**
204
+ - Comprehensive test suite (target: >80% coverage)
205
+ - Advanced diagnostic tools (weak instrument tests)
206
+ - Performance benchmarks
207
+ - More example datasets
208
+
209
+ ---
210
+
211
+ ## Versioning
212
+
213
+ We use [Semantic Versioning](https://semver.org/):
214
+ - **Major** (X.0.0): Incompatible API changes
215
+ - **Minor** (0.X.0): New features, backwards compatible
216
+ - **Patch** (0.0.X): Bug fixes, backwards compatible
217
+
218
+ ## Contributing
219
+
220
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute to PanelBox.
221
+
222
+ ## Support
223
+
224
+ - 📫 Issues: [GitHub Issues](https://github.com/guhaase/panelbox/issues)
225
+ - 💬 Discussions: [GitHub Discussions](https://github.com/guhaase/panelbox/discussions)
226
+
227
+ ---
228
+
229
+ **Legend:**
230
+ - `Added` - New features
231
+ - `Changed` - Changes to existing features
232
+ - `Deprecated` - Soon-to-be removed features
233
+ - `Removed` - Removed features
234
+ - `Fixed` - Bug fixes
235
+ - `Security` - Security fixes
236
+ - `Performance` - Performance improvements
237
+ - `Improved` - Quality improvements
@@ -0,0 +1,47 @@
1
+ # Código de Conduta do Contributor Covenant
2
+
3
+ ## Nosso Compromisso
4
+
5
+ No interesse de promover um ambiente aberto e acolhedor, nós, como contribuidores e mantenedores, nos comprometemos a tornar a participação em nosso projeto e em nossa comunidade uma experiência livre de assédio para todos, independentemente de idade, tamanho corporal, deficiência, etnia, características sexuais, identidade e expressão de gênero, nível de experiência, educação, status socioeconômico, nacionalidade, aparência pessoal, raça, religião ou identidade e orientação sexual.
6
+
7
+ ## Nossos Padrões
8
+
9
+ Exemplos de comportamento que contribuem para criar um ambiente positivo incluem:
10
+
11
+ * Usar linguagem acolhedora e inclusiva
12
+ * Respeitar pontos de vista e experiências diferentes
13
+ * Aceitar críticas construtivas de forma graciosa
14
+ * Focar no que é melhor para a comunidade
15
+ * Mostrar empatia com outros membros da comunidade
16
+
17
+ Exemplos de comportamento inaceitável por participantes incluem:
18
+
19
+ * Uso de linguagem ou imagens sexualizadas e atenção ou avanços sexuais indesejados
20
+ * Comentários insultuosos/depreciativos (trolling) e ataques pessoais ou políticos
21
+ * Assédio público ou privado
22
+ * Publicar informações privadas de outros, como endereço físico ou eletrônico, sem permissão explícita
23
+ * Outras condutas que possam ser razoavelmente consideradas inapropriadas em um ambiente profissional
24
+
25
+ ## Nossas Responsabilidades
26
+
27
+ Os mantenedores do projeto são responsáveis por esclarecer os padrões de comportamento aceitável e devem tomar ações corretivas apropriadas e justas em resposta a quaisquer instâncias de comportamento inaceitável.
28
+
29
+ Os mantenedores do projeto têm o direito e a responsabilidade de remover, editar ou rejeitar comentários, commits, código, edições de wiki, issues e outras contribuições que não estejam alinhadas com este Código de Conduta, ou banir temporária ou permanentemente qualquer contribuidor por outros comportamentos que considerem inapropriados, ameaçadores, ofensivos ou prejudiciais.
30
+
31
+ ## Escopo
32
+
33
+ Este Código de Conduta se aplica tanto em espaços do projeto quanto em espaços públicos quando um indivíduo está representando o projeto ou sua comunidade. Exemplos de representação do projeto ou comunidade incluem usar um endereço de e-mail oficial do projeto, postar através de uma conta oficial de mídia social, ou atuar como representante nomeado em um evento online ou offline. A representação do projeto pode ser posteriormente definida e esclarecida pelos mantenedores do projeto.
34
+
35
+ ## Aplicação
36
+
37
+ Instâncias de comportamento abusivo, de assédio ou de outra forma inaceitável podem ser reportadas entrando em contato com a equipe do projeto em gustavo.haase@gmail.com. Todas as reclamações serão revisadas e investigadas e resultarão em uma resposta considerada necessária e apropriada às circunstâncias. A equipe do projeto é obrigada a manter confidencialidade em relação ao relator de um incidente. Mais detalhes de políticas de aplicação específicas podem ser publicados separadamente.
38
+
39
+ Mantenedores do projeto que não seguirem ou aplicarem o Código de Conduta de boa fé podem enfrentar repercussões temporárias ou permanentes conforme determinado por outros membros da liderança do projeto.
40
+
41
+ ## Atribuição
42
+
43
+ Este Código de Conduta é adaptado do [Contributor Covenant][homepage], versão 1.4, disponível em https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
44
+
45
+ [homepage]: https://www.contributor-covenant.org
46
+
47
+ Para respostas a perguntas comuns sobre este código de conduta, veja https://www.contributor-covenant.org/faq
@@ -0,0 +1,271 @@
1
+ # Guia de Contribuição
2
+
3
+ Obrigado por considerar contribuir para o PanelBox! Este documento fornece diretrizes para contribuir com o projeto.
4
+
5
+ ## Código de Conduta
6
+
7
+ Este projeto adere ao [Código de Conduta](CODE_OF_CONDUCT.md). Ao participar, você deve seguir este código.
8
+
9
+ ## Como Contribuir
10
+
11
+ ### Reportando Bugs
12
+
13
+ Se você encontrar um bug, por favor abra uma issue com:
14
+
15
+ - Descrição clara do problema
16
+ - Passos para reproduzir
17
+ - Comportamento esperado vs atual
18
+ - Versão do Python e do PanelBox
19
+ - Sistema operacional
20
+ - Código mínimo para reproduzir o erro
21
+
22
+ **Template de Bug Report:**
23
+
24
+ ```markdown
25
+ **Descrição do Bug**
26
+ Descrição clara e concisa do bug.
27
+
28
+ **Para Reproduzir**
29
+ Passos para reproduzir:
30
+ 1. Importar panelbox
31
+ 2. Executar código X
32
+ 3. Observar erro Y
33
+
34
+ **Comportamento Esperado**
35
+ O que deveria acontecer.
36
+
37
+ **Código para Reproduzir**
38
+ ```python
39
+ import panelbox as pb
40
+ # código mínimo aqui
41
+ ```
42
+
43
+ **Ambiente**
44
+ - Python version: 3.10
45
+ - PanelBox version: 0.1.0
46
+ - OS: Ubuntu 22.04
47
+
48
+ **Informações Adicionais**
49
+ Qualquer contexto adicional.
50
+ ```
51
+
52
+ ### Sugerindo Melhorias
53
+
54
+ Para sugerir melhorias ou novas funcionalidades:
55
+
56
+ 1. Verifique se já não existe uma issue similar
57
+ 2. Abra uma issue descrevendo:
58
+ - Motivação para a melhoria
59
+ - Descrição detalhada
60
+ - Exemplos de uso propostos
61
+ - Alternativas consideradas
62
+
63
+ ### Pull Requests
64
+
65
+ #### Processo
66
+
67
+ 1. **Fork** o repositório
68
+ 2. **Clone** seu fork: `git clone https://github.com/seu-usuario/panelbox.git`
69
+ 3. **Crie uma branch** para sua feature: `git checkout -b feature/MinhaFeature`
70
+ 4. **Configure o ambiente de desenvolvimento**:
71
+ ```bash
72
+ python -m venv venv
73
+ source venv/bin/activate # Linux/Mac
74
+ # ou
75
+ venv\Scripts\activate # Windows
76
+ pip install -e ".[dev]"
77
+ ```
78
+ 5. **Faça suas alterações** seguindo as diretrizes de código
79
+ 6. **Adicione testes** para novas funcionalidades
80
+ 7. **Execute os testes**:
81
+ ```bash
82
+ pytest
83
+ pytest --cov=panelbox tests/
84
+ ```
85
+ 8. **Execute os linters**:
86
+ ```bash
87
+ black panelbox/ tests/
88
+ isort panelbox/ tests/
89
+ flake8 panelbox/ tests/
90
+ mypy panelbox/
91
+ ```
92
+ 9. **Commit suas mudanças**:
93
+ ```bash
94
+ git commit -m "feat: Adiciona funcionalidade X"
95
+ ```
96
+ 10. **Push para sua branch**: `git push origin feature/MinhaFeature`
97
+ 11. **Abra um Pull Request** no repositório principal
98
+
99
+ #### Diretrizes de Código
100
+
101
+ **Estilo de Código**
102
+
103
+ - Siga [PEP 8](https://peps.python.org/pep-0008/)
104
+ - Use [Black](https://black.readthedocs.io/) para formatação (line-length=100)
105
+ - Use [isort](https://pycqa.github.io/isort/) para ordenar imports
106
+ - Use type hints em todas as funções públicas
107
+ - Docstrings no estilo Google
108
+
109
+ **Exemplo de Docstring:**
110
+
111
+ ```python
112
+ def estimate_model(
113
+ data: pd.DataFrame,
114
+ formula: str,
115
+ entity_col: str,
116
+ time_col: str
117
+ ) -> PanelResults:
118
+ """
119
+ Estima um modelo de painel.
120
+
121
+ Args:
122
+ data: DataFrame com dados em formato long
123
+ formula: Fórmula no estilo R (e.g., "y ~ x1 + x2")
124
+ entity_col: Nome da coluna de entidade
125
+ time_col: Nome da coluna de tempo
126
+
127
+ Returns:
128
+ Objeto PanelResults com resultados da estimação
129
+
130
+ Raises:
131
+ ValueError: Se a fórmula for inválida
132
+ KeyError: Se colunas não existirem no DataFrame
133
+
134
+ Examples:
135
+ >>> data = load_grunfeld()
136
+ >>> results = estimate_model(data, "invest ~ value", "firm", "year")
137
+ >>> print(results.summary())
138
+ """
139
+ pass
140
+ ```
141
+
142
+ **Commits**
143
+
144
+ Use [Conventional Commits](https://www.conventionalcommits.org/):
145
+
146
+ - `feat:` Nova funcionalidade
147
+ - `fix:` Correção de bug
148
+ - `docs:` Mudanças na documentação
149
+ - `style:` Formatação (sem mudança de código)
150
+ - `refactor:` Refatoração de código
151
+ - `test:` Adição ou correção de testes
152
+ - `chore:` Manutenção (build, CI, etc.)
153
+
154
+ Exemplos:
155
+ ```
156
+ feat: adiciona suporte para System GMM
157
+ fix: corrige cálculo de estatística de Hansen
158
+ docs: atualiza tutorial de modelos dinâmicos
159
+ test: adiciona testes para validação de fórmulas
160
+ ```
161
+
162
+ **Testes**
163
+
164
+ - Toda nova funcionalidade deve ter testes
165
+ - Manter cobertura de testes ≥ 90%
166
+ - Usar pytest como framework
167
+ - Organizar testes em `tests/` espelhando `panelbox/`
168
+ - Testes unitários para funções individuais
169
+ - Testes de integração para workflows completos
170
+ - Testes de benchmark contra Stata/R quando aplicável
171
+
172
+ **Exemplo de Teste:**
173
+
174
+ ```python
175
+ import pytest
176
+ import pandas as pd
177
+ import panelbox as pb
178
+ from panelbox.datasets import load_grunfeld
179
+
180
+ class TestFixedEffects:
181
+ """Testes para o modelo Fixed Effects."""
182
+
183
+ @pytest.fixture
184
+ def data(self):
185
+ """Fixture com dados de exemplo."""
186
+ return load_grunfeld()
187
+
188
+ def test_basic_estimation(self, data):
189
+ """Testa estimação básica de FE."""
190
+ model = pb.FixedEffects("invest ~ value", data, "firm", "year")
191
+ results = model.fit()
192
+
193
+ assert results.params is not None
194
+ assert len(results.params) > 0
195
+ assert results.nobs == len(data)
196
+
197
+ def test_coefficients_match_stata(self, data):
198
+ """Testa se coeficientes coincidem com Stata."""
199
+ model = pb.FixedEffects("invest ~ value + capital", data, "firm", "year")
200
+ results = model.fit()
201
+
202
+ # Valores obtidos de Stata xtreg, fe
203
+ expected_value = 0.1101
204
+ expected_capital = 0.3100
205
+
206
+ assert pytest.approx(results.params['value'], rel=1e-3) == expected_value
207
+ assert pytest.approx(results.params['capital'], rel=1e-3) == expected_capital
208
+ ```
209
+
210
+ #### Documentação
211
+
212
+ - Toda função/classe pública deve ter docstring
213
+ - Atualizar README.md se necessário
214
+ - Adicionar exemplos em `examples/` para funcionalidades complexas
215
+ - Atualizar documentação técnica em `docs/`
216
+ - Adicionar entrada no CHANGELOG.md
217
+
218
+ #### Code Review
219
+
220
+ Seu PR será revisado considerando:
221
+
222
+ - Qualidade do código
223
+ - Cobertura de testes
224
+ - Documentação
225
+ - Compatibilidade com versões Python suportadas
226
+ - Performance (se aplicável)
227
+ - Consistência com arquitetura do projeto
228
+
229
+ ## Áreas para Contribuição
230
+
231
+ ### Prioridade Alta
232
+ - [ ] Implementação de modelos core (Pooled OLS, FE, RE)
233
+ - [ ] Parser de fórmulas
234
+ - [ ] Testes de validação básicos
235
+ - [ ] Sistema de reports
236
+
237
+ ### Prioridade Média
238
+ - [ ] Modelos dinâmicos (GMM)
239
+ - [ ] Testes de validação avançados
240
+ - [ ] Erros padrão robustos
241
+ - [ ] CLI
242
+
243
+ ### Prioridade Baixa
244
+ - [ ] Testes de raiz unitária
245
+ - [ ] Testes de cointegração
246
+ - [ ] Otimizações de performance
247
+ - [ ] Integrações com outras bibliotecas
248
+
249
+ ### Documentação
250
+ - [ ] Tutoriais em português e inglês
251
+ - [ ] Exemplos de uso
252
+ - [ ] Comparações com Stata/R
253
+ - [ ] Papers técnicos
254
+
255
+ ## Comunicação
256
+
257
+ - **Issues**: Para bugs, melhorias e discussões
258
+ - **Pull Requests**: Para contribuições de código
259
+ - **Email**: gustavo.haase@gmail.com para questões privadas
260
+
261
+ ## Reconhecimento
262
+
263
+ Todos os contribuidores serão reconhecidos no README.md e na documentação.
264
+
265
+ ## Dúvidas?
266
+
267
+ Se tiver dúvidas sobre como contribuir, abra uma issue com a tag `question` ou entre em contato.
268
+
269
+ ---
270
+
271
+ Obrigado por contribuir para o PanelBox! 🎉
panelbox-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gustavo Haase, Paulo Dourado
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,51 @@
1
+ # MANIFEST.in - Specifies additional files to include in distribution
2
+
3
+ # Documentation
4
+ include README.md
5
+ include LICENSE
6
+ include CHANGELOG.md
7
+ include CONTRIBUTING.md
8
+ include CODE_OF_CONDUCT.md
9
+ include QUICKSTART.md
10
+
11
+ # Configuration files
12
+ include pyproject.toml
13
+ include .gitignore
14
+
15
+ # Include all markdown files in docs/
16
+ recursive-include docs *.md
17
+ recursive-include docs *.png
18
+ recursive-include docs *.jpg
19
+
20
+ # Include example scripts
21
+ recursive-include examples *.py
22
+ recursive-include examples *.md
23
+ recursive-include examples *.csv
24
+
25
+ # Include validation data (for testing/examples)
26
+ recursive-include validation/data *.csv
27
+ recursive-include validation/data *.dta
28
+
29
+ # Include templates for reporting
30
+ recursive-include panelbox/templates *.html
31
+ recursive-include panelbox/templates *.css
32
+ recursive-include panelbox/templates *.js
33
+
34
+ # Exclude development and build artifacts
35
+ global-exclude __pycache__
36
+ global-exclude *.py[co]
37
+ global-exclude .DS_Store
38
+ global-exclude *.so
39
+ global-exclude .coverage
40
+ global-exclude .pytest_cache
41
+
42
+ # Exclude development directories
43
+ prune desenvolvimento
44
+ prune .pytest_cache
45
+ prune .coverage
46
+ prune htmlcov
47
+ prune .mypy_cache
48
+ prune .tox
49
+ prune build
50
+ prune dist
51
+ prune *.egg-info