econenv 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.
- econenv-0.1.0/.gitignore +22 -0
- econenv-0.1.0/CITATION.cff +41 -0
- econenv-0.1.0/LICENSE +51 -0
- econenv-0.1.0/PKG-INFO +488 -0
- econenv-0.1.0/README.md +378 -0
- econenv-0.1.0/docs/README.md +23 -0
- econenv-0.1.0/docs/api-reference.md +160 -0
- econenv-0.1.0/docs/architecture.md +135 -0
- econenv-0.1.0/docs/audit/MILESTONE_PLAN.md +118 -0
- econenv-0.1.0/docs/audit/PHASE0_TECHNOLOGY_AUDIT.md +266 -0
- econenv-0.1.0/docs/comparison.md +133 -0
- econenv-0.1.0/docs/data-exchange.md +97 -0
- econenv-0.1.0/docs/data-types.md +131 -0
- econenv-0.1.0/docs/development.md +121 -0
- econenv-0.1.0/docs/diagnostics.md +84 -0
- econenv-0.1.0/docs/engines/eviews.md +161 -0
- econenv-0.1.0/docs/engines/python.md +51 -0
- econenv-0.1.0/docs/engines/r.md +146 -0
- econenv-0.1.0/docs/engines/stata.md +122 -0
- econenv-0.1.0/docs/faq.md +78 -0
- econenv-0.1.0/docs/getting-started.md +133 -0
- econenv-0.1.0/docs/installation.md +67 -0
- econenv-0.1.0/docs/magics.md +164 -0
- econenv-0.1.0/docs/reproducibility.md +76 -0
- econenv-0.1.0/docs/results.md +83 -0
- econenv-0.1.0/docs/troubleshooting.md +157 -0
- econenv-0.1.0/examples/01_quick_start.ipynb +126 -0
- econenv-0.1.0/examples/02_python_and_r.ipynb +116 -0
- econenv-0.1.0/examples/03_python_and_stata.ipynb +111 -0
- econenv-0.1.0/examples/04_python_and_eviews.ipynb +116 -0
- econenv-0.1.0/examples/05_all_four_engines.ipynb +114 -0
- econenv-0.1.0/examples/06_same_ols_four_engines.ipynb +116 -0
- econenv-0.1.0/examples/07_data_transfer.ipynb +107 -0
- econenv-0.1.0/examples/08_time_series.ipynb +104 -0
- econenv-0.1.0/examples/09_panel_data.ipynb +97 -0
- econenv-0.1.0/examples/README.md +40 -0
- econenv-0.1.0/examples/_mvp_acceptance.py +42 -0
- econenv-0.1.0/pyproject.toml +150 -0
- econenv-0.1.0/src/econenv/__init__.py +194 -0
- econenv-0.1.0/src/econenv/_logging.py +71 -0
- econenv-0.1.0/src/econenv/_version.py +3 -0
- econenv-0.1.0/src/econenv/bridges/__init__.py +24 -0
- econenv-0.1.0/src/econenv/bridges/eviews_bridge.py +409 -0
- econenv-0.1.0/src/econenv/bridges/r_bridge.py +363 -0
- econenv-0.1.0/src/econenv/bridges/stata_bridge.py +253 -0
- econenv-0.1.0/src/econenv/cli.py +198 -0
- econenv-0.1.0/src/econenv/config.py +224 -0
- econenv-0.1.0/src/econenv/diagnostics.py +583 -0
- econenv-0.1.0/src/econenv/discovery.py +398 -0
- econenv-0.1.0/src/econenv/engines/__init__.py +15 -0
- econenv-0.1.0/src/econenv/engines/base.py +422 -0
- econenv-0.1.0/src/econenv/engines/eviews_engine.py +564 -0
- econenv-0.1.0/src/econenv/engines/python_engine.py +235 -0
- econenv-0.1.0/src/econenv/engines/r_engine.py +732 -0
- econenv-0.1.0/src/econenv/engines/registry.py +181 -0
- econenv-0.1.0/src/econenv/engines/stata_engine.py +534 -0
- econenv-0.1.0/src/econenv/exceptions.py +174 -0
- econenv-0.1.0/src/econenv/magics/__init__.py +62 -0
- econenv-0.1.0/src/econenv/magics/_common.py +86 -0
- econenv-0.1.0/src/econenv/magics/econ_magic.py +260 -0
- econenv-0.1.0/src/econenv/magics/eviews_magic.py +168 -0
- econenv-0.1.0/src/econenv/magics/r_magic.py +174 -0
- econenv-0.1.0/src/econenv/magics/stata_magic.py +100 -0
- econenv-0.1.0/src/econenv/models/__init__.py +14 -0
- econenv-0.1.0/src/econenv/models/compare.py +259 -0
- econenv-0.1.0/src/econenv/models/registry.py +217 -0
- econenv-0.1.0/src/econenv/models/spec.py +167 -0
- econenv-0.1.0/src/econenv/results.py +304 -0
- econenv-0.1.0/src/econenv/schema.py +299 -0
- econenv-0.1.0/src/econenv/services.py +144 -0
- econenv-0.1.0/src/econenv/transfer.py +202 -0
- econenv-0.1.0/tests/conftest.py +96 -0
- econenv-0.1.0/tests/test_core.py +406 -0
- econenv-0.1.0/tests/test_integration.py +246 -0
- econenv-0.1.0/tests/test_mocked_engines.py +279 -0
econenv-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*.egg-info/
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
.venv/
|
|
7
|
+
venv/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.mypy_cache/
|
|
10
|
+
.ruff_cache/
|
|
11
|
+
.ipynb_checkpoints/
|
|
12
|
+
.coverage
|
|
13
|
+
htmlcov/
|
|
14
|
+
*.Rhistory
|
|
15
|
+
.RData
|
|
16
|
+
*.wf1
|
|
17
|
+
*.wf1~
|
|
18
|
+
*.dta
|
|
19
|
+
*.log
|
|
20
|
+
*.smcl
|
|
21
|
+
econenv-snapshot.json
|
|
22
|
+
.econenv/
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: "EconEnv: Python, R, Stata and EViews in one reproducible Jupyter workflow"
|
|
3
|
+
message: "If you use EconEnv in your research, please cite it as below."
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Roudane
|
|
7
|
+
given-names: Merwan
|
|
8
|
+
email: merwanroudane920@gmail.com
|
|
9
|
+
orcid: ""
|
|
10
|
+
repository-code: "https://github.com/merwanroudane/econenv"
|
|
11
|
+
url: "https://github.com/merwanroudane/econenv"
|
|
12
|
+
abstract: >-
|
|
13
|
+
EconEnv is an IPython extension that lets a researcher run Python, R, Stata
|
|
14
|
+
and EViews inside a single Jupyter notebook on one Python kernel. It provides
|
|
15
|
+
persistent engine sessions, a unified pandas-based data bridge that preserves
|
|
16
|
+
econometric metadata, standardised execution and model result objects,
|
|
17
|
+
installation diagnostics, environment snapshots for reproducibility, and a
|
|
18
|
+
cross-engine model comparison framework that reports where the programs
|
|
19
|
+
genuinely disagree rather than hiding the difference.
|
|
20
|
+
keywords:
|
|
21
|
+
- econometrics
|
|
22
|
+
- reproducible research
|
|
23
|
+
- jupyter
|
|
24
|
+
- stata
|
|
25
|
+
- eviews
|
|
26
|
+
- r
|
|
27
|
+
- polyglot notebook
|
|
28
|
+
license: MIT
|
|
29
|
+
version: 0.1.0
|
|
30
|
+
date-released: "2026-09-04"
|
|
31
|
+
# A DOI will be added here on the first archived release (Zenodo).
|
|
32
|
+
# doi: 10.5281/zenodo.XXXXXXX
|
|
33
|
+
preferred-citation:
|
|
34
|
+
type: software
|
|
35
|
+
title: "EconEnv: Python, R, Stata and EViews in one reproducible Jupyter workflow"
|
|
36
|
+
authors:
|
|
37
|
+
- family-names: Roudane
|
|
38
|
+
given-names: Merwan
|
|
39
|
+
year: 2026
|
|
40
|
+
version: 0.1.0
|
|
41
|
+
url: "https://github.com/merwanroudane/econenv"
|
econenv-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Merwan Roudane
|
|
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.
|
|
22
|
+
|
|
23
|
+
---------------------------------------------------------------------------
|
|
24
|
+
THIRD-PARTY SOFTWARE
|
|
25
|
+
---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
The MIT licence above covers the EconEnv source code only. It grants no rights
|
|
28
|
+
whatsoever in the third-party programs EconEnv can talk to.
|
|
29
|
+
|
|
30
|
+
EconEnv contains, bundles and redistributes NO part of:
|
|
31
|
+
|
|
32
|
+
* Stata (c) StataCorp LLC - https://www.stata.com
|
|
33
|
+
* EViews (c) IHS Global Inc. - https://www.eviews.com
|
|
34
|
+
* R (c) The R Foundation - GPL-2 / GPL-3
|
|
35
|
+
|
|
36
|
+
No binaries, no libraries, no licence files, no serial numbers, no activation
|
|
37
|
+
keys. EconEnv locates software that is already installed on the user's own
|
|
38
|
+
machine and drives it through each vendor's documented automation interface
|
|
39
|
+
(PyStata for Stata, COM for EViews, the R console or rpy2 for R).
|
|
40
|
+
|
|
41
|
+
Users are solely responsible for obtaining, installing and licensing Stata and
|
|
42
|
+
EViews, and for complying with those licences - including any restriction on
|
|
43
|
+
concurrent sessions, server deployment or automated use. Nothing in this
|
|
44
|
+
licence modifies, waives or supersedes the terms of the Stata, EViews or R
|
|
45
|
+
licences.
|
|
46
|
+
|
|
47
|
+
R is free software distributed under the GNU General Public Licence. EconEnv's
|
|
48
|
+
default R backend runs R as a separate process over its documented command-line
|
|
49
|
+
interface and does not link against R, so EconEnv is not a derivative work of
|
|
50
|
+
R. The optional rpy2 backend is a separate package, installed by the user, and
|
|
51
|
+
is governed by rpy2's own licence.
|
econenv-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: econenv
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: One Notebook. Multiple Econometric Engines. Python, R, Stata and EViews in a single Jupyter session.
|
|
5
|
+
Project-URL: Homepage, https://github.com/merwanroudane/econenv
|
|
6
|
+
Project-URL: Repository, https://github.com/merwanroudane/econenv
|
|
7
|
+
Project-URL: Issues, https://github.com/merwanroudane/econenv/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/merwanroudane/econenv/tree/main/docs
|
|
9
|
+
Author-email: Merwan Roudane <merwanroudane920@gmail.com>
|
|
10
|
+
Maintainer-email: Merwan Roudane <merwanroudane920@gmail.com>
|
|
11
|
+
License: MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2026 Merwan Roudane
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
|
|
33
|
+
---------------------------------------------------------------------------
|
|
34
|
+
THIRD-PARTY SOFTWARE
|
|
35
|
+
---------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
The MIT licence above covers the EconEnv source code only. It grants no rights
|
|
38
|
+
whatsoever in the third-party programs EconEnv can talk to.
|
|
39
|
+
|
|
40
|
+
EconEnv contains, bundles and redistributes NO part of:
|
|
41
|
+
|
|
42
|
+
* Stata (c) StataCorp LLC - https://www.stata.com
|
|
43
|
+
* EViews (c) IHS Global Inc. - https://www.eviews.com
|
|
44
|
+
* R (c) The R Foundation - GPL-2 / GPL-3
|
|
45
|
+
|
|
46
|
+
No binaries, no libraries, no licence files, no serial numbers, no activation
|
|
47
|
+
keys. EconEnv locates software that is already installed on the user's own
|
|
48
|
+
machine and drives it through each vendor's documented automation interface
|
|
49
|
+
(PyStata for Stata, COM for EViews, the R console or rpy2 for R).
|
|
50
|
+
|
|
51
|
+
Users are solely responsible for obtaining, installing and licensing Stata and
|
|
52
|
+
EViews, and for complying with those licences - including any restriction on
|
|
53
|
+
concurrent sessions, server deployment or automated use. Nothing in this
|
|
54
|
+
licence modifies, waives or supersedes the terms of the Stata, EViews or R
|
|
55
|
+
licences.
|
|
56
|
+
|
|
57
|
+
R is free software distributed under the GNU General Public Licence. EconEnv's
|
|
58
|
+
default R backend runs R as a separate process over its documented command-line
|
|
59
|
+
interface and does not link against R, so EconEnv is not a derivative work of
|
|
60
|
+
R. The optional rpy2 backend is a separate package, installed by the user, and
|
|
61
|
+
is governed by rpy2's own licence.
|
|
62
|
+
License-File: LICENSE
|
|
63
|
+
Keywords: econometrics,eviews,ipython,jupyter,polyglot,r,reproducibility,stata
|
|
64
|
+
Classifier: Development Status :: 3 - Alpha
|
|
65
|
+
Classifier: Framework :: IPython
|
|
66
|
+
Classifier: Framework :: Jupyter
|
|
67
|
+
Classifier: Intended Audience :: Science/Research
|
|
68
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
69
|
+
Classifier: Operating System :: MacOS
|
|
70
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
71
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
72
|
+
Classifier: Programming Language :: Python :: 3
|
|
73
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
74
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
75
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
76
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
77
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
78
|
+
Classifier: Programming Language :: R
|
|
79
|
+
Classifier: Topic :: Scientific/Engineering
|
|
80
|
+
Requires-Python: >=3.9
|
|
81
|
+
Requires-Dist: ipython>=8.0
|
|
82
|
+
Requires-Dist: numpy>=1.22
|
|
83
|
+
Requires-Dist: pandas>=1.5
|
|
84
|
+
Requires-Dist: statsmodels>=0.13
|
|
85
|
+
Provides-Extra: all
|
|
86
|
+
Requires-Dist: comtypes>=1.2; (platform_system == 'Windows') and extra == 'all'
|
|
87
|
+
Requires-Dist: pyarrow>=12; extra == 'all'
|
|
88
|
+
Requires-Dist: rpy2>=3.5; (platform_system != 'Windows') and extra == 'all'
|
|
89
|
+
Requires-Dist: stata-setup>=0.1.3; extra == 'all'
|
|
90
|
+
Provides-Extra: arrow
|
|
91
|
+
Requires-Dist: pyarrow>=12; extra == 'arrow'
|
|
92
|
+
Provides-Extra: dev
|
|
93
|
+
Requires-Dist: mypy>=1.8; extra == 'dev'
|
|
94
|
+
Requires-Dist: pandas-stubs; extra == 'dev'
|
|
95
|
+
Requires-Dist: pre-commit>=3.5; extra == 'dev'
|
|
96
|
+
Requires-Dist: pytest-cov>=4.1; extra == 'dev'
|
|
97
|
+
Requires-Dist: pytest>=7.4; extra == 'dev'
|
|
98
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
99
|
+
Requires-Dist: types-setuptools; extra == 'dev'
|
|
100
|
+
Provides-Extra: docs
|
|
101
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
102
|
+
Requires-Dist: mkdocs>=1.5; extra == 'docs'
|
|
103
|
+
Provides-Extra: eviews
|
|
104
|
+
Requires-Dist: comtypes>=1.2; (platform_system == 'Windows') and extra == 'eviews'
|
|
105
|
+
Provides-Extra: r
|
|
106
|
+
Requires-Dist: rpy2>=3.5; (platform_system != 'Windows') and extra == 'r'
|
|
107
|
+
Provides-Extra: stata
|
|
108
|
+
Requires-Dist: stata-setup>=0.1.3; extra == 'stata'
|
|
109
|
+
Description-Content-Type: text/markdown
|
|
110
|
+
|
|
111
|
+
<div align="center">
|
|
112
|
+
|
|
113
|
+
# EconEnv
|
|
114
|
+
|
|
115
|
+
**One Notebook. Multiple Econometric Engines.**
|
|
116
|
+
|
|
117
|
+
Python, R, Stata and EViews in a single Jupyter workflow — on one Python kernel.
|
|
118
|
+
|
|
119
|
+
[](LICENSE)
|
|
120
|
+
[](https://www.python.org)
|
|
121
|
+
[](#project-status)
|
|
122
|
+
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## The problem
|
|
128
|
+
|
|
129
|
+
An applied econometrics paper rarely lives in one program. The unit-root test is
|
|
130
|
+
in EViews because that is where the ARDL bounds output is readable. The panel
|
|
131
|
+
estimator is in Stata because `xtreg` is the reference implementation. The plots
|
|
132
|
+
are in R because `ggplot2` is better. The data cleaning is in Python because
|
|
133
|
+
pandas is better.
|
|
134
|
+
|
|
135
|
+
So the working day looks like this:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
Python → to_csv() → Stata → export delimited → R → write.csv → EViews
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Four programs open. Four windows. Four copies of the same data, drifting apart.
|
|
142
|
+
A missing value that meant `.a` in Stata arriving as an empty cell in R. A
|
|
143
|
+
quarterly index that became a string. And when a referee asks "why does your
|
|
144
|
+
robust standard error differ from mine?", there is no way to answer without
|
|
145
|
+
redoing the whole chain by hand.
|
|
146
|
+
|
|
147
|
+
## The solution
|
|
148
|
+
|
|
149
|
+
EconEnv makes the four programs **execution engines behind one Python kernel**.
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
%load_ext econenv
|
|
153
|
+
|
|
154
|
+
df = pd.read_csv("data.csv") # Python, as usual
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
%%R -i df
|
|
159
|
+
fit <- lm(y ~ x1 + x2, data = df)
|
|
160
|
+
summary(fit)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
%%stata
|
|
165
|
+
regress y x1 x2
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
%%eviews -i df
|
|
170
|
+
equation eq1.ls y c x1 x2
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
One notebook. One kernel. One dataset. No CSV round-trip.
|
|
174
|
+
|
|
175
|
+
And then the part that is hard to do any other way:
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
econenv.compare_ols(df, "y ~ x1 + x2")
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
OLS: y ~ x1 + x2
|
|
183
|
+
Engines agree within tolerance (rtol=1e-08, atol=1e-10)
|
|
184
|
+
|
|
185
|
+
Coefficients
|
|
186
|
+
python r stata eviews
|
|
187
|
+
term
|
|
188
|
+
x1 0.4821094 0.4821094 0.4821094 0.4821094
|
|
189
|
+
x2 -0.1330277 -0.1330277 -0.1330277 -0.1330277
|
|
190
|
+
_cons 1.9042118 1.9042118 1.9042118 1.9042118
|
|
191
|
+
|
|
192
|
+
Notes:
|
|
193
|
+
- aic: AIC normalisation differs: statsmodels -2ll+2k; R counts sigma^2 as a
|
|
194
|
+
parameter (k+1); EViews divides by n; Stata needs `estat ic`.
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The coefficients match. The information criteria do not — and EconEnv says
|
|
198
|
+
**why**, instead of quietly picking one.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Architecture
|
|
203
|
+
|
|
204
|
+
```mermaid
|
|
205
|
+
graph TD
|
|
206
|
+
A[JupyterLab / Notebook] --> B[IPython / Python kernel]
|
|
207
|
+
B --> C[EconEnv extension]
|
|
208
|
+
C --> D[Magics: %econ · %R · %stata · %eviews]
|
|
209
|
+
C --> E[Engine registry]
|
|
210
|
+
E --> F[Python engine]
|
|
211
|
+
E --> G[R engine]
|
|
212
|
+
E --> H[Stata engine]
|
|
213
|
+
E --> I[EViews engine]
|
|
214
|
+
G --> G1[subprocess backend<br/>persistent Rterm]
|
|
215
|
+
G --> G2[rpy2 backend<br/>when installed]
|
|
216
|
+
H --> H1[PyStata<br/>official]
|
|
217
|
+
I --> I1[COM automation<br/>comtypes]
|
|
218
|
+
C --> J[Data bridges<br/>pandas is canonical]
|
|
219
|
+
C --> K[Results · Diagnostics · Snapshots]
|
|
220
|
+
E -.future.-> L[MATLAB · Julia · SAS · Gretl · Dynare · GAUSS · Ox · RATS]
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Three rules hold the design together:
|
|
224
|
+
|
|
225
|
+
1. **No custom kernel.** EconEnv is a Python package plus an IPython extension.
|
|
226
|
+
A polyglot kernel is evaluated in the roadmap, not assumed.
|
|
227
|
+
2. **Nothing above the engine layer touches a vendor API.** Magics, the CLI,
|
|
228
|
+
diagnostics and the model layer speak only to `BaseEngine`. Adding MATLAB
|
|
229
|
+
means writing one adapter, not editing the core.
|
|
230
|
+
3. **Never hide a difference.** Lossy conversions warn. Engine disagreements are
|
|
231
|
+
reported with the defaults that explain them.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Features
|
|
236
|
+
|
|
237
|
+
| | |
|
|
238
|
+
|---|---|
|
|
239
|
+
| **Four engines, one kernel** | Python, R, Stata, EViews — persistent sessions, no kernel switching |
|
|
240
|
+
| **Real data bridge** | `pandas.DataFrame` is canonical; push/pull/move between any two engines with no file round-trip |
|
|
241
|
+
| **Type fidelity** | Factors, categoricals, dates, booleans, integers and missing values survive the trip — or you get a warning saying exactly what changed |
|
|
242
|
+
| **Econometric metadata** | Time variable, panel variable, frequency, labels and conversion history travel with the frame |
|
|
243
|
+
| **Structured results** | `ExecutionResult` and `ModelResult` instead of scraped text; raw engine output always retained |
|
|
244
|
+
| **Cross-engine comparison** | Same specification, four engines, one table, with tolerance-aware agreement testing |
|
|
245
|
+
| **Diagnostics** | `econenv doctor` checks every layer and tells you how to fix what is broken |
|
|
246
|
+
| **Reproducibility** | Environment snapshots and provenance records (code hash, data hash, versions, timing) |
|
|
247
|
+
| **Rich output** | HTML tables, PNG/SVG plots from R and EViews rendered inline |
|
|
248
|
+
| **Honest about limits** | Capability matrix reports what each engine can do *on this machine*, not in theory |
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Installation
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
pip install econenv
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Optional extras — install only what you use:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
pip install "econenv[stata]" # helper for locating PyStata
|
|
262
|
+
pip install "econenv[eviews]" # comtypes, Windows only
|
|
263
|
+
pip install "econenv[arrow]" # fast Arrow transfer to R
|
|
264
|
+
pip install "econenv[all]"
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Then, in a notebook:
|
|
268
|
+
|
|
269
|
+
```python
|
|
270
|
+
%load_ext econenv
|
|
271
|
+
%econ doctor
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Requirements
|
|
275
|
+
|
|
276
|
+
| | Required | Notes |
|
|
277
|
+
|---|---|---|
|
|
278
|
+
| Python | 3.9+ | the host kernel |
|
|
279
|
+
| pandas, numpy, IPython | yes | installed automatically |
|
|
280
|
+
| R | optional | 4.0+; EconEnv finds it, no PATH setup needed |
|
|
281
|
+
| Stata | optional | **17 or newer** — PyStata ships with Stata 17+ |
|
|
282
|
+
| EViews | optional | **Windows only**; automation is COM-based |
|
|
283
|
+
| `comtypes` | for EViews | `pip install "econenv[eviews]"` |
|
|
284
|
+
| `rpy2` | never required | no Windows wheels; EconEnv's subprocess backend replaces it |
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Engine setup
|
|
289
|
+
|
|
290
|
+
EconEnv discovers installations automatically — environment variables, `PATH`,
|
|
291
|
+
the Windows registry, then the usual install roots. You should not need to
|
|
292
|
+
configure anything. When you do:
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
%econ config r.home "C:/Program Files/R/R-4.5.2"
|
|
296
|
+
%econ config stata.home "C:/Program Files/Stata19"
|
|
297
|
+
%econ config stata.edition mp
|
|
298
|
+
%econ config eviews.progid EViews14.Manager
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Or persistently, in `~/.econenv/config.toml`:
|
|
302
|
+
|
|
303
|
+
```toml
|
|
304
|
+
[r]
|
|
305
|
+
home = "C:/Program Files/R/R-4.5.2"
|
|
306
|
+
|
|
307
|
+
[stata]
|
|
308
|
+
home = "C:/Program Files/StataNow19"
|
|
309
|
+
edition = "mp"
|
|
310
|
+
|
|
311
|
+
[eviews]
|
|
312
|
+
progid = "EViews14.Manager"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Environment variables work too: `ECONENV_STATA_EDITION=mp`, `R_HOME`,
|
|
316
|
+
`STATA_HOME`.
|
|
317
|
+
|
|
318
|
+
**A note on R and Windows.** rpy2 publishes no Windows wheels, so EconEnv's
|
|
319
|
+
default R backend is a persistent `Rterm` child process driven over a private
|
|
320
|
+
protocol — no compiler, no `R_HOME` gymnastics. Where rpy2 *is* installed
|
|
321
|
+
(usually Linux and macOS) EconEnv uses it, and loads **rpy2's own** `%R`/`%%R`
|
|
322
|
+
magics rather than shadowing them.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Examples
|
|
327
|
+
|
|
328
|
+
### Move data without touching a file
|
|
329
|
+
|
|
330
|
+
```python
|
|
331
|
+
econenv.push("stata", "default", df) # Python → Stata
|
|
332
|
+
econenv.move("stata", "r", "default") # Stata → R
|
|
333
|
+
back = econenv.pull("r", "econenv_ols_data")
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Keep the metadata
|
|
337
|
+
|
|
338
|
+
```python
|
|
339
|
+
%%R -i panel -o results
|
|
340
|
+
library(plm)
|
|
341
|
+
fit <- plm(y ~ x, data = panel, index = c("id", "year"), model = "within")
|
|
342
|
+
results <- as.data.frame(summary(fit)$coefficients)
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
`panel`'s MultiIndex is recognised as (entity, time); `results` comes back with
|
|
346
|
+
its R types intact.
|
|
347
|
+
|
|
348
|
+
### See what a transfer cost
|
|
349
|
+
|
|
350
|
+
```python
|
|
351
|
+
econenv.push("eviews", "wf", df)
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
UserWarning: EconEnv push -> eviews: [warning] region: categorical stored as
|
|
356
|
+
integer codes; EViews has no factor type
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Diagnose
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
econenv doctor
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
✔ PASS Python: 3.11.0
|
|
367
|
+
✔ PASS R installation: C:\Program Files\R\R-4.5.2 (R 4.5.2)
|
|
368
|
+
! WARNING Multiple R versions: 4.5.2, 4.4.3
|
|
369
|
+
→ EconEnv picks the newest. Pin one with `%econ config r.home ...`.
|
|
370
|
+
✔ PASS PyStata: C:\Program Files\StataNow19\utilities\pystata
|
|
371
|
+
! WARNING COM version binding: several EViews versions are installed
|
|
372
|
+
→ Pin one: `%econ config eviews.progid EViews14.Manager`.
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
More in [`examples/`](examples/):
|
|
376
|
+
|
|
377
|
+
1. Quick start
|
|
378
|
+
2. Python + R
|
|
379
|
+
3. Python + Stata
|
|
380
|
+
4. Python + EViews
|
|
381
|
+
5. All four engines
|
|
382
|
+
6. The same OLS in four engines
|
|
383
|
+
7. Data transfer and type fidelity
|
|
384
|
+
8. Time series
|
|
385
|
+
9. Panel data
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Project status
|
|
390
|
+
|
|
391
|
+
**v0.1 — alpha.** Execution, engine management, the data bridge, results,
|
|
392
|
+
graphs, diagnostics, snapshots and cross-engine OLS comparison are implemented
|
|
393
|
+
and tested. The API may still change before v1.0.
|
|
394
|
+
|
|
395
|
+
What is verified, and on what:
|
|
396
|
+
|
|
397
|
+
| | Verified |
|
|
398
|
+
|---|---|
|
|
399
|
+
| Python engine | yes, in CI |
|
|
400
|
+
| R engine (subprocess) | yes, against R 4.5.2 on Windows |
|
|
401
|
+
| Stata engine | yes, against StataNow 19.5 MP + PyStata 0.1.2 |
|
|
402
|
+
| EViews engine | yes, against EViews 13 via COM on Windows |
|
|
403
|
+
| R engine (rpy2) | **not** verified — no rpy2 on the development machine |
|
|
404
|
+
| Linux / macOS | **not** verified — the design supports them; nobody has run them yet |
|
|
405
|
+
|
|
406
|
+
Where something is untested, this README and the docs say so. See
|
|
407
|
+
[`docs/audit/PHASE0_TECHNOLOGY_AUDIT.md`](docs/audit/PHASE0_TECHNOLOGY_AUDIT.md)
|
|
408
|
+
for the measured evidence behind every technical decision.
|
|
409
|
+
|
|
410
|
+
## Roadmap
|
|
411
|
+
|
|
412
|
+
| Version | Scope |
|
|
413
|
+
|---|---|
|
|
414
|
+
| **v0.1** | Execution + engine management + data bridge + results + graphs + diagnostics ✅ |
|
|
415
|
+
| v0.2 | Broader type coverage, Stata value labels, EViews alpha/matrix transfer, Arrow everywhere |
|
|
416
|
+
| v0.3 | Model registry beyond OLS: logit, probit, IV, panel FE/RE |
|
|
417
|
+
| v0.4 | Time-series and cointegration estimators; richer comparison reports |
|
|
418
|
+
| v0.5 | Full provenance capture and run manifests |
|
|
419
|
+
| v1.0 | Stable public API, documented multi-engine workflow, JupyterLab cell-toolbar extension |
|
|
420
|
+
|
|
421
|
+
Graphs were pulled forward from v0.3 into v0.1: plot capture is a property of the
|
|
422
|
+
transport layer, and retrofitting it later would have meant touching every
|
|
423
|
+
adapter twice.
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## Platform support
|
|
428
|
+
|
|
429
|
+
| | Python | R | Stata | EViews |
|
|
430
|
+
|---|---|---|---|---|
|
|
431
|
+
| **Windows** | ✅ | ✅ | ✅ | ✅ |
|
|
432
|
+
| **Linux** | ✅ | ✅ | ✅ | ✖ COM is unavailable |
|
|
433
|
+
| **macOS** | ✅ | ✅ | ✅ | ✖ COM is unavailable |
|
|
434
|
+
|
|
435
|
+
The absence of EViews never blocks installation or use of the others. On
|
|
436
|
+
non-Windows platforms the EViews engine reports itself unavailable and everything
|
|
437
|
+
else works normally.
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## Commercial software disclaimer
|
|
442
|
+
|
|
443
|
+
**EconEnv contains, bundles and redistributes no part of Stata or EViews** — no
|
|
444
|
+
binaries, no libraries, no licence files, no serial numbers, no activation keys.
|
|
445
|
+
|
|
446
|
+
EconEnv locates software already installed on your machine and drives it through
|
|
447
|
+
each vendor's own documented automation interface. You are responsible for
|
|
448
|
+
obtaining, installing and licensing Stata and EViews, and for complying with
|
|
449
|
+
those licences, including any restriction on concurrent sessions, server
|
|
450
|
+
deployment or automated use.
|
|
451
|
+
|
|
452
|
+
Stata® is a registered trademark of StataCorp LLC. EViews® is a registered
|
|
453
|
+
trademark of IHS Global Inc. R is free software from the R Foundation. None of
|
|
454
|
+
them endorses or is affiliated with this project.
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## Troubleshooting
|
|
459
|
+
|
|
460
|
+
Start with `econenv doctor` — it names the problem and the fix. Common ones are
|
|
461
|
+
in [`docs/troubleshooting.md`](docs/troubleshooting.md), including:
|
|
462
|
+
|
|
463
|
+
* Stata says the edition is wrong
|
|
464
|
+
* EViews connects to the wrong version
|
|
465
|
+
* R starts but never becomes ready
|
|
466
|
+
* `pyeviews` fails to import (it is not needed)
|
|
467
|
+
* Values arrive in EViews as all-NA
|
|
468
|
+
|
|
469
|
+
## Contributing
|
|
470
|
+
|
|
471
|
+
Issues and pull requests are welcome. See
|
|
472
|
+
[`docs/development.md`](docs/development.md) for the layout, the test markers
|
|
473
|
+
(`-m "not stata and not eviews"` runs everything that needs no licence) and how
|
|
474
|
+
to write a new engine adapter.
|
|
475
|
+
|
|
476
|
+
## Citation
|
|
477
|
+
|
|
478
|
+
If EconEnv is part of your research workflow, please cite it — see
|
|
479
|
+
[`CITATION.cff`](CITATION.cff).
|
|
480
|
+
|
|
481
|
+
## License
|
|
482
|
+
|
|
483
|
+
MIT — see [LICENSE](LICENSE). The MIT grant covers EconEnv's own source only and
|
|
484
|
+
confers no rights in Stata, EViews or R.
|
|
485
|
+
|
|
486
|
+
## Author
|
|
487
|
+
|
|
488
|
+
**Dr Merwan Roudane** · [github.com/merwanroudane](https://github.com/merwanroudane)
|