Skip to main content

Behavioral inference. IRL and DDC with standard errors.

Project description

econirl

Structural dynamic discrete choice and inverse reinforcement learning in Python.

EconIRL helps estimate forward-looking choice models, recover reward functions, and evaluate counterfactual policies from panel data.

Documentation: https://econirl.readthedocs.io/

Install

pip install econirl

Quick Start

from econirl.datasets import load_rust_bus
from econirl import NFXP

df = load_rust_bus()

model = NFXP(n_states=90, discount=0.9999, utility="linear_cost")
model.fit(df, state="mileage_bin", action="replaced", id="bus_id")

print(model.params_)

cf = model.counterfactual(RC=4.0)
print(cf.policy[50, 1])

Example output:

{'theta_c': 0.0010028828858836278, 'RC': 3.0722093435989524}
0.05519477716656161

Public Estimator Guides

The public docs describe the supported estimator surface and the current validation scope for each method.

Estimator Best for Public evidence scope
NFXP Exact tabular dynamic discrete choice. Synthetic tabular validation.
CCP / NPL Hotz-Miller and NPL-style tabular DDC. Synthetic tabular validation with support conditions.
MPEC Constrained likelihood formulation. Synthetic constrained-likelihood validation.
NNES Neural value approximation inside NPL. Low- and high-dimensional synthetic validation.
TD-CCP Transition-density-free CCP estimation. Encoded-state finite-theta validation.
MCE-IRL Maximum causal entropy reward-feature matching. Supplied-feature simulation validation.
Deep MCE-IRL Neural reward-map recovery with known transitions. Anchored neural reward-map validation.
AIRL Adversarial state-reward recovery under AIRL assumptions. State-only AIRL validation.
AIRL-Het Anchored adversarial recovery with latent segments. Serialized-content simulation validation.
f-IRL f-divergence state-marginal matching. State-marginal simulation validation.
GLADIUS Neural Q and continuation modeling. Preview diagnostics.
IQ-Learn Inverse soft-Q learning. Preview diagnostics.

Package Surface

The recommended API is sklearn-style:

from econirl import NFXP, CCP, MPEC, NNES, TDCCP, MCEIRL

Additional estimators and lower-level configuration objects are available under econirl.estimation, econirl.estimators, and econirl.contrib for advanced workflows.

Repository Layout

  • src/econirl/: package source.
  • tests/: unit, integration, and validation-evidence tests.
  • docs/: public Read the Docs source.
  • validation/: reproducible validation runners and machine-readable results.
  • examples/: public examples and notebooks.

Manuscripts, PDFs, local research workspaces, and assistant-specific notes are not tracked in this public package repository.

License

MIT

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

econirl-0.0.7.tar.gz (6.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

econirl-0.0.7-py3-none-any.whl (6.3 MB view details)

Uploaded Python 3

File details

Details for the file econirl-0.0.7.tar.gz.

File metadata

  • Download URL: econirl-0.0.7.tar.gz
  • Upload date:
  • Size: 6.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for econirl-0.0.7.tar.gz
Algorithm Hash digest
SHA256 7d12c9214c688526edd8c7fec96670e1f3f11923adf17672cdb3d6d08a9cf23d
MD5 b16c340d34af28a1b384d01ff9be0740
BLAKE2b-256 3253664a5b9072ca3e78a870dbb3ab32835e6a2b62a771919e5b65089f2bd1b6

See more details on using hashes here.

File details

Details for the file econirl-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: econirl-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for econirl-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 371a5c1a14ff83256d7af6a1059c854f1a8c28322d95cbb3f71f497316df3fae
MD5 e86f5ec4b13c809feb2b27b958021eea
BLAKE2b-256 e73a3e503b0a1344fe4f13c48ab03294a07bca87c59e8af18fc2fcc4e1ea848a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page