A JAX-based library for structural modeling and estimation in economics.
Project description
[!WARNING] Status: Alpha Release
Econox is currently in the alpha stage. We are actively expanding the library of solvers and structural components.
Econox is a JAX-based toolkit for structural modeling and estimation. It leverages Equinox to provide a highly modular, object-oriented framework where researchers can assemble economic models from reusable components.
🧩 Core Philosophy: Composable Design
In Econox, a structural model is not a black box. It is a composition of independent, interchangeable blocks.
$$\text{Model} + \text{Utility} + \text{Solver} \xrightarrow{\text{Estimator}} \text{Results}$$
- Define Physics: Swap
LinearUtilitywith your own custom utility classes instantly. - Define Solver: Switch between
ValueIterationandEquilibriumwithout rewriting the loop. - Estimate: Feed the assembled parts to
Estimatorto find parameters that match the data.
Key Features
-
🐍 Pure Python & Easy Setup:
- No Fortran/C++ required: Unlike legacy libraries that rely on complex compilation chains, Econox is Pure Python.
- Hackable: Since the logic is written in standard Python (via Equinox), it is readable, debuggable, and easy to extend with custom logic.
- JIT Compilation: While you write Python, JAX compiles it to XLA (machine code) at runtime, offering C++ level performance.
-
🎯 Precision via Auto-Diff:
- Exact Derivatives: Econox uses Automatic Differentiation to compute gradients and Hessians.
- Better Inference: This eliminates approximation errors associated with numerical differentiation, leading to more accurate standard errors and t-statistics for structural parameters.
-
🧩 Modular Modeling:
- Define models as clean, composable classes. Swap utility functions or solvers instantly without rewriting the estimation loop.
-
🚀 Hardware Accelerated:
- Seamlessly scale to GPUs or TPUs to accelerate large-scale state spaces ($S>10,000$) simply by changing the JAX backend.
⚡ Validation & Performance
We demonstrate both the accuracy and scalability of Econox in a single unified benchmark.
Benchmark & Replication Report
The following notebook contains two key validations:
- Accuracy (Rust 1987 Replication): Successfully replicates the structural parameters $(\theta, RC)$ from John Rust's classic paper using the original dataset.
- Scalability (Large-Scale Benchmark): Measures estimation speed on massive synthetic problems ($S=3000, P=50$) to demonstrate hardware acceleration.
Scalability Results (Large-Scale DDCM)
Synthetic data estimation based on the structure of Rust (1987) fixed-point model. (State Space $S=3000$, Parameters $P=50$, 100 Estimation Steps)
| Implementation | Hardware | Est. Total Time | Speedup |
|---|---|---|---|
| NumPy (Numerical Diff) | CPU | ~2.0 days | 1x (Baseline) |
| Econox (Auto-Diff) | CPU | ~1.1 hours | ~44x |
| Econox (Auto-Diff) | GPU (T4) | ~19 min | ~157x |
Note: Times for Econox include JIT compilation overhead (Warmup). NumPy estimates are extrapolated from single-step performance using an honest solver (Utility $\to$ Bellman $\to$ Likelihood). Benchmark conducted on Google Colab (vCPU: Intel Xeon, GPU: NVIDIA T4).
Quick Start: Structural Estimation
Here is how you can build and estimate a Dynamic Discrete Choice Model (Rust 1987 style) by assembling reusable components.
import jax.numpy as jnp
import econox as ecx
# 1. [Environment] Define Data & Transitions
num_states, num_actions = 10, 3
model = ecx.Model.from_data(
num_states=num_states,
num_actions=num_actions,
data={"x": jnp.zeros((10, 3, 1))}, # Dummy feature
transitions=jnp.ones((30, 10)) / 10
)
# 2. [Physics] Define Utility Function
utility = ecx.LinearUtility(param_keys=("beta",), feature_key="x")
# 3. [Algorithm] Define Solver
solver = ecx.ValueIterationSolver(
utility=utility,
dist=ecx.GumbelDistribution(), # Logit
discount_factor=0.95
)
# 4. [Interface] Assemble the Estimator
param_space = ecx.ParameterSpace.create(initial_params={"beta": jnp.array([0.0])})
estimator = ecx.Estimator(
model=model,
param_space=param_space,
method=ecx.MaximumLikelihood(), # Use MLE
solver=solver
)
# 5. Estimate!
observations = {
"state_indices": jnp.array([0, 1, 2]),
"choice_indices": jnp.array([0, 2, 1])
}
result = estimator.fit(observations)
print(f"Success: {result.success}")
print(f"Estimated Params: {result.params}")
Installation
Requires Python 3.11+ and JAX.
Using pip:
pip install econox
Using uv (Recommended):
uv add econox
Requirements
Econox is built upon the modern JAX ecosystem. The core dependencies include:
- JAX: For high-performance array computing and automatic differentiation.
- Equinox: For defining parameterized models.
- Optimistix: For nonlinear optimization and root-finding.
- Jaxtyping: For type annotations and shape checking.
📚 Documentation
For detailed API references and tutorials, please visit the Official Documentation.
ℹ️ Project Information
📄 Citation
If you use Econox in your research, please cite the software artifact as follows until the official paper is published:
@software{econox,
author = {Ito, Haruto},
title = {Econox: A JAX-based toolkit for structural modeling and estimation},
url = {[https://github.com/ito-haru/econox](https://github.com/ito-haru/econox)},
version = {0.1.3},
year = {2026},
note = {Alpha Release}
}
👥 Credits & Acknowledgements
Author
- Haruto Ito (伊藤晴人) - Lead Developer, Department of Civil Engineering, The University of Tokyo
Acknowledgements
This library originates from an undergraduate thesis conducted at the Lab for Innovative Infrastructure Systems (LIIS), The University of Tokyo.
We are deeply grateful to Prof. Daisuke Fukuda (福田 大輔) and Asst. Prof. Keishi Fujiwara (藤原啓示) for their valuable academic guidance and theoretical advice regarding the structural estimation frameworks used in this library.
Note on Maintenance: This is an independent open-source project maintained by Haruto Ito. Please adhere to the license terms regarding liability.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file econox-0.1.3.tar.gz.
File metadata
- Download URL: econox-0.1.3.tar.gz
- Upload date:
- Size: 155.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5563b02c59eaba33ab3f4c114ee5746bac5891fce9f3ee4ec6d9e8e2da24b02
|
|
| MD5 |
041664786038386ea59124f893ec8d06
|
|
| BLAKE2b-256 |
494ebb101a4ed2cf95e97a91d0967d228804659a698f71f0c90cad2513e84153
|
Provenance
The following attestation bundles were made for econox-0.1.3.tar.gz:
Publisher:
publish.yml on ito-haru/econox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
econox-0.1.3.tar.gz -
Subject digest:
a5563b02c59eaba33ab3f4c114ee5746bac5891fce9f3ee4ec6d9e8e2da24b02 - Sigstore transparency entry: 832574578
- Sigstore integration time:
-
Permalink:
ito-haru/econox@75392a7bb0a5e91188c96e52bae976fdf1b04b31 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ito-haru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@75392a7bb0a5e91188c96e52bae976fdf1b04b31 -
Trigger Event:
push
-
Statement type:
File details
Details for the file econox-0.1.3-py3-none-any.whl.
File metadata
- Download URL: econox-0.1.3-py3-none-any.whl
- Upload date:
- Size: 62.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4785d8102a91dc15c8bf248447d9e23be670f5a446b1fec7cdc133902a9d6918
|
|
| MD5 |
0a14c1af8ea9cf7cafeef8c9bab48103
|
|
| BLAKE2b-256 |
72992b526e217e541761517d9bede1a65ee119d6d62af4e65c19503cbd107687
|
Provenance
The following attestation bundles were made for econox-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on ito-haru/econox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
econox-0.1.3-py3-none-any.whl -
Subject digest:
4785d8102a91dc15c8bf248447d9e23be670f5a446b1fec7cdc133902a9d6918 - Sigstore transparency entry: 832574579
- Sigstore integration time:
-
Permalink:
ito-haru/econox@75392a7bb0a5e91188c96e52bae976fdf1b04b31 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ito-haru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@75392a7bb0a5e91188c96e52bae976fdf1b04b31 -
Trigger Event:
push
-
Statement type: