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.6.tar.gz (6.3 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.6-py3-none-any.whl (6.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: econirl-0.0.6.tar.gz
  • Upload date:
  • Size: 6.3 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.6.tar.gz
Algorithm Hash digest
SHA256 cb5bb0bf135770e882d0aec7ac3eada5493d218b2530c28226841330752b395d
MD5 639376111a440049d617465de62ddc89
BLAKE2b-256 24f70ada63acdd6bec13c956ddf5554a9f0a700b9186ee357379268a5e514e21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: econirl-0.0.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1a0fc565f2ee6559b6347bf9b8ad96df691bfcc8901dd6be916237a3d92e0de1
MD5 3db85282767b46274819e212fff697fa
BLAKE2b-256 003b8acd242b63c02c9e5b01a9dcbb0b7100552c54c3c7cb0bea6a7f8fe5fa88

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