systemgmmkit 0.5.6__tar.gz → 0.5.8.dev0__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.
- systemgmmkit-0.5.8.dev0/PKG-INFO +624 -0
- systemgmmkit-0.5.8.dev0/README.md +582 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/pyproject.toml +9 -2
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/__init__.py +15 -1
- systemgmmkit-0.5.8.dev0/src/systemgmmkit/linear.py +417 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/native_gmm.py +753 -47
- systemgmmkit-0.5.8.dev0/src/systemgmmkit/postestimation.py +296 -0
- systemgmmkit-0.5.8.dev0/src/systemgmmkit.egg-info/PKG-INFO +624 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit.egg-info/SOURCES.txt +3 -0
- systemgmmkit-0.5.8.dev0/tests/test_ols_postestimation.py +151 -0
- systemgmmkit-0.5.6/PKG-INFO +0 -847
- systemgmmkit-0.5.6/README.md +0 -805
- systemgmmkit-0.5.6/src/systemgmmkit.egg-info/PKG-INFO +0 -847
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/LICENSE +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/setup.cfg +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/cli.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/diagnostics/__init__.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/diagnostics/gmm.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/diagnostics/panel.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/diagnostics.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/dynamic_panel.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/estimators/first_difference.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/fixed_effects.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/gmm_parity_policy.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/panel_iv.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/parity.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/presets.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/pydynpd_backend.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/pydynpd_output_parser.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/random_effects.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/reporting/__init__.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/reporting/parity.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/reporting.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/spec.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/suite.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/tables.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit/validation.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit.egg-info/dependency_links.txt +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit.egg-info/entry_points.txt +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit.egg-info/requires.txt +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/src/systemgmmkit.egg-info/top_level.txt +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_apply_gmm_parity_policy_script.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_first_difference_reporting.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_fixed_effects.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_generic_presets.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_gmm_parity_policy.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_parity_native_gmm.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_pydynpd_backend.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_pydynpd_output_parser.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_random_effects_iv_tables.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_spec_command.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_validation_diagnostics.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_xtabond2_system_gmm_decomposition_controls_certification.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_xtabond2_system_gmm_decomposition_controls_scaffold.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_xtabond2_system_gmm_no_controls_certification.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_xtabond2_system_gmm_no_controls_scaffold.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_xtabond2_system_gmm_parity.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_xtabond2_system_gmm_three_way_controls_certification.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_xtabond2_system_gmm_three_way_controls_scaffold.py +0 -0
- {systemgmmkit-0.5.6 → systemgmmkit-0.5.8.dev0}/tests/test_xtabond2_system_gmm_uncorrected_se_baseline.py +0 -0
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: systemgmmkit
|
|
3
|
+
Version: 0.5.8.dev0
|
|
4
|
+
Summary: Generic panel-data econometrics workflow helpers for FE, RE, IV/2SLS, and Difference/System GMM in Python.
|
|
5
|
+
Author: Oluwajuwon Mayomi Akanbi
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Akanom/systemgmmkit
|
|
8
|
+
Project-URL: Repository, https://github.com/Akanom/systemgmmkit
|
|
9
|
+
Project-URL: Issues, https://github.com/Akanom/systemgmmkit/issues
|
|
10
|
+
Keywords: econometrics,panel-data,fixed-effects,random-effects,panel-iv,2sls,system-gmm,difference-gmm,dynamic-panel,arellano-bond,blundell-bond,stata,xtabond2
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numpy>=1.23
|
|
23
|
+
Requires-Dist: pandas>=1.5
|
|
24
|
+
Requires-Dist: scipy>=1.9
|
|
25
|
+
Provides-Extra: pydynpd
|
|
26
|
+
Requires-Dist: pydynpd>=0.2.2; extra == "pydynpd"
|
|
27
|
+
Provides-Extra: fe
|
|
28
|
+
Requires-Dist: linearmodels>=5; extra == "fe"
|
|
29
|
+
Provides-Extra: reports
|
|
30
|
+
Requires-Dist: tabulate>=0.9; extra == "reports"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
35
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
36
|
+
Requires-Dist: twine>=5; extra == "dev"
|
|
37
|
+
Provides-Extra: all
|
|
38
|
+
Requires-Dist: pydynpd>=0.2.2; extra == "all"
|
|
39
|
+
Requires-Dist: linearmodels>=5; extra == "all"
|
|
40
|
+
Requires-Dist: tabulate>=0.9; extra == "all"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# systemgmmkit
|
|
44
|
+
|
|
45
|
+
[](https://pypi.org/project/systemgmmkit/)
|
|
46
|
+
[](https://pypi.org/project/systemgmmkit/)
|
|
47
|
+
[](LICENSE)
|
|
48
|
+
[](https://github.com/Akanom/systemgmmkit/actions/workflows/ci.yml)
|
|
49
|
+
[](https://github.com/Akanom/systemgmmkit/actions/workflows/publish.yml)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
# systemgmmkit 0.5.8.dev0
|
|
54
|
+
|
|
55
|
+
`systemgmmkit` is a Python package for panel-data econometrics that provides a unified workflow from baseline linear models to advanced dynamic-panel GMM estimation.
|
|
56
|
+
|
|
57
|
+
The package combines:
|
|
58
|
+
|
|
59
|
+
* Ordinary Least Squares (OLS)
|
|
60
|
+
* Pooled OLS
|
|
61
|
+
* Fixed Effects
|
|
62
|
+
* Random Effects
|
|
63
|
+
* Panel IV / 2SLS
|
|
64
|
+
* Difference GMM
|
|
65
|
+
* System GMM
|
|
66
|
+
* Diagnostics
|
|
67
|
+
* Post-estimation
|
|
68
|
+
* Reproducible reporting
|
|
69
|
+
|
|
70
|
+
within a single framework.
|
|
71
|
+
|
|
72
|
+
The package is designed for applied empirical research in economics, finance, management, operations, public policy, political economy, industrial organization, productivity analysis, and other panel-data settings.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
# Why systemgmmkit?
|
|
77
|
+
|
|
78
|
+
Many econometric workflows require researchers to combine multiple packages to obtain:
|
|
79
|
+
|
|
80
|
+
* baseline estimation;
|
|
81
|
+
* panel estimators;
|
|
82
|
+
* instrumental-variable estimation;
|
|
83
|
+
* dynamic-panel estimation;
|
|
84
|
+
* diagnostics;
|
|
85
|
+
* post-estimation;
|
|
86
|
+
* publication-ready reporting.
|
|
87
|
+
|
|
88
|
+
`systemgmmkit` aims to provide these capabilities through a consistent and reproducible API.
|
|
89
|
+
|
|
90
|
+
The package is built around four principles:
|
|
91
|
+
|
|
92
|
+
1. Explicit model specification.
|
|
93
|
+
2. Reproducible workflows.
|
|
94
|
+
3. Transparent diagnostics.
|
|
95
|
+
4. Verification against established reference implementations.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
# What's New in 0.5.8
|
|
100
|
+
|
|
101
|
+
Version `0.5.8.dev0` introduces the first public post-estimation framework and completes the baseline linear-model workflow.
|
|
102
|
+
|
|
103
|
+
New public APIs include:
|
|
104
|
+
|
|
105
|
+
* `OLSSpec`
|
|
106
|
+
* `PooledOLSSpec`
|
|
107
|
+
* `run_ols()`
|
|
108
|
+
* `run_pooled_ols()`
|
|
109
|
+
* `predict()`
|
|
110
|
+
* `fitted_values()`
|
|
111
|
+
* `residuals()`
|
|
112
|
+
* `vcov()`
|
|
113
|
+
* `confint()`
|
|
114
|
+
* `lincom()`
|
|
115
|
+
* `wald_test()`
|
|
116
|
+
* `marginal_effects()`
|
|
117
|
+
|
|
118
|
+
These additions establish the foundation for future advanced post-estimation capabilities while maintaining compatibility with the broader panel-estimation framework.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
# Core Estimator Coverage
|
|
123
|
+
|
|
124
|
+
## Linear Models
|
|
125
|
+
|
|
126
|
+
* Ordinary Least Squares
|
|
127
|
+
* Robust OLS
|
|
128
|
+
* Pooled OLS
|
|
129
|
+
* Clustered OLS
|
|
130
|
+
|
|
131
|
+
## Panel Models
|
|
132
|
+
|
|
133
|
+
* One-Way Fixed Effects
|
|
134
|
+
* Two-Way Fixed Effects
|
|
135
|
+
* Random Effects
|
|
136
|
+
* Panel IV / 2SLS
|
|
137
|
+
|
|
138
|
+
## Dynamic Panel Models
|
|
139
|
+
|
|
140
|
+
* Difference GMM
|
|
141
|
+
* System GMM
|
|
142
|
+
* One-Step Estimation
|
|
143
|
+
* Two-Step Estimation
|
|
144
|
+
* Windmeijer-Corrected Standard Errors
|
|
145
|
+
* Collapsed Instruments
|
|
146
|
+
* Restricted Lag Windows
|
|
147
|
+
|
|
148
|
+
## Reporting
|
|
149
|
+
|
|
150
|
+
* Markdown Export
|
|
151
|
+
* CSV Export
|
|
152
|
+
* LaTeX Export
|
|
153
|
+
* Structured Result Objects
|
|
154
|
+
* Integration with universal-output-hub
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
# Verification Philosophy
|
|
159
|
+
|
|
160
|
+
Verification is a core design principle of `systemgmmkit`.
|
|
161
|
+
|
|
162
|
+
Whenever practical, estimators are benchmarked against established Stata implementations including:
|
|
163
|
+
|
|
164
|
+
* `regress`
|
|
165
|
+
* `xtreg`
|
|
166
|
+
* `ivregress`
|
|
167
|
+
* `xtabond2`
|
|
168
|
+
* `xtdpdgmm`
|
|
169
|
+
|
|
170
|
+
Benchmark scripts, comparison workflows, and validation artifacts are maintained within the repository.
|
|
171
|
+
|
|
172
|
+
The objective is not merely to produce estimates, but to provide transparent evidence that estimates match trusted reference implementations under maintained benchmark specifications.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
# Current Validation Status
|
|
177
|
+
|
|
178
|
+
The major estimation paths currently exposed through the public API have either:
|
|
179
|
+
|
|
180
|
+
1. been directly benchmarked against Stata reference implementations; or
|
|
181
|
+
2. have dedicated comparison workflows maintained within the repository.
|
|
182
|
+
|
|
183
|
+
## Verified Components
|
|
184
|
+
|
|
185
|
+
| Component | Status |
|
|
186
|
+
| -------------------------- | --------------------- |
|
|
187
|
+
| OLS | PASS_STATA_PARITY |
|
|
188
|
+
| Robust OLS | PASS_STATA_PARITY |
|
|
189
|
+
| Clustered OLS | PASS_STATA_PARITY |
|
|
190
|
+
| Confidence Intervals | PASS_STATA_PARITY |
|
|
191
|
+
| lincom | PASS_STATA_PARITY |
|
|
192
|
+
| Wald / F Tests | PASS_STATA_PARITY |
|
|
193
|
+
| Fixed Effects | PASS_STATA_COMPARISON |
|
|
194
|
+
| Random Effects | PASS_STATA_COMPARISON |
|
|
195
|
+
| Panel IV / 2SLS | PASS_STATA_COMPARISON |
|
|
196
|
+
| Difference GMM | PASS_XTABOND2_PARITY |
|
|
197
|
+
| System GMM | PASS_XTABOND2_PARITY |
|
|
198
|
+
| Windmeijer Standard Errors | PASS_XTABOND2_PARITY |
|
|
199
|
+
| Hansen Diagnostics | PASS_XTABOND2_PARITY |
|
|
200
|
+
| Sargan Diagnostics | PASS_XTABOND2_PARITY |
|
|
201
|
+
| AR(1) Diagnostics | PASS_XTABOND2_PARITY |
|
|
202
|
+
| AR(2) Diagnostics | PASS_XTABOND2_PARITY |
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
# Verified OLS Benchmark
|
|
207
|
+
|
|
208
|
+
The OLS and pooled OLS implementations have been verified against Stata using a real FD001 panel-data benchmark.
|
|
209
|
+
|
|
210
|
+
Benchmark model:
|
|
211
|
+
|
|
212
|
+
```text
|
|
213
|
+
risk ~ degradation_index + sensor_mean_z + pc2 + op_setting1 + op_setting2
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Panel structure:
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
entity = unit
|
|
220
|
+
time = cycle
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Observed agreement:
|
|
224
|
+
|
|
225
|
+
| Metric | Result |
|
|
226
|
+
| --------------------------------- | -------- |
|
|
227
|
+
| Maximum coefficient difference | 4.64e-14 |
|
|
228
|
+
| Maximum standard-error difference | 2.04e-14 |
|
|
229
|
+
|
|
230
|
+
These differences represent machine-precision agreement with Stata.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
# Installation
|
|
235
|
+
|
|
236
|
+
Stable release:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
pip install systemgmmkit
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Development version:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
pip install git+https://github.com/Akanom/systemgmmkit.git
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Local development installation:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
pip install -e ".[dev,all]"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
# Quick Start
|
|
257
|
+
|
|
258
|
+
## Ordinary Least Squares
|
|
259
|
+
|
|
260
|
+
```python
|
|
261
|
+
from systemgmmkit import OLSSpec, run_ols
|
|
262
|
+
|
|
263
|
+
spec = OLSSpec(
|
|
264
|
+
dependent="y",
|
|
265
|
+
regressors=["x1", "x2"],
|
|
266
|
+
controls=["z1", "z2"],
|
|
267
|
+
covariance="robust",
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
result = run_ols(spec, df)
|
|
271
|
+
|
|
272
|
+
print(result.summary_frame())
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Equivalent Stata command:
|
|
276
|
+
|
|
277
|
+
```stata
|
|
278
|
+
regress y x1 x2 z1 z2, vce(robust)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Pooled OLS
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
from systemgmmkit import PooledOLSSpec, run_pooled_ols
|
|
287
|
+
|
|
288
|
+
spec = PooledOLSSpec(
|
|
289
|
+
dependent="y",
|
|
290
|
+
regressors=["x1", "x2"],
|
|
291
|
+
controls=["z1"],
|
|
292
|
+
covariance="clustered",
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
result = run_pooled_ols(
|
|
296
|
+
spec,
|
|
297
|
+
df,
|
|
298
|
+
entity="firm_id",
|
|
299
|
+
time="year",
|
|
300
|
+
)
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Equivalent Stata command:
|
|
304
|
+
|
|
305
|
+
```stata
|
|
306
|
+
regress y x1 x2 z1, vce(cluster firm_id)
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Fixed Effects
|
|
312
|
+
|
|
313
|
+
```python
|
|
314
|
+
result = run_fixed_effects(
|
|
315
|
+
spec,
|
|
316
|
+
df,
|
|
317
|
+
entity="firm_id",
|
|
318
|
+
time="year",
|
|
319
|
+
)
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Equivalent Stata:
|
|
323
|
+
|
|
324
|
+
```stata
|
|
325
|
+
xtreg y x1 x2, fe
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Random Effects
|
|
331
|
+
|
|
332
|
+
```python
|
|
333
|
+
result = run_random_effects(
|
|
334
|
+
spec,
|
|
335
|
+
df,
|
|
336
|
+
entity="firm_id",
|
|
337
|
+
time="year",
|
|
338
|
+
)
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Equivalent Stata:
|
|
342
|
+
|
|
343
|
+
```stata
|
|
344
|
+
xtreg y x1 x2, re
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Panel IV / 2SLS
|
|
350
|
+
|
|
351
|
+
```python
|
|
352
|
+
result = run_panel_2sls(
|
|
353
|
+
spec,
|
|
354
|
+
df,
|
|
355
|
+
entity="firm_id",
|
|
356
|
+
time="year",
|
|
357
|
+
)
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Equivalent Stata:
|
|
361
|
+
|
|
362
|
+
```stata
|
|
363
|
+
ivregress 2sls
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Difference GMM
|
|
369
|
+
|
|
370
|
+
```python
|
|
371
|
+
result = run_difference_gmm(
|
|
372
|
+
spec,
|
|
373
|
+
df,
|
|
374
|
+
entity="firm_id",
|
|
375
|
+
time="year",
|
|
376
|
+
)
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Equivalent Stata:
|
|
380
|
+
|
|
381
|
+
```stata
|
|
382
|
+
xtabond2
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## System GMM
|
|
388
|
+
|
|
389
|
+
```python
|
|
390
|
+
result = run_system_gmm(
|
|
391
|
+
spec,
|
|
392
|
+
df,
|
|
393
|
+
entity="firm_id",
|
|
394
|
+
time="year",
|
|
395
|
+
)
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Equivalent Stata:
|
|
399
|
+
|
|
400
|
+
```stata
|
|
401
|
+
xtabond2
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
# Post-Estimation
|
|
407
|
+
|
|
408
|
+
The 0.5.8 development cycle introduces the first public post-estimation framework.
|
|
409
|
+
|
|
410
|
+
Import:
|
|
411
|
+
|
|
412
|
+
```python
|
|
413
|
+
from systemgmmkit import (
|
|
414
|
+
predict,
|
|
415
|
+
fitted_values,
|
|
416
|
+
residuals,
|
|
417
|
+
vcov,
|
|
418
|
+
confint,
|
|
419
|
+
lincom,
|
|
420
|
+
wald_test,
|
|
421
|
+
marginal_effects,
|
|
422
|
+
)
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## Predictions
|
|
428
|
+
|
|
429
|
+
Equivalent Stata:
|
|
430
|
+
|
|
431
|
+
```stata
|
|
432
|
+
predict yhat
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Python:
|
|
436
|
+
|
|
437
|
+
```python
|
|
438
|
+
pred = predict(result)
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
or
|
|
442
|
+
|
|
443
|
+
```python
|
|
444
|
+
pred = result.predict()
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## Fitted Values
|
|
450
|
+
|
|
451
|
+
```python
|
|
452
|
+
fit = fitted_values(result)
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Residuals
|
|
458
|
+
|
|
459
|
+
Equivalent Stata:
|
|
460
|
+
|
|
461
|
+
```stata
|
|
462
|
+
predict ehat, residuals
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
Python:
|
|
466
|
+
|
|
467
|
+
```python
|
|
468
|
+
resid = residuals(result)
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Variance-Covariance Matrix
|
|
474
|
+
|
|
475
|
+
```python
|
|
476
|
+
V = vcov(result)
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## Confidence Intervals
|
|
482
|
+
|
|
483
|
+
```python
|
|
484
|
+
ci = confint(result)
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
---
|
|
488
|
+
|
|
489
|
+
## Linear Combinations
|
|
490
|
+
|
|
491
|
+
Equivalent Stata:
|
|
492
|
+
|
|
493
|
+
```stata
|
|
494
|
+
lincom x1 + x2
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
Python:
|
|
498
|
+
|
|
499
|
+
```python
|
|
500
|
+
lincom(
|
|
501
|
+
result,
|
|
502
|
+
{
|
|
503
|
+
"x1": 1,
|
|
504
|
+
"x2": 1,
|
|
505
|
+
},
|
|
506
|
+
)
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Returns:
|
|
510
|
+
|
|
511
|
+
* estimate
|
|
512
|
+
* standard error
|
|
513
|
+
* statistic
|
|
514
|
+
* p-value
|
|
515
|
+
* confidence interval
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## Wald Tests
|
|
520
|
+
|
|
521
|
+
Equivalent Stata:
|
|
522
|
+
|
|
523
|
+
```stata
|
|
524
|
+
test x1 x2
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
Python:
|
|
528
|
+
|
|
529
|
+
```python
|
|
530
|
+
wald_test(
|
|
531
|
+
result,
|
|
532
|
+
R=[
|
|
533
|
+
[0,1,0],
|
|
534
|
+
[0,0,1],
|
|
535
|
+
],
|
|
536
|
+
)
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
Returns:
|
|
540
|
+
|
|
541
|
+
* Wald statistic
|
|
542
|
+
* degrees of freedom
|
|
543
|
+
* p-value
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
## Marginal Effects
|
|
548
|
+
|
|
549
|
+
```python
|
|
550
|
+
marginal_effects(result)
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
For linear estimators, marginal effects correspond to estimated slopes.
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
# Reporting and Export
|
|
558
|
+
|
|
559
|
+
Results can be exported to:
|
|
560
|
+
|
|
561
|
+
* Markdown
|
|
562
|
+
* CSV
|
|
563
|
+
* LaTeX
|
|
564
|
+
|
|
565
|
+
and integrated with:
|
|
566
|
+
|
|
567
|
+
* universal-output-hub
|
|
568
|
+
* publication pipelines
|
|
569
|
+
* reproducible research workflows
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
# Recommended Reporting Practice
|
|
574
|
+
|
|
575
|
+
For empirical research, report:
|
|
576
|
+
|
|
577
|
+
* estimator;
|
|
578
|
+
* specification;
|
|
579
|
+
* covariance estimator;
|
|
580
|
+
* instrument count;
|
|
581
|
+
* AR diagnostics;
|
|
582
|
+
* Hansen diagnostics;
|
|
583
|
+
* backend;
|
|
584
|
+
* package version.
|
|
585
|
+
|
|
586
|
+
This improves transparency and reproducibility.
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
# Citation
|
|
591
|
+
|
|
592
|
+
If you use `systemgmmkit` in academic work, please cite:
|
|
593
|
+
|
|
594
|
+
```text
|
|
595
|
+
Akanbi, Oluwajuwon Mayomi.
|
|
596
|
+
|
|
597
|
+
systemgmmkit:
|
|
598
|
+
Panel Data Econometrics and Dynamic GMM Workflows in Python.
|
|
599
|
+
|
|
600
|
+
Version 0.5.8.
|
|
601
|
+
|
|
602
|
+
https://github.com/Akanom/systemgmmkit
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
BibTeX:
|
|
606
|
+
|
|
607
|
+
```bibtex
|
|
608
|
+
@software{akanbi_systemgmmkit,
|
|
609
|
+
author = {Akanbi, Oluwajuwon Mayomi},
|
|
610
|
+
title = {systemgmmkit: Panel Data Econometrics and Dynamic GMM Workflows in Python},
|
|
611
|
+
year = {2026},
|
|
612
|
+
url = {https://github.com/Akanom/systemgmmkit}
|
|
613
|
+
}
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
Replace with DOI information once a software paper or Zenodo archive is published.
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
# License
|
|
621
|
+
|
|
622
|
+
MIT License.
|
|
623
|
+
|
|
624
|
+
See `LICENSE` for details.
|