econirl

EconIRL is a Python package for structural dynamic discrete choice and inverse reinforcement learning. Use it to estimate forward-looking choice models, recover rewards, and evaluate counterfactual policies.

If you are new to these models, read this page as a map: first install the package, then choose an estimator, then use the estimator-specific pages for the math, assumptions, evidence, and examples.

Install

pip install econirl

Estimators

Start with Choosing and Comparing Estimators for the estimator chooser, the canonical NFXP case, side-by-side tables, reward targets, transitions, and identification strategies.

The links below are method pages. Open one after you know the decision problem, the data you have, and the reward object you want to recover.

NFXP · CCP · MPEC · UFXP · NNES · TD-CCP · MCE-IRL · Neural MCE-IRL · AIRL · AIRL-Het · RHIP · f-IRL · GLADIUS · IQ-Learn

Theory

See Theory for the proof map behind the core estimators: soft Bellman equivalence, reward identification, classical DDC inversion, IRL identification boundaries, and the GLADIUS empirical-risk objective.

Replications

See Replications for the terse paper-number ledger. That page is about direct paper-number comparisons; broader synthetic evidence lives in the simulation studies.

Example

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])

Output

{'theta_c': 0.0010029257006533541, 'RC': 3.072263842893654}
0.055196291500871957