Estimate a replacement problem, solve its Bellman equation, and change a policy.
Why current utility is not enough
A decision changes both current utility and the distribution of future states. Let P_a(s,s') be a controlled transition matrix, u_\theta(s,a) flow utility, and \delta<1 the discount factor. Under independent type-I extreme-value choice shocks, a normalized integrated value function satisfies
The Euler constant is absorbed into a common value normalization; it does not affect choice probabilities. The softmax of the choice-specific values gives p_\theta(a\mid s). A discount factor below one makes this Bellman map a contraction. Trex uses dense transition tensors of shape (n_states, n_choices, n_states).
Two estimation routes
RustNFP maximizes \sum_i\log p_\theta(a_i\mid s_i), solving the Bellman fixed point inside likelihood evaluations. Stable log probabilities matter: adding a probability floor before taking logs can flatten gradients for very unlikely observations.
HotzMillerCCP first estimates conditional choice probabilities \hat p. With P_{\hat p}=\sum_a\hat p_aP_a, policy evaluation gives
This avoids repeated Bellman iterations during the second-stage criterion. Estimated CCPs still introduce sampling error. Sparse state-action cells, smoothing, and first-stage approximation can strongly affect results. Trex’s post-fit predict_proba re-solves the structural model rather than returning the empirical first-stage probabilities.
Worked example: replace a deteriorating machine
Keeping the machine costs \theta_m s; replacement costs \theta_r. Replacement mostly resets the state. We generate decisions from an independent NumPy Bellman calculation, hold the transition law fixed, and estimate both cost parameters. This is a small correctness illustration, not Rust’s original bus data or an empirical demand estimate.
Reducing replacement cost changes continuation values as well as current utility. counterfactual re-solves the model and can simulate new paths without mutating fitted baseline parameters. It starts each individual at their earliest observed state. Supply an explicit horizon for an unbalanced panel.
Figure 1: Structural replacement probabilities before and after reducing replacement cost by half.
What this does not establish
The example conditions on known transitions and a fixed discount factor. If transitions are estimated, their uncertainty belongs in inference. Utility levels and the shock scale require normalization; a good fit to a policy does not identify unrestricted rewards or all counterfactuals. LinearFlowUtility supports specified features, while DeepValueFunction is a helper, not a turnkey neural inverse-RL estimator.
Standard errors for the dynamic estimators are not implemented. Dense transition storage also limits large state spaces. Check Bellman residuals, state coverage, likelihood gradients and optimizer sensitivity before using the results in a structural application.